diff --git a/commands/edit-avatar/eject.js b/commands/edit-avatar/eject.js index 7e133c01..38b94e33 100644 --- a/commands/edit-avatar/eject.js +++ b/commands/edit-avatar/eject.js @@ -55,7 +55,7 @@ module.exports = class EjectCommand extends Command { const avatar = await loadImage(body); const random = MersenneTwister19937.seed(user.id); const imposter = bool()(random); - const text = `${user.username} was${imposter ? ' ' : ' not '}An Imposter.`; + const text = `${user.globalName || user.username} was${imposter ? ' ' : ' not '}An Imposter.`; const encoder = new GifEncoder(320, 180); const stream = encoder.createReadStream(); const canvas = createCanvas(320, 180); diff --git a/commands/edit-avatar/rip.js b/commands/edit-avatar/rip.js index 38d43ee9..e2d01b5b 100644 --- a/commands/edit-avatar/rip.js +++ b/commands/edit-avatar/rip.js @@ -64,7 +64,7 @@ module.exports = class RipCommand extends Command { ctx.textBaseline = 'top'; ctx.textAlign = 'center'; ctx.font = this.client.fonts.get('CoffinStone.otf').toCanvasString(62); - this.fillPressedText(ctx, user.username, 438, 330, 500); + this.fillPressedText(ctx, user.globalName || user.username, 438, 330, 500); if (cause) this.fillPressedText(ctx, cause, 438, 920, 500); ctx.font = this.client.fonts.get('CoffinStone.otf').toCanvasString(37); this.fillPressedText(ctx, 'In Loving Memory of', 438, 292); diff --git a/commands/edit-avatar/steam-now-playing.js b/commands/edit-avatar/steam-now-playing.js index e208d48c..49258b4c 100644 --- a/commands/edit-avatar/steam-now-playing.js +++ b/commands/edit-avatar/steam-now-playing.js @@ -55,7 +55,7 @@ module.exports = class SteamNowPlayingCommand extends Command { ctx.drawImage(avatar, 26, 26, 41, 42); ctx.fillStyle = '#90b93c'; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(14); - ctx.fillText(user.username, 80, 34); + ctx.fillText(user.globalName || user.username, 80, 34); ctx.fillText(shortenText(ctx, game, 200), 80, 70); return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'steam-now-playing.png' }] }); } diff --git a/commands/edit-image-text/axis-cult-sign-up.js b/commands/edit-image-text/axis-cult-sign-up.js index eaa21ed5..983192e5 100644 --- a/commands/edit-image-text/axis-cult-sign-up.js +++ b/commands/edit-image-text/axis-cult-sign-up.js @@ -75,10 +75,10 @@ module.exports = class AxisCultSignUpCommand extends Command { } else { ctx.font = this.client.fonts.get('Konosuba.ttf').toCanvasString(96); } - ctx.fillText(msg.author.username, 960, 1558); + ctx.fillText(msg.author.globalName || msg.author.username, 960, 1558); ctx.fillText(gender, 960, 1752); ctx.fillText(age, 1700, 1752); - ctx.fillText('XXX-XXX-XXXX', 960, 1960); + ctx.fillText(msg.author.id, 960, 1960); ctx.fillText(profession, 960, 2169); ctx.fillText('Xiao', 960, 2370); if (flags.english || flags.en) { diff --git a/commands/edit-image-text/certificate.js b/commands/edit-image-text/certificate.js index 8b268aa5..34a8f2a7 100644 --- a/commands/edit-image-text/certificate.js +++ b/commands/edit-image-text/certificate.js @@ -45,7 +45,7 @@ module.exports = class CertificateCommand extends Command { key: 'name', type: 'string', max: 30, - default: msg => msg.author.username + default: msg => msg.author.globalName || msg.author.username } ] }); diff --git a/commands/games-mp/emoji-emoji-revolution.js b/commands/games-mp/emoji-emoji-revolution.js index 3266e745..213ba50b 100644 --- a/commands/games-mp/emoji-emoji-revolution.js +++ b/commands/games-mp/emoji-emoji-revolution.js @@ -65,8 +65,8 @@ module.exports = class EmojiEmojiRevolutionCommand extends Command { else ++oPts; await msg.say(stripIndents` ${winner} won this round! - **${msg.author.username}:** ${aPts} - **${opponent.username}:** ${oPts} + **${msg.author.globalName || msg.author.username}:** ${aPts} + **${opponent.globalName || opponent.username}:** ${oPts} `); if (lastTurnTimeout) lastTurnTimeout = false; } diff --git a/commands/random-res/compliment.js b/commands/random-res/compliment.js index 20a1351c..3cfec168 100644 --- a/commands/random-res/compliment.js +++ b/commands/random-res/compliment.js @@ -18,6 +18,7 @@ module.exports = class ComplimentCommand extends Command { } run(msg, { user }) { - return msg.say(`${user.username}, ${compliments[Math.floor(Math.random() * compliments.length)]}`); + const compliment = compliments[Math.floor(Math.random() * compliments.length)]; + return msg.say(`${user.globalName || user.username}, ${compliment}`); } }; diff --git a/commands/random-res/roast.js b/commands/random-res/roast.js index 4c616cae..5b5632f0 100644 --- a/commands/random-res/roast.js +++ b/commands/random-res/roast.js @@ -19,6 +19,7 @@ module.exports = class RoastCommand extends Command { } run(msg, { user }) { - return msg.say(`${user.username}, ${roasts[Math.floor(Math.random() * roasts.length)]}`); + const roast = roasts[Math.floor(Math.random() * roasts.length)]; + return msg.say(`${user.globalName || user.username}, ${roast}`); } }; diff --git a/commands/random-seed/butt.js b/commands/random-seed/butt.js index 0109ebe5..1ac2906f 100644 --- a/commands/random-seed/butt.js +++ b/commands/random-seed/butt.js @@ -29,13 +29,14 @@ module.exports = class ButtCommand extends Command { run(msg, { user }) { const authorUser = user.id === msg.author.id; + const displayName = user.globalName || user.username; if (user.id === this.client.user.id) return msg.reply('Me? I think I have the best butt around!'); if (this.client.isOwner(user)) { if (authorUser) return msg.reply('ur butt is the best, mother'); - return msg.reply(`${user.username}'s butt is... Something, I'll say that much.`); + return msg.reply(`${displayName}'s butt is... Something, I'll say that much.`); } const random = MersenneTwister19937.seed(user.id); const quality = integer(0, texts.length - 1)(random); - return msg.reply(`${authorUser ? 'ur' : `${user.username}'s`} butt is ${texts[quality]}`); + return msg.reply(`${authorUser ? 'ur' : `${displayName}'s`} butt is ${texts[quality]}`); } }; diff --git a/commands/random-seed/coolness.js b/commands/random-seed/coolness.js index bd09ee80..eb520064 100644 --- a/commands/random-seed/coolness.js +++ b/commands/random-seed/coolness.js @@ -22,14 +22,15 @@ module.exports = class CoolnessCommand extends Command { run(msg, { user }) { const authorUser = user.id === msg.author.id; + const displayName = user.globalName || user.username; if (user.id === this.client.user.id) return msg.reply('Me? I think I\'m the very best, like no one ever was.'); if (this.client.isOwner(user)) { if (authorUser) return msg.reply('You\'re the best owner a bot could ask for! ❤'); - return msg.reply(`Don't tell her I said this but I think ${user.username} smells like a sack of diapers.`); + return msg.reply(`Don't tell her I said this but I think ${displayName} smells like a sack of diapers.`); } - if (user.id === LOVER_USER_ID) return msg.reply(`${user.username} is by far the coolest person ever! ❤`); + if (user.id === LOVER_USER_ID) return msg.reply(`${displayName} is by far the coolest person ever! ❤`); const random = MersenneTwister19937.seed(user.id); const coolness = integer(0, texts.length - 1)(random); - return msg.reply(`${authorUser ? 'You are' : `${user.username} is`} ${texts[coolness]}`); + return msg.reply(`${authorUser ? 'You are' : `${displayName} is`} ${texts[coolness]}`); } }; diff --git a/commands/random-seed/cuteness.js b/commands/random-seed/cuteness.js index e29dc2d9..24751def 100644 --- a/commands/random-seed/cuteness.js +++ b/commands/random-seed/cuteness.js @@ -22,14 +22,15 @@ module.exports = class CutenessCommand extends Command { run(msg, { user }) { const authorUser = user.id === msg.author.id; + const displayName = user.globalName || user.username; if (user.id === this.client.user.id) return msg.reply('Me? I think I\'m by far the cutest girl ever!'); if (this.client.isOwner(user)) { if (authorUser) return msg.reply('You\'re the most adorable little cutie I know! ❤'); - return msg.reply(`${user.username} is ugly. Like, not cute at all.`); + return msg.reply(`${displayName} is ugly. Like, not cute at all.`); } - if (user.id === LOVER_USER_ID) return msg.reply(`${user.username} is by far the cutest person ever! ❤`); + if (user.id === LOVER_USER_ID) return msg.reply(`${displayName} is by far the cutest person ever! ❤`); const random = MersenneTwister19937.seed(user.id); const cuteness = integer(0, texts.length - 1)(random); - return msg.reply(`${authorUser ? 'You are' : `${user.username} is`} ${texts[cuteness]}`); + return msg.reply(`${authorUser ? 'You are' : `${displayName} is`} ${texts[cuteness]}`); } }; diff --git a/commands/random-seed/friendship.js b/commands/random-seed/friendship.js index 6fff71cd..14cfb0f7 100644 --- a/commands/random-seed/friendship.js +++ b/commands/random-seed/friendship.js @@ -81,8 +81,8 @@ module.exports = class FriendshipCommand extends Command { ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(40); ctx.fillText('~Xiao\'s Friendship Meter~', 600, 15); ctx.fillStyle = 'white'; - ctx.fillText(first.username, 270, 448); - ctx.fillText(second.username, 930, 448); + ctx.fillText(first.globalName || first.username, 270, 448); + ctx.fillText(second.globalName || second.username, 930, 448); ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(60); ctx.fillStyle = percentColor(level / 100, percentColors); ctx.fillText(`~${level}%~`, 600, 230); diff --git a/commands/random-seed/guess-looks.js b/commands/random-seed/guess-looks.js index dbeed1fa..3945a017 100644 --- a/commands/random-seed/guess-looks.js +++ b/commands/random-seed/guess-looks.js @@ -24,13 +24,14 @@ module.exports = class GuessLooksCommand extends Command { run(msg, { user }) { if (user.id === this.client.user.id) return msg.reply('Me? Just look at my avatar, dummy.'); + const displayName = user.globalName || user.username; const authorUser = user.id === msg.author.id; if (this.client.isOwner(user)) { if (authorUser) return msg.reply('You look amazing as always, cutie! ❤'); - return msg.reply(`${user.username} looks like a monkey, and smells like one too.`); + return msg.reply(`${displayName} looks like a monkey, and smells like one too.`); } if (user.id === LOVER_USER_ID) { - return msg.reply(`Know what perfection looks like? That's what ${user.username} looks like. ❤`); + return msg.reply(`Know what perfection looks like? That's what ${displayName} looks like. ❤`); } const random = MersenneTwister19937.seed(user.id); const gender = genders[integer(0, genders.length - 1)(random)]; @@ -43,7 +44,7 @@ module.exports = class GuessLooksCommand extends Command { const weight = integer(50, 300)(random); const extra = extras[integer(0, extras.length - 1)(random)]; return msg.reply(oneLine` - I think ${authorUser ? 'you are' : `${user.username} is`} a ${age} year old ${gender} with ${eyeColor} eyes + I think ${authorUser ? 'you are' : `${displayName} is`} a ${age} year old ${gender} with ${eyeColor} eyes and ${hairStyle} ${hairColor} hair. ${authorUser ? 'You are' : `${gender === 'man' ? 'He' : 'She'} is`} ${feet}'${inches}" and weigh${authorUser ? '' : 's'} ${weight} pounds. Don't forget the ${extra}! `); diff --git a/commands/random-seed/iq.js b/commands/random-seed/iq.js index ef7a0c70..c5c39d86 100644 --- a/commands/random-seed/iq.js +++ b/commands/random-seed/iq.js @@ -20,13 +20,14 @@ module.exports = class IQCommand extends Command { run(msg, { user }) { const authorUser = user.id === msg.author.id; + const displayName = user.globalName || user.username; if (user.id === this.client.user.id) return msg.reply('Me? My IQ score is off the charts!'); if (this.client.isOwner(user)) { if (authorUser) return msg.reply('Only someone of the highest IQ could make a bot as amazing as me! ❤'); - return msg.reply(`${user.username}, as in my owner? Yeah... Not the sharpest tool in the shed.`); + return msg.reply(`${displayName}, as in my owner? Yeah... Not the sharpest tool in the shed.`); } const random = MersenneTwister19937.seed(user.id); const score = integer(20, 170)(random); - return msg.reply(`${authorUser ? 'Your' : `${user.username}'s`} IQ score is ${score}.`); + return msg.reply(`${authorUser ? 'Your' : `${displayName}'s`} IQ score is ${score}.`); } }; diff --git a/commands/random-seed/name-rater.js b/commands/random-seed/name-rater.js index 14ef29cd..25a00c23 100644 --- a/commands/random-seed/name-rater.js +++ b/commands/random-seed/name-rater.js @@ -23,7 +23,7 @@ module.exports = class NameRaterCommand extends Command { key: 'name', type: 'string', max: 25, - default: msg => msg.author.username, + default: msg => msg.author.globalName || msg.author.username, validate: async name => { const matches = name.match(/^(?:<@!?)([0-9]+)>$/); if (matches) { @@ -48,7 +48,7 @@ module.exports = class NameRaterCommand extends Command { } run(msg, { name }) { - if (name instanceof User) name = name.username; + if (name instanceof User) name = name.globalName || name.username; if (name.toLowerCase() === this.client.user.username.toLowerCase()) { return msg.say( `<:${NAME_RATER_EMOJI_NAME}:${NAME_RATER_EMOJI_ID}> Yes, ${name}! What a perfect name! I'm speechless!` diff --git a/commands/random-seed/ship.js b/commands/random-seed/ship.js index d2da7da2..d52f206d 100644 --- a/commands/random-seed/ship.js +++ b/commands/random-seed/ship.js @@ -84,8 +84,8 @@ module.exports = class ShipCommand extends Command { ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(40); ctx.fillText('~Xiao\'s Compatability Meter~', 600, 15); ctx.fillStyle = 'white'; - ctx.fillText(first.username, 270, 448); - ctx.fillText(second.username, 930, 448); + ctx.fillText(first.globalName || first.username, 270, 448); + ctx.fillText(second.globalName || second.username, 930, 448); ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(60); ctx.fillStyle = percentColor(level / 100, percentColors); ctx.fillText(`~${level}%~`, 600, 230); diff --git a/commands/random-seed/think-of.js b/commands/random-seed/think-of.js index 2ad4c3f8..5af2f5f5 100644 --- a/commands/random-seed/think-of.js +++ b/commands/random-seed/think-of.js @@ -78,8 +78,8 @@ module.exports = class ThinkOfCommand extends Command { ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(40); ctx.fillText('~Xiao\'s Thought Reader~', 600, 15); ctx.fillStyle = 'white'; - ctx.fillText(first.username, 270, 448); - ctx.fillText(second.username, 930, 448); + ctx.fillText(first.globalName || first.username, 270, 448); + ctx.fillText(second.globalName || first.username, 930, 448); ctx.fillStyle = thought.color; ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(40); ctx.fillText('thinks they are', 600, 230); diff --git a/commands/random-seed/worth.js b/commands/random-seed/worth.js index 0cffa6bb..69b96ab7 100644 --- a/commands/random-seed/worth.js +++ b/commands/random-seed/worth.js @@ -22,16 +22,17 @@ module.exports = class WorthCommand extends Command { run(msg, { user }) { const authorUser = user.id === msg.author.id; + const displayName = user.globalName || user.username; if (user.id === this.client.user.id) return msg.reply('Me? I\'m worth $5/month. At least that\'s how much I cost.'); if (this.client.isOwner(user)) { if (authorUser) return msg.reply('Infinity, you amazing owner! ❤'); - return msg.reply(`${user.username}, as in my owner? Worthless. Absolutely worthless.`); + return msg.reply(`${displayName}, as in my owner? Worthless. Absolutely worthless.`); } if (user.id === LOVER_USER_ID) { - return msg.reply(`${user.username} is worth more than anyone else on this Earth! ❤`); + return msg.reply(`${displayName} is worth more than anyone else on this Earth! ❤`); } const random = MersenneTwister19937.seed(user.id); const worth = integer(0, 1000000)(random); - return msg.reply(`${authorUser ? 'You are' : `${user.username} is`} worth $${formatNumber(worth)}.`); + return msg.reply(`${authorUser ? 'You are' : `${displayName} is`} worth $${formatNumber(worth)}.`); } }; diff --git a/framework/types/member.js b/framework/types/member.js index e276bde7..837828fc 100644 --- a/framework/types/member.js +++ b/framework/types/member.js @@ -46,12 +46,14 @@ module.exports = class MemberArgumentType extends ArgumentType { function memberFilterExact(search) { return mem => mem.user.username.toLowerCase() === search + || (mem.user.globalName && mem.user.globalName.toLowerCase() === search) || (mem.nickname && mem.nickname.toLowerCase() === search) || mem.tag.toLowerCase() === search; } function memberFilterInexact(search) { return mem => mem.user.username.toLowerCase().includes(search) + || (mem.user.globalName && mem.user.globalName.toLowerCase().includes(search)) || (mem.nickname && mem.nickname.toLowerCase().includes(search)) || mem.tag.toLowerCase().includes(search); } diff --git a/framework/types/user.js b/framework/types/user.js index e43aa2e4..5f3bbfe7 100644 --- a/framework/types/user.js +++ b/framework/types/user.js @@ -48,12 +48,14 @@ module.exports = class UserArgumentType extends ArgumentType { function memberFilterExact(search) { return mem => mem.user.username.toLowerCase() === search + || (mem.user.globalName && mem.user.globalName.toLowerCase() === search) || (mem.nickname && mem.nickname.toLowerCase() === search) || mem.tag.toLowerCase() === search; } function memberFilterInexact(search) { return mem => mem.user.username.toLowerCase().includes(search) + || (mem.user.globalName && mem.user.globalName.toLowerCase().includes(search)) || (mem.nickname && mem.nickname.toLowerCase().includes(search)) - || mem.user.tag.toLowerCase().includes(search); + || mem.tag.toLowerCase().includes(search); } diff --git a/structures/cards-against-humanity/Player.js b/structures/cards-against-humanity/Player.js index 88cff23c..c9fda618 100644 --- a/structures/cards-against-humanity/Player.js +++ b/structures/cards-against-humanity/Player.js @@ -115,7 +115,7 @@ module.exports = class Player { ${hand.map((card, i) => `**${i + 1}.** ${escapeMarkdown(card)}`).join('\n')} **${this.game.blackType} Card:** ${escapeMarkdown(black.text)} - **Card Czar:** ${this.game.czar.user.username} + **Card Czar:** ${this.game.czar.user.globalName || this.game.czar.user.username} **Awesome Points:** ${this.points} **Strikes:** ${this.strikes}/3