diff options
Diffstat (limited to 'src/commands/info')
-rw-r--r-- | src/commands/info/botInfo.ts | 13 | ||||
-rw-r--r-- | src/commands/info/help.ts | 14 | ||||
-rw-r--r-- | src/commands/info/ping.ts | 19 | ||||
-rw-r--r-- | src/commands/info/pronouns.ts | 36 |
4 files changed, 42 insertions, 40 deletions
diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index ebbd0c9..66bf5af 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -1,6 +1,7 @@ -import { MessageEmbed, Message, CommandInteraction } from 'discord.js'; -import { BushCommand } from '../../lib/extensions/BushCommand'; +import { Message, MessageEmbed } from 'discord.js'; import { duration } from 'moment'; +import { BushCommand } from '../../lib/extensions/BushCommand'; +import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; export default class BotInfoCommand extends BushCommand { constructor() { @@ -33,7 +34,7 @@ export default class BotInfoCommand extends BushCommand { }, { name: 'User count', - value: this.client.users.cache.size, + value: this.client.users.cache.size.toString(), inline: true }, { @@ -46,10 +47,10 @@ export default class BotInfoCommand extends BushCommand { } public async exec(message: Message): Promise<void> { - await message.util.send(await this.generateEmbed()); + await message.util.send({ embeds: [await this.generateEmbed()] }); } - public async execSlash(message: CommandInteraction): Promise<void> { - await message.reply(await this.generateEmbed()); + public async execSlash(message: BushInteractionMessage): Promise<void> { + await message.interaction.reply({ embeds: [await this.generateEmbed()] }); } } diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index 0629bf1..317091e 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -1,8 +1,8 @@ -import { Message, MessageEmbed } from 'discord.js'; -import { BushCommand } from '../../lib/extensions/BushCommand'; import { stripIndent } from 'common-tags'; import { ApplicationCommandOptionType } from 'discord-api-types'; -import { CommandInteraction } from 'discord.js'; +import { Message, MessageEmbed } from 'discord.js'; +import { BushCommand } from '../../lib/extensions/BushCommand'; +import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; import { SlashCommandOption } from '../../lib/extensions/Util'; export default class HelpCommand extends BushCommand { @@ -72,14 +72,14 @@ export default class HelpCommand extends BushCommand { } public async exec(message: Message, { command }: { command: BushCommand }): Promise<void> { - await message.util.send(this.generateEmbed(command)); + await message.util.send({ embeds: [this.generateEmbed(command)] }); } - public async execSlash(message: CommandInteraction, { command }: { command: SlashCommandOption<string> }): Promise<void> { + public async execSlash(message: BushInteractionMessage, { command }: { command: SlashCommandOption<string> }): Promise<void> { if (command) { - await message.reply(this.generateEmbed(this.handler.findCommand(command.value) as BushCommand)); + await message.interaction.reply({ embeds: [this.generateEmbed(this.handler.findCommand(command.value) as BushCommand)] }); } else { - await message.reply(this.generateEmbed()); + await message.interaction.reply({ embeds: [this.generateEmbed()] }); } } } diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts index b130e6d..feb48ad 100644 --- a/src/commands/info/ping.ts +++ b/src/commands/info/ping.ts @@ -1,7 +1,6 @@ -import { CommandInteraction } from 'discord.js'; -import { Message } from 'discord.js'; -import { MessageEmbed } from 'discord.js'; +import { Message, MessageEmbed } from 'discord.js'; import { BushCommand } from '../../lib/extensions/BushCommand'; +import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; export default class PingCommand extends BushCommand { constructor() { @@ -29,23 +28,23 @@ export default class PingCommand extends BushCommand { .setTimestamp(); await sentMessage.edit({ content: null, - embed + embeds: [embed] }); } - public async execSlash(message: CommandInteraction): Promise<void> { - const timestamp1 = message.createdTimestamp; - await message.reply('Pong!'); - const timestamp2 = await message.fetchReply().then((m) => (m as Message).createdTimestamp); + public async execSlash(message: BushInteractionMessage): Promise<void> { + const timestamp1 = message.interaction.createdTimestamp; + await message.interaction.reply('Pong!'); + const timestamp2 = await message.interaction.fetchReply().then((m) => (m as Message).createdTimestamp); const botLatency = `\`\`\`\n ${Math.floor(timestamp2 - timestamp1)}ms \`\`\``; const apiLatency = `\`\`\`\n ${Math.round(this.client.ws.ping)}ms \`\`\``; const embed = new MessageEmbed() .setTitle('Pong! 🏓') .addField('Bot Latency', botLatency, true) .addField('API Latency', apiLatency, true) - .setFooter(message.user.username, message.user.displayAvatarURL({ dynamic: true })) + .setFooter(message.interaction.user.username, message.interaction.user.displayAvatarURL({ dynamic: true })) .setTimestamp(); - await message.editReply({ + await message.interaction.editReply({ content: null, embeds: [embed] }); diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts index 740eb68..faf3aa2 100644 --- a/src/commands/info/pronouns.ts +++ b/src/commands/info/pronouns.ts @@ -1,8 +1,8 @@ -import { BushCommand } from '../../lib/extensions/BushCommand'; -import { User, Message, MessageEmbed } from 'discord.js'; -import got, { HTTPError } from 'got'; -import { CommandInteraction } from 'discord.js'; import { ApplicationCommandOptionType } from 'discord-api-types'; +import { CommandInteraction, Message, MessageEmbed, User } from 'discord.js'; +import got, { HTTPError } from 'got'; +import { BushCommand } from '../../lib/extensions/BushCommand'; +import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; import { SlashCommandOption } from '../../lib/extensions/Util'; export const pronounMapping = { @@ -56,7 +56,7 @@ export default class PronounsCommand extends BushCommand { required: false } ], - slashEmphemeral: true // I'll add dynamic checking to this later + slashEphemeral: true // I'll add dynamic checking to this later }); } async sendResponse(message: Message | CommandInteraction, user: User, author: boolean): Promise<void> { @@ -65,15 +65,17 @@ export default class PronounsCommand extends BushCommand { .get(`https://pronoundb.org/api/v1/lookup?platform=discord&id=${user.id}`) .json(); if (message instanceof Message) { - message.reply( - new MessageEmbed({ - title: `${author ? 'Your' : `${user.tag}'s`} pronouns:`, - description: pronounMapping[apiRes.pronouns], - footer: { - text: 'Data provided by https://pronoundb.org/' - } - }) - ); + message.reply({ + embeds: [ + new MessageEmbed({ + title: `${author ? 'Your' : `${user.tag}'s`} pronouns:`, + description: pronounMapping[apiRes.pronouns], + footer: { + text: 'Data provided by https://pronoundb.org/' + } + }) + ] + }); } else { message.reply({ embeds: [ @@ -105,8 +107,8 @@ export default class PronounsCommand extends BushCommand { const u = user || message.author; await this.sendResponse(message, u, u.id === message.author.id); } - async execSlash(message: CommandInteraction, { user }: { user?: SlashCommandOption<void> }): Promise<void> { - const u = user?.user || message.user; - await this.sendResponse(message, u, u.id === message.user.id); + async execSlash(message: BushInteractionMessage, { user }: { user?: SlashCommandOption<void> }): Promise<void> { + const u = user?.user || message.author; + await this.sendResponse(message.interaction, u, u.id === message.author.id); } } |