aboutsummaryrefslogtreecommitdiff
path: root/src/commands/info
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/info')
-rw-r--r--src/commands/info/botInfo.ts (renamed from src/commands/info/botinfo.ts)26
-rw-r--r--src/commands/info/help.ts52
-rw-r--r--src/commands/info/ping.ts35
-rw-r--r--src/commands/info/pronouns.ts6
4 files changed, 34 insertions, 85 deletions
diff --git a/src/commands/info/botinfo.ts b/src/commands/info/botInfo.ts
index 8f5f055..ebbd0c9 100644
--- a/src/commands/info/botinfo.ts
+++ b/src/commands/info/botInfo.ts
@@ -1,11 +1,12 @@
import { MessageEmbed, Message, CommandInteraction } from 'discord.js';
-import { BotCommand } from '../../lib/extensions/BotCommand';
+import { BushCommand } from '../../lib/extensions/BushCommand';
import { duration } from 'moment';
-export default class BotInfoCommand extends BotCommand {
+export default class BotInfoCommand extends BushCommand {
constructor() {
super('botinfo', {
aliases: ['botinfo'],
+ category: 'info',
description: {
content: 'Shows information about the bot',
usage: 'botinfo',
@@ -15,15 +16,9 @@ export default class BotInfoCommand extends BotCommand {
}
private async generateEmbed(): Promise<MessageEmbed> {
- const owners = (await this.client.util.mapIDs(this.client.ownerID))
- .map((u) => u.tag)
- .join('\n');
- const currentCommit = (
- await this.client.util.shell('git rev-parse HEAD')
- ).stdout.replace('\n', '');
- const repoUrl = (
- await this.client.util.shell('git remote get-url origin')
- ).stdout.replace('\n', '');
+ const owners = (await this.client.util.mapIDs(this.client.ownerID)).map((u) => u.tag).join('\n');
+ const currentCommit = (await this.client.util.shell('git rev-parse HEAD')).stdout.replace('\n', '');
+ const repoUrl = (await this.client.util.shell('git remote get-url origin')).stdout.replace('\n', '');
const embed = new MessageEmbed()
.setTitle('Bot Info:')
.addFields([
@@ -34,9 +29,7 @@ export default class BotInfoCommand extends BotCommand {
},
{
name: 'Uptime',
- value: this.client.util.capitalize(
- duration(this.client.uptime, 'milliseconds').humanize()
- )
+ value: this.client.util.capitalize(duration(this.client.uptime, 'milliseconds').humanize())
},
{
name: 'User count',
@@ -45,10 +38,7 @@ export default class BotInfoCommand extends BotCommand {
},
{
name: 'Current commit',
- value: `[${currentCommit.substring(
- 0,
- 7
- )}](${repoUrl}/commit/${currentCommit})`
+ value: `[${currentCommit.substring(0, 7)}](${repoUrl}/commit/${currentCommit})`
}
])
.setTimestamp();
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts
index 116669c..7f6c8f4 100644
--- a/src/commands/info/help.ts
+++ b/src/commands/info/help.ts
@@ -1,14 +1,15 @@
import { Message, MessageEmbed } from 'discord.js';
-import { BotCommand } from '../../lib/extensions/BotCommand';
+import { BushCommand } from '../../lib/extensions/BushCommand';
import { stripIndent } from 'common-tags';
import { ApplicationCommandOptionType } from 'discord-api-types';
import { CommandInteraction } from 'discord.js';
import { SlashCommandOption } from '../../lib/extensions/Util';
-export default class HelpCommand extends BotCommand {
+export default class HelpCommand extends BushCommand {
constructor() {
super('help', {
aliases: ['help'],
+ category: 'info',
description: {
content: 'Shows the commands of the bot',
usage: 'help',
@@ -32,7 +33,7 @@ export default class HelpCommand extends BotCommand {
});
}
- private generateEmbed(command?: BotCommand): MessageEmbed {
+ private generateEmbed(command?: BushCommand): MessageEmbed {
const prefix = this.handler.prefix;
if (!command) {
const embed = new MessageEmbed()
@@ -42,15 +43,11 @@ export default class HelpCommand extends BotCommand {
For additional info on a command, type \`${prefix}help <command>\`
`
)
- .setFooter(
- `For more information about a command use "${this.client.config.prefix}help <command>"`
- )
+ .setFooter(`For more information about a command use "${this.client.config.prefix}help <command>"`)
.setTimestamp();
for (const category of this.handler.categories.values()) {
embed.addField(
- `${category.id.replace(/(\b\w)/gi, (lc): string =>
- lc.toUpperCase()
- )}`,
+ `${category.id.replace(/(\b\w)/gi, (lc): string => lc.toUpperCase())}`,
`${category
.filter((cmd): boolean => cmd.aliases.length > 0)
.map((cmd): string => `\`${cmd.aliases[0]}\``)
@@ -61,45 +58,22 @@ export default class HelpCommand extends BotCommand {
} else {
const embed = new MessageEmbed()
.setColor([155, 200, 200])
- .setTitle(
- `\`${command.description.usage ? command.description.usage : ''}\``
- )
- .addField(
- 'Description',
- `${command.description.content ? command.description.content : ''} ${
- command.ownerOnly ? '\n__Owner Only__' : ''
- }`
- );
+ .setTitle(`\`${command.description.usage ? command.description.usage : ''}\``)
+ .addField('Description', `${command.description.content ? command.description.content : ''} ${command.ownerOnly ? '\n__Owner Only__' : ''}`);
- if (command.aliases.length > 1)
- embed.addField('Aliases', `\`${command.aliases.join('` `')}\``, true);
- if (command.description.examples && command.description.examples.length)
- embed.addField(
- 'Examples',
- `\`${command.description.examples.join('`\n`')}\``,
- true
- );
+ if (command.aliases.length > 1) embed.addField('Aliases', `\`${command.aliases.join('` `')}\``, true);
+ if (command.description.examples && command.description.examples.length) embed.addField('Examples', `\`${command.description.examples.join('`\n`')}\``, true);
return embed;
}
}
- public async exec(
- message: Message,
- { command }: { command: BotCommand }
- ): Promise<void> {
+ public async exec(message: Message, { command }: { command: BushCommand }): Promise<void> {
await message.util.send(this.generateEmbed(command));
}
- public async execSlash(
- message: CommandInteraction,
- { command }: { command: SlashCommandOption<string> }
- ): Promise<void> {
+ public async execSlash(message: CommandInteraction, { command }: { command: SlashCommandOption<string> }): Promise<void> {
if (command) {
- await message.reply(
- this.generateEmbed(
- this.handler.findCommand(command.value) as BotCommand
- )
- );
+ await message.reply(this.generateEmbed(this.handler.findCommand(command.value) as BushCommand));
} else {
await message.reply(this.generateEmbed());
}
diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts
index e51867f..b130e6d 100644
--- a/src/commands/info/ping.ts
+++ b/src/commands/info/ping.ts
@@ -1,12 +1,13 @@
import { CommandInteraction } from 'discord.js';
import { Message } from 'discord.js';
import { MessageEmbed } from 'discord.js';
-import { BotCommand } from '../../lib/extensions/BotCommand';
+import { BushCommand } from '../../lib/extensions/BushCommand';
-export default class PingCommand extends BotCommand {
+export default class PingCommand extends BushCommand {
constructor() {
super('ping', {
aliases: ['ping'],
+ category: 'info',
description: {
content: 'Gets the latency of the bot',
usage: 'ping',
@@ -17,23 +18,14 @@ export default class PingCommand extends BotCommand {
public async exec(message: Message): Promise<void> {
const sentMessage = await message.util.send('Pong!');
- const timestamp: number = message.editedTimestamp
- ? message.editedTimestamp
- : message.createdTimestamp;
- const botLatency = `\`\`\`\n ${Math.floor(
- sentMessage.createdTimestamp - timestamp
- )}ms \`\`\``;
- const apiLatency = `\`\`\`\n ${Math.round(
- message.client.ws.ping
- )}ms \`\`\``;
+ const timestamp: number = message.editedTimestamp ? message.editedTimestamp : message.createdTimestamp;
+ const botLatency = `\`\`\`\n ${Math.floor(sentMessage.createdTimestamp - timestamp)}ms \`\`\``;
+ const apiLatency = `\`\`\`\n ${Math.round(message.client.ws.ping)}ms \`\`\``;
const embed = new MessageEmbed()
.setTitle('Pong! 🏓')
.addField('Bot Latency', botLatency, true)
.addField('API Latency', apiLatency, true)
- .setFooter(
- message.author.username,
- message.author.displayAvatarURL({ dynamic: true })
- )
+ .setFooter(message.author.username, message.author.displayAvatarURL({ dynamic: true }))
.setTimestamp();
await sentMessage.edit({
content: null,
@@ -44,21 +36,14 @@ export default class PingCommand extends BotCommand {
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);
- const botLatency = `\`\`\`\n ${Math.floor(
- timestamp2 - timestamp1
- )}ms \`\`\``;
+ const timestamp2 = await message.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.user.username, message.user.displayAvatarURL({ dynamic: true }))
.setTimestamp();
await message.editReply({
content: null,
diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts
index 97cca34..2c1d5f2 100644
--- a/src/commands/info/pronouns.ts
+++ b/src/commands/info/pronouns.ts
@@ -1,4 +1,4 @@
-import { BotCommand } from '../../lib/extensions/BotCommand';
+import { BushCommand } from '../../lib/extensions/BushCommand';
import { User, Message, MessageEmbed } from 'discord.js';
import got, { HTTPError } from 'got';
import { CommandInteraction } from 'discord.js';
@@ -30,11 +30,11 @@ export const pronounMapping = {
};
export type pronounsType = keyof typeof pronounMapping;
-export default class PronounsCommand extends BotCommand {
+export default class PronounsCommand extends BushCommand {
constructor() {
super('pronouns', {
aliases: ['pronouns', 'pronoun'],
- category: 'utilities',
+ category: 'info',
description: {
usage: 'pronouns <user>',
examples: ['pronouns IRONM00N'],