aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-17 12:31:09 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-17 12:31:09 -0400
commitd40527d0a2d9f209905750258f71bedff1cdf089 (patch)
treee017fd844c2135bfc85228d00ef2617d24ce0a3f /src/commands
parentd431ad00754f3f250103deedea495b9bcee73fc0 (diff)
downloadtanzanite-d40527d0a2d9f209905750258f71bedff1cdf089.tar.gz
tanzanite-d40527d0a2d9f209905750258f71bedff1cdf089.tar.bz2
tanzanite-d40527d0a2d9f209905750258f71bedff1cdf089.zip
turned on ts strict option
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/admin/channelPermissions.ts6
-rw-r--r--src/commands/config/autoPublishChannel.ts6
-rw-r--r--src/commands/config/blacklist.ts13
-rw-r--r--src/commands/config/disable.ts13
-rw-r--r--src/commands/config/muteRole.ts2
-rw-r--r--src/commands/config/prefix.ts4
-rw-r--r--src/commands/config/punishmentFooter.ts2
-rw-r--r--src/commands/config/welcomeChannel.ts4
-rw-r--r--src/commands/dev/eval.ts8
-rw-r--r--src/commands/dev/reload.ts2
-rw-r--r--src/commands/dev/say.ts2
-rw-r--r--src/commands/dev/setLevel.ts7
-rw-r--r--src/commands/dev/sh.ts4
-rw-r--r--src/commands/dev/superUser.ts2
-rw-r--r--src/commands/dev/test.ts14
-rw-r--r--src/commands/fun/minesweeper.ts2
-rw-r--r--src/commands/info/avatar.ts4
-rw-r--r--src/commands/info/botInfo.ts2
-rw-r--r--src/commands/info/color.ts4
-rw-r--r--src/commands/info/guildInfo.ts57
-rw-r--r--src/commands/info/help.ts13
-rw-r--r--src/commands/info/icon.ts6
-rw-r--r--src/commands/info/invite.ts4
-rw-r--r--src/commands/info/pronouns.ts8
-rw-r--r--src/commands/info/snowflakeInfo.ts20
-rw-r--r--src/commands/info/userInfo.ts90
-rw-r--r--src/commands/moderation/_lockdown.ts2
-rw-r--r--src/commands/moderation/ban.ts10
-rw-r--r--src/commands/moderation/kick.ts4
-rw-r--r--src/commands/moderation/modlog.ts3
-rw-r--r--src/commands/moderation/mute.ts10
-rw-r--r--src/commands/moderation/purge.ts5
-rw-r--r--src/commands/moderation/removeReactionEmoji.ts6
-rw-r--r--src/commands/moderation/role.ts12
-rw-r--r--src/commands/moderation/slowmode.ts4
-rw-r--r--src/commands/moderation/unban.ts2
-rw-r--r--src/commands/moderation/unmute.ts6
-rw-r--r--src/commands/moderation/warn.ts8
-rw-r--r--src/commands/moulberry-bush/capePerms.ts2
-rw-r--r--src/commands/moulberry-bush/giveawayPing.ts2
-rw-r--r--src/commands/moulberry-bush/level.ts6
-rw-r--r--src/commands/moulberry-bush/report.ts12
-rw-r--r--src/commands/moulberry-bush/rule.ts6
-rw-r--r--src/commands/skyblock-reborn/chooseColor.ts4
-rw-r--r--src/commands/utilities/activity.ts6
-rw-r--r--src/commands/utilities/decode.ts9
-rw-r--r--src/commands/utilities/price.ts14
-rw-r--r--src/commands/utilities/viewraw.ts17
48 files changed, 262 insertions, 187 deletions
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts
index a13f07a..83230f7 100644
--- a/src/commands/admin/channelPermissions.ts
+++ b/src/commands/admin/channelPermissions.ts
@@ -1,4 +1,4 @@
-import { GuildChannel, GuildMember, MessageEmbed, Role } from 'discord.js';
+import { GuildMember, MessageEmbed, Role } from 'discord.js';
import { BushCommand, BushMessage } from '../../lib';
export default class ChannelPermissionsCommand extends BushCommand {
@@ -63,7 +63,7 @@ export default class ChannelPermissionsCommand extends BushCommand {
}
): Promise<unknown> {
const failedChannels = [];
- for (const channel of message.guild.channels.cache.values()) {
+ for (const channel of message.guild!.channels.cache.values()) {
try {
if (channel.isThread()) return;
if (channel.permissionsLocked) return;
@@ -78,7 +78,7 @@ export default class ChannelPermissionsCommand extends BushCommand {
failedChannels.push(channel);
}
}
- const failure = failedChannels.map((e: GuildChannel) => `<#${e.id}>`).join(' ');
+ const failure = failedChannels.map((e) => `<#${e.id}>`).join(' ');
if (failure.length > 2000) {
const paginate: MessageEmbed[] = [];
for (let i = 0; i < failure.length; i += 2000) {
diff --git a/src/commands/config/autoPublishChannel.ts b/src/commands/config/autoPublishChannel.ts
index 3381dc2..f058402 100644
--- a/src/commands/config/autoPublishChannel.ts
+++ b/src/commands/config/autoPublishChannel.ts
@@ -29,7 +29,7 @@ export default class AutoPublishChannelCommand extends BushCommand {
name: 'channel',
description: 'What channel would you like me to send welcome messages in?',
type: 'CHANNEL',
- required: false
+ required: true
}
],
channel: 'guild',
@@ -39,13 +39,13 @@ export default class AutoPublishChannelCommand extends BushCommand {
}
public override async exec(message: BushMessage, { channel }: { channel: Channel }): Promise<unknown> {
- const autoPublishChannels = await message.guild.getSetting('autoPublishChannels');
+ const autoPublishChannels = await message.guild!.getSetting('autoPublishChannels');
const newValue = util.addOrRemoveFromArray(
autoPublishChannels.includes(channel.id) ? 'remove' : 'add',
autoPublishChannels,
channel.id
);
- await message.guild.setSetting('autoPublishChannels', newValue);
+ await message.guild!.setSetting('autoPublishChannels', newValue);
return await message.util.reply({
content: `${util.emojis.success} Successfully ${
autoPublishChannels.includes(channel.id) ? 'disabled' : 'enabled'
diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts
index 864081c..57c3015 100644
--- a/src/commands/config/blacklist.ts
+++ b/src/commands/config/blacklist.ts
@@ -75,9 +75,12 @@ export default class BlacklistCommand extends BushCommand {
const targetID = target.id;
if (global) {
- if (action === 'toggle') {
- const blacklistedUsers = (await Global.findByPk(client.config.environment)).blacklistedUsers;
- const blacklistedChannels = (await Global.findByPk(client.config.environment)).blacklistedChannels;
+ if ((action as 'blacklist' | 'unblacklist' | 'toggle') === 'toggle') {
+ const globalDB =
+ (await Global.findByPk(client.config.environment)) ??
+ (await Global.create({ environment: client.config.environment }));
+ const blacklistedUsers = globalDB.blacklistedUsers;
+ const blacklistedChannels = globalDB.blacklistedChannels;
action = blacklistedUsers.includes(targetID) || blacklistedChannels.includes(targetID) ? 'unblacklist' : 'blacklist';
}
const success = await util
@@ -99,9 +102,11 @@ export default class BlacklistCommand extends BushCommand {
});
// guild disable
} else {
+ if (!message.guild)
+ return await message.util.reply(`${util.emojis.error} You have to be in a guild to disable commands.`);
const blacklistedChannels = (await message.guild.getSetting('blacklistedChannels')) ?? [];
const blacklistedUsers = (await message.guild.getSetting('blacklistedUsers')) ?? [];
- if (action === 'toggle') {
+ if ((action as 'blacklist' | 'unblacklist' | 'toggle') === 'toggle') {
action = blacklistedChannels.includes(targetID) ?? blacklistedUsers.includes(targetID) ? 'unblacklist' : 'blacklist';
}
const newValue = util.addOrRemoveFromArray(
diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts
index a9318a5..bc6ed47 100644
--- a/src/commands/config/disable.ts
+++ b/src/commands/config/disable.ts
@@ -69,8 +69,11 @@ export default class DisableCommand extends BushCommand {
const commandID = (args.command as BushCommand).id;
if (global) {
- if (action === 'toggle') {
- const disabledCommands = (await Global.findByPk(client.config.environment)).disabledCommands;
+ if ((action as 'disable' | 'enable' | 'toggle') === 'toggle') {
+ const disabledCommands = (
+ (await Global.findByPk(client.config.environment)) ??
+ (await Global.create({ environment: client.config.environment }))
+ ).disabledCommands;
action = disabledCommands.includes(commandID) ? 'disable' : 'enable';
}
const success = await util
@@ -95,12 +98,12 @@ export default class DisableCommand extends BushCommand {
// guild disable
} else {
- const disabledCommands = await message.guild.getSetting('disabledCommands');
- if (action === 'toggle') {
+ const disabledCommands = await message.guild!.getSetting('disabledCommands');
+ if ((action as 'disable' | 'enable' | 'toggle') === 'toggle') {
action = disabledCommands.includes(commandID) ? 'disable' : 'enable';
}
const newValue = util.addOrRemoveFromArray(action === 'disable' ? 'remove' : 'add', disabledCommands, commandID);
- const success = await message.guild.setSetting('disabledCommands', newValue).catch(() => false);
+ const success = await message.guild!.setSetting('disabledCommands', newValue).catch(() => false);
if (!success)
return await message.util.reply({
content: `${util.emojis.error} There was an error **${action.substr(
diff --git a/src/commands/config/muteRole.ts b/src/commands/config/muteRole.ts
index dee5322..c7a6e75 100644
--- a/src/commands/config/muteRole.ts
+++ b/src/commands/config/muteRole.ts
@@ -38,7 +38,7 @@ export default class MuteRoleCommand extends BushCommand {
}
override async exec(message: BushMessage | BushSlashMessage, args: { role: Role }): Promise<void> {
- await message.guild.setSetting('muteRole', args.role.id);
+ await message.guild!.setSetting('muteRole', args.role.id);
await message.util.send({
content: `${util.emojis.success} Changed the server's mute role to <@&${args.role.id}>.`,
allowedMentions: AllowedMentions.none()
diff --git a/src/commands/config/prefix.ts b/src/commands/config/prefix.ts
index 9f80633..9d707e0 100644
--- a/src/commands/config/prefix.ts
+++ b/src/commands/config/prefix.ts
@@ -37,8 +37,8 @@ export default class PrefixCommand extends BushCommand {
}
override async exec(message: BushMessage | BushSlashMessage, args: { prefix?: string }): Promise<unknown> {
- const oldPrefix = await message.guild.getSetting('prefix');
- await message.guild.setSetting('prefix', args.prefix ?? client.config.prefix);
+ const oldPrefix = await message.guild!.getSetting('prefix');
+ await message.guild!.setSetting('prefix', args.prefix ?? client.config.prefix);
if (args.prefix) {
return await message.util.send({
content: `${util.emojis.success} changed the server's prefix ${oldPrefix ? `from \`${oldPrefix}\`` : ''} to \`${
diff --git a/src/commands/config/punishmentFooter.ts b/src/commands/config/punishmentFooter.ts
index d8daf77..d07ce4f 100644
--- a/src/commands/config/punishmentFooter.ts
+++ b/src/commands/config/punishmentFooter.ts
@@ -39,7 +39,7 @@ export default class PunishmentFooterCommand extends BushCommand {
}
override async exec(message: BushMessage | BushSlashMessage, args: { ending: string }): Promise<unknown> {
- await message.guild.setSetting('punishmentEnding', args.ending || null);
+ await message.guild!.setSetting('punishmentEnding', args.ending || '');
if (args.ending)
return await message.util.send({
content: `${util.emojis.success} Changed the server's punishment footer to \n\`\`\`${Util.cleanCodeBlockContent(
diff --git a/src/commands/config/welcomeChannel.ts b/src/commands/config/welcomeChannel.ts
index a662802..fc56607 100644
--- a/src/commands/config/welcomeChannel.ts
+++ b/src/commands/config/welcomeChannel.ts
@@ -37,8 +37,8 @@ export default class WelcomeChannelCommand extends BushCommand {
});
}
public override async exec(message: BushMessage | BushSlashMessage, args: { channel: Channel }): Promise<unknown> {
- const oldChannel = await message.guild.getSetting('welcomeChannel');
- await message.guild.setSetting('welcomeChannel', args.channel.id ?? undefined);
+ const oldChannel = await message.guild!.getSetting('welcomeChannel');
+ await message.guild!.setSetting('welcomeChannel', args.channel.id ?? undefined);
if (args.channel) {
return await message.util.send(
`${util.emojis.success} changed the server's welcome channel ${oldChannel ? `from <#${oldChannel}>` : ''} to <#${
diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts
index 5b44db2..10360cf 100644
--- a/src/commands/dev/eval.ts
+++ b/src/commands/dev/eval.ts
@@ -70,7 +70,7 @@ export default class EvalCommand extends BushCommand {
}
args.code = args.code.replace(/[“”]/g, '"').replace(/```*(?:js|ts)?/g, '');
- const code = {
+ const code: { ts: string | null; js: string; lang: 'ts' | 'js' } = {
ts: args.typescript ? args.code : null,
js: args.typescript ? transpile(args.code) : args.code,
lang: args.typescript ? 'ts' : 'js'
@@ -79,7 +79,7 @@ export default class EvalCommand extends BushCommand {
const embed = new _MessageEmbed();
const badPhrases = ['delete', 'destroy'];
- if (badPhrases.some((p) => code[code.lang].includes(p)) && !args.sudo) {
+ if (badPhrases.some((p) => code[code.lang]!.includes(p)) && !args.sudo) {
return await message.util.send(`${util.emojis.error} This eval was blocked by smooth brain protection™.`);
}
@@ -119,7 +119,7 @@ export default class EvalCommand extends BushCommand {
const inputJS = await util.inspectCleanRedactCodeblock(code.js, 'js');
const inputTS = code.lang === 'ts' ? await util.inspectCleanRedactCodeblock(code.ts, 'ts') : undefined;
try {
- const rawOutput = code[code.lang].replace(/ /g, '').includes('9+10' || '10+9') ? '21' : await eval(code.js);
+ const rawOutput = code[code.lang]!.replace(/ /g, '').includes('9+10' || '10+9') ? '21' : await eval(code.js);
const output = await util.inspectCleanRedactCodeblock(rawOutput, 'js', {
depth: args.sel_depth ?? 0,
showHidden: args.hidden,
@@ -148,7 +148,7 @@ export default class EvalCommand extends BushCommand {
embed.addField('📤 Output', await util.inspectCleanRedactCodeblock(e?.stack || e, 'js'));
}
- embed.setTimestamp().setFooter(message.author.tag, message.author.displayAvatarURL({ dynamic: true }));
+ embed.setTimestamp().setFooter(message.author.tag, message.author.displayAvatarURL({ dynamic: true }) ?? undefined);
if (!args.silent || message.util.isSlash) {
await message.util.reply({ embeds: [embed] });
diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts
index 4f11a81..91cabfb 100644
--- a/src/commands/dev/reload.ts
+++ b/src/commands/dev/reload.ts
@@ -44,7 +44,7 @@ export default class ReloadCommand extends BushCommand {
client.inhibitorHandler.reloadAll();
return message.util.send(`🔁 Successfully reloaded! (${new Date().getTime() - s.getTime()}ms)`);
} catch (e) {
- if (output) void client.logger.error('reloadCommand', output);
+ if (output!) void client.logger.error('reloadCommand', output);
return message.util.send(`An error occurred while reloading:\n${await util.codeblock(e?.stack || e, 2048 - 34, 'js')}`);
}
}
diff --git a/src/commands/dev/say.ts b/src/commands/dev/say.ts
index f0a7cbf..1c797ea 100644
--- a/src/commands/dev/say.ts
+++ b/src/commands/dev/say.ts
@@ -42,6 +42,6 @@ export default class SayCommand extends BushCommand {
});
}
await message.interaction.reply({ content: 'Attempting to send message.', ephemeral: true });
- return message.channel.send({ content, allowedMentions: AllowedMentions.none() });
+ return message.channel!.send({ content, allowedMentions: AllowedMentions.none() });
}
}
diff --git a/src/commands/dev/setLevel.ts b/src/commands/dev/setLevel.ts
index 97527fa..e69b9df 100644
--- a/src/commands/dev/setLevel.ts
+++ b/src/commands/dev/setLevel.ts
@@ -44,7 +44,8 @@ export default class SetLevelCommand extends BushCommand {
}
],
ownerOnly: true,
- slash: true
+ slash: true,
+ channel: 'guild'
});
}
@@ -58,11 +59,11 @@ export default class SetLevelCommand extends BushCommand {
const [levelEntry] = await Level.findOrBuild({
where: {
user: user.id,
- guild: message.guild.id
+ guild: message.guild!.id
},
defaults: {
user: user.id,
- guild: message.guild.id
+ guild: message.guild!.id
}
});
await levelEntry.update({ xp: Level.convertLevelToXp(level) });
diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts
index 7f048c0..025a308 100644
--- a/src/commands/dev/sh.ts
+++ b/src/commands/dev/sh.ts
@@ -5,7 +5,7 @@ import { MessageEmbed, Util } from 'discord.js';
import { promisify } from 'util';
const sh = promisify(exec);
-const clean = (text) => {
+const clean = (text: string | any) => {
chalk.toString;
if (typeof text === 'string') {
return (text = Util.cleanCodeBlockContent(text));
@@ -43,7 +43,7 @@ export default class ShCommand extends BushCommand {
const embed = new MessageEmbed()
.setColor(util.colors.gray)
- .setFooter(message.author.tag, message.author.avatarURL({ dynamic: true }))
+ .setFooter(message.author.tag, message.author.avatarURL({ dynamic: true }) ?? undefined)
.setTimestamp()
.setTitle('Shell Command')
.addField('📥 Input', await util.codeblock(input, 1024, 'sh'))
diff --git a/src/commands/dev/superUser.ts b/src/commands/dev/superUser.ts
index 5178684..957e2b7 100644
--- a/src/commands/dev/superUser.ts
+++ b/src/commands/dev/superUser.ts
@@ -49,7 +49,7 @@ export default class SuperUserCommand extends BushCommand {
`${util.emojis.error} I fucked up here is args ${await util.inspectCleanRedactCodeblock(args, 'ts')}`
);
- const superUsers = (await Global.findByPk(client.config.environment)).superUsers;
+ const superUsers: string[] = (await Global.findByPk(client.config.environment))?.superUsers ?? [];
let success;
if (args.action === 'add') {
if (superUsers.includes(args.user.id)) {
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index 60e93c4..151e4a1 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -56,9 +56,9 @@ export default class TestCommand extends BushCommand {
const embed = new MessageEmbed()
.addField('Field Name', 'Field Content')
.setAuthor('Author', 'https://www.w3schools.com/w3css/img_snowtops.jpg', 'https://google.com/')
- .setColor(message.member.displayColor)
+ .setColor(message.member?.displayColor ?? util.colors.default)
.setDescription('Description')
- .setFooter('Footer', message.author.avatarURL())
+ .setFooter('Footer', message.author.avatarURL() ?? undefined)
.setURL('https://duckduckgo.com/')
.setTimestamp()
.setImage('https://media.sproutsocial.com/uploads/2017/02/10x-featured-social-media-image-size.png')
@@ -91,14 +91,15 @@ export default class TestCommand extends BushCommand {
return await util.buttonPaginate(message, embeds);
} else if (['lots of embeds'].includes(args?.feature?.toLowerCase())) {
const description = 'This is a description.';
- const author = { name: 'This is a author', iconURL: message.author.avatarURL({ dynamic: true }) };
- const footer = { text: 'This is a footer', iconURL: message.author.avatarURL({ dynamic: true }) };
+ const _avatar = message.author.avatarURL({ dynamic: true }) ?? undefined;
+ const author = { name: 'This is a author', iconURL: _avatar };
+ const footer = { text: 'This is a footer', iconURL: _avatar };
const fields = [];
for (let i = 0; i < 25; i++) {
fields.push({ name: 'Field ' + i, value: 'Field Value ' + i });
}
const c = util.colors;
- const o = { description, author, footer, fields };
+ const o = { description, author, footer, fields }!;
const embeds = [
new MessageEmbed({ ...o, ...{ title: 'Embed Title 0', color: c.red } }).setTimestamp(),
@@ -134,10 +135,11 @@ export default class TestCommand extends BushCommand {
// });
// })
// );
+ if (!message.guild) return await message.util.reply(`${util.emojis.error} This test can only be run in a guild.`);
const guildCommands = await message.guild.commands.fetch();
// eslint-disable-next-line @typescript-eslint/no-misused-promises
guildCommands.forEach(async (command) => await command.delete());
- const globalCommands = await client.application.commands.fetch();
+ const globalCommands = await client.application!.commands.fetch();
// eslint-disable-next-line @typescript-eslint/no-misused-promises
globalCommands.forEach(async (command) => await command.delete());
diff --git a/src/commands/fun/minesweeper.ts b/src/commands/fun/minesweeper.ts
index 2bec1e9..57909a2 100644
--- a/src/commands/fun/minesweeper.ts
+++ b/src/commands/fun/minesweeper.ts
@@ -118,6 +118,6 @@ export default class MinesweeperCommand extends BushCommand {
returnType: 'emoji'
});
const matrix = minesweeper.start();
- return await message.util.reply(matrix.toString());
+ return await message.util.reply(matrix?.toString() ?? `${util.emojis.error} Something went wrong.`);
}
}
diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts
index 37d2256..7100afa 100644
--- a/src/commands/info/avatar.ts
+++ b/src/commands/info/avatar.ts
@@ -42,7 +42,9 @@ export default class AvatarCommand extends BushCommand {
.setTimestamp()
.setColor(util.colors.default)
.setTitle(`${user.tag}'s Avatar`)
- .setImage(user.avatarURL({ size: 2048, format: 'png', dynamic: true }));
+ .setImage(
+ user.avatarURL({ size: 2048, format: 'png', dynamic: true }) ?? 'https://cdn.discordapp.com/embed/avatars/0.png'
+ );
await message.util.reply({ embeds: [embed] });
}
}
diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts
index c89c356..37a63ce 100644
--- a/src/commands/info/botInfo.ts
+++ b/src/commands/info/botInfo.ts
@@ -24,7 +24,7 @@ export default class BotInfoCommand extends BushCommand {
repoUrl = repoUrl.substring(0, repoUrl.length - 4);
const embed = new MessageEmbed()
.setTitle('Bot Info:')
- .addField('**Uptime**', util.humanizeDuration(client.uptime), true)
+ .addField('**Uptime**', util.humanizeDuration(client.uptime!), true)
.addField('**Servers**', client.guilds.cache.size.toLocaleString(), true)
.addField('**Users**', client.users.cache.size.toLocaleString(), true)
.addField('**Discord.js Version**', discordJSVersion, true)
diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts
index 93dd439..350c23d 100644
--- a/src/commands/info/color.ts
+++ b/src/commands/info/color.ts
@@ -1,11 +1,11 @@
import { AllowedMentions, BushCommand, BushGuildMember, BushMessage, BushRole, BushSlashMessage } from '@lib';
import { Argument } from 'discord-akairo';
-import { MessageEmbed, Role } from 'discord.js';
+import { Message, MessageEmbed, Role } from 'discord.js';
import { Constructor } from 'tinycolor2';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const tinycolor: Constructor = require('tinycolor2'); // this is the only way I got it to work consistently
-const isValidTinyColor = (_message: BushMessage, phase: string) => {
+const isValidTinyColor = (_message: Message, phase: string) => {
// if the phase is a number it converts it to hex incase it could be representing a color in decimal
const newPhase = Number.isNaN(phase) ? phase : `#${Number(phase).toString(16)}`;
return tinycolor(newPhase).isValid() ? newPhase : null;
diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts
index 2cdf3d5..431b8bd 100644
--- a/src/commands/info/guildInfo.ts
+++ b/src/commands/info/guildInfo.ts
@@ -58,12 +58,16 @@ export default class GuildInfoCommand extends BushCommand {
const guild: Guild | GuildPreview = (args?.guild as Guild | GuildPreview) || (message.guild as Guild);
const emojis: string[] = [];
const guildAbout: string[] = [];
- const guildSecurity = [];
+ const guildStats: string[] = [];
+ const guildSecurity: string[] = [];
const verifiedGuilds = Object.values(client.consts.mappings.guilds);
if (verifiedGuilds.includes(guild.id)) emojis.push(client.consts.mappings.otherEmojis.BUSH_VERIFIED);
if (!isPreview && guild instanceof Guild) {
- if (guild.premiumTier) emojis.push(client.consts.mappings.otherEmojis['BOOST_' + guild.premiumTier]);
+ if (guild.premiumTier)
+ emojis.push(
+ client.consts.mappings.otherEmojis[('BOOST_' + guild.premiumTier) as keyof typeof client.consts.mappings.otherEmojis]
+ );
await guild.fetch();
const channelTypes = [
`${client.consts.mappings.otherEmojis.TEXT} ${guild.channels.cache
@@ -91,7 +95,7 @@ export default class GuildInfoCommand extends BushCommand {
.size.toLocaleString()}`
];
- const guildRegions = [];
+ const guildRegions: string[] = [];
guild.channels.cache.forEach((channel) => {
if (!channel.type.includes('VOICE')) return;
else if (!guildRegions.includes((channel as BaseGuildVoiceChannel).rtcRegion ?? 'automatic')) {
@@ -102,16 +106,16 @@ export default class GuildInfoCommand extends BushCommand {
guildAbout.push(
`**Owner:** ${guild.members.cache.get(guild.ownerId)?.user.tag}`,
`**Created** ${guild.createdAt.toLocaleString()} (${util.dateDelta(guild.createdAt)})`,
- `**Members:** ${guild.memberCount.toLocaleString() ?? 0}`,
- `**Online:** ${guild.approximatePresenceCount?.toLocaleString() ?? 0}`,
- `**Channels:** ${guild.channels.cache.size?.toLocaleString() ?? 0} (${channelTypes.join(', ')})`,
- `**Emojis:** ${guild.emojis.cache.size?.toLocaleString() ?? 0}`,
- `**Stickers:** ${guild.stickers.cache.size?.toLocaleString() ?? 0}`,
- `**Regions:** ${guildRegions.map((region) => client.consts.mappings.regions[region] || region).join(', ')}`
+ `**Members:** ${guild.memberCount.toLocaleString() ?? 0} (${util.emojis.onlineCircle} ${
+ guild.approximatePresenceCount?.toLocaleString() ?? 0
+ }, ${util.emojis.offlineCircle} ${(guild.memberCount - (guild.approximatePresenceCount ?? 0)).toLocaleString() ?? 0})`,
+ `**Regions:** ${guildRegions
+ .map((region) => client.consts.mappings.regions[region as keyof typeof client.consts.mappings.regions] || region)
+ .join(', ')}`
);
if (guild.premiumSubscriptionCount)
guildAbout.push(
- `**Boosts:** Level ${guild.premiumTier == 'NONE' ? '0' : guild.premiumTier[5]} with ${
+ `**Boosts:** Level ${guild.premiumTier == 'NONE' ? 0 : guild.premiumTier[5]} with ${
guild.premiumSubscriptionCount ?? 0
} boosts`
);
@@ -123,6 +127,28 @@ export default class GuildInfoCommand extends BushCommand {
);
}
+ if (guild.icon) guildAbout.push(`**Icon:** [link](${guild.iconURL({ dynamic: true, size: 4096, format: 'png' })})`);
+ if (guild.banner) guildAbout.push(`**Banner:** [link](${guild.bannerURL({ siz