17 lines
471 B
JavaScript
17 lines
471 B
JavaScript
|
const applyUsername = async (user, member) => {
|
||
|
let rawUsername = member.user.globalName;
|
||
|
|
||
|
if (user.useMinecraftUsername && user.minecraftUUID) {
|
||
|
const response = await fetch(`https://sessionserver.mojang.com/session/minecraft/profile/${user.minecraftUUID}`);
|
||
|
const minecraftProfile = await response.json();
|
||
|
|
||
|
rawUsername = minecraftProfile.name;
|
||
|
}
|
||
|
|
||
|
await member.setNickname(rawUsername);
|
||
|
|
||
|
return rawUsername;
|
||
|
};
|
||
|
|
||
|
module.exports = { applyUsername };
|