mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Use globalName
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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' }] });
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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]}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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]}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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]}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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}!
|
||||
`);
|
||||
|
||||
@@ -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}.`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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!`
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)}.`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user