diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-23 18:09:55 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-23 18:09:55 -0400 |
commit | 36ff682e742021918d134ff91a2bee3041b5a2b9 (patch) | |
tree | 979fb8a10eb7f210989ed3272754ab3f001641f5 /src/commands | |
parent | 44521f4560dc8b0bab055685437d8fa65a34377f (diff) | |
download | tanzanite-36ff682e742021918d134ff91a2bee3041b5a2b9.tar.gz tanzanite-36ff682e742021918d134ff91a2bee3041b5a2b9.tar.bz2 tanzanite-36ff682e742021918d134ff91a2bee3041b5a2b9.zip |
a ton of bug fixes
Diffstat (limited to 'src/commands')
31 files changed, 58 insertions, 76 deletions
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts index f8c97a9..bae1133 100644 --- a/src/commands/admin/channelPermissions.ts +++ b/src/commands/admin/channelPermissions.ts @@ -1,6 +1,5 @@ +import { BushCommand, BushMessage, ButtonPaginator } from '@lib'; import { GuildMember, MessageEmbed, Role } from 'discord.js'; -import { BushCommand, BushMessage } from '../../lib'; -import { ButtonPaginator } from '../../lib/common/ButtonPaginator'; export default class ChannelPermissionsCommand extends BushCommand { public constructor() { diff --git a/src/commands/admin/roleAll.ts b/src/commands/admin/roleAll.ts index ec1f2b5..73369fc 100644 --- a/src/commands/admin/roleAll.ts +++ b/src/commands/admin/roleAll.ts @@ -1,5 +1,5 @@ +import { AllowedMentions, BushCommand, BushMessage } from '@lib'; import { GuildMember, Role } from 'discord.js'; -import { AllowedMentions, BushCommand, BushMessage } from '../../lib'; export default class RoleAllCommand extends BushCommand { public constructor() { diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts index 8a575c3..ef0c94e 100644 --- a/src/commands/config/blacklist.ts +++ b/src/commands/config/blacklist.ts @@ -35,14 +35,8 @@ export default class BlacklistCommand extends BushCommand { description: 'Would you like to add or remove someone or something from/to the blacklist?', type: 'STRING', choices: [ - { - name: 'blacklist', - value: 'blacklist' - }, - { - name: 'unblacklist', - value: 'unblacklist' - } + { name: 'blacklist', value: 'blacklist' }, + { name: 'unblacklist', value: 'unblacklist' } ], required: true }, @@ -91,12 +85,16 @@ export default class BlacklistCommand extends BushCommand { .catch(() => false); if (!success) return await message.util.reply({ - content: `${util.emojis.error} There was an error globally **${action}ing** ${target?.tag ?? target.name}.`, + content: `${util.emojis.error} There was an error globally ${action}ing ${util.format.bold( + target?.tag ?? target.name + )}.`, allowedMentions: AllowedMentions.none() }); else return await message.util.reply({ - content: `${util.emojis.success} Successfully **${action}ed** ${target?.tag ?? target.name} globally.`, + content: `${util.emojis.success} Successfully **${action}ed** ${util.format.bold( + target?.tag ?? target.name + )} globally.`, allowedMentions: AllowedMentions.none() }); // guild disable @@ -118,12 +116,12 @@ export default class BlacklistCommand extends BushCommand { .catch(() => false); if (!success) return await message.util.reply({ - content: `${util.emojis.error} There was an error **${action}ing** ${target?.tag ?? target.name}.`, + content: `${util.emojis.error} There was an error ${action}ing ${util.format.bold(target?.tag ?? target.name)}.`, allowedMentions: AllowedMentions.none() }); else return await message.util.reply({ - content: `${util.emojis.success} Successfully **${action}ed** ${target?.tag ?? target.name}.`, + content: `${util.emojis.success} Successfully ${action}ed ${util.format.bold(target?.tag ?? target.name)}.`, allowedMentions: AllowedMentions.none() }); } diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index 83bcebe..0fdd615 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -218,7 +218,7 @@ export default class SettingsCommand extends BushCommand { case 'add': case 'remove': { const existing = (await message.guild.getSetting(setting)) as string[]; - const updated = util.addOrRemoveFromArray('add', existing, parseVal(value)); + const updated = util.addOrRemoveFromArray(action, existing, parseVal(value)); await message.guild.setSetting(setting, updated, message.member); const messageOptions = await this.generateMessageOptions(message, setting); msg = (await message.util.reply(messageOptions)) as Message; diff --git a/src/commands/dev/say.ts b/src/commands/dev/say.ts index a7e9943..f1695f8 100644 --- a/src/commands/dev/say.ts +++ b/src/commands/dev/say.ts @@ -31,8 +31,8 @@ export default class SayCommand extends BushCommand { if (!message.author.isOwner()) return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`); - await message.delete().catch(() => {}); - await message.util.send({ content: args.content, allowedMentions: AllowedMentions.none() }); + await message.delete().catch(() => null); + await message.util.send({ content: args.content, allowedMentions: AllowedMentions.none() }).catch(() => null); } public override async execSlash(message: AkairoMessage, args: { content: string }): Promise<unknown> { @@ -43,6 +43,6 @@ export default class SayCommand extends BushCommand { }); } await message.interaction.reply({ content: 'Attempting to send message.', ephemeral: true }); - return message.channel!.send({ content: args.content, allowedMentions: AllowedMentions.none() }); + return message.channel!.send({ content: args.content, allowedMentions: AllowedMentions.none() }).catch(() => null); } } diff --git a/src/commands/dev/servers.ts b/src/commands/dev/servers.ts index e366a64..5097695 100644 --- a/src/commands/dev/servers.ts +++ b/src/commands/dev/servers.ts @@ -1,6 +1,5 @@ +import { BushCommand, BushMessage, BushSlashMessage, ButtonPaginator } from '@lib'; import { Guild, MessageEmbedOptions } from 'discord.js'; -import { BushCommand, BushMessage, BushSlashMessage } from '../../lib'; -import { ButtonPaginator } from '../../lib/common/ButtonPaginator'; export default class ServersCommand extends BushCommand { public constructor() { diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index 38ea920..2ab266d 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -1,4 +1,4 @@ -import { BushCommand, BushMessage } from '@lib'; +import { BushCommand, BushMessage, ButtonPaginator } from '@lib'; import { ApplicationCommand, Collection, @@ -7,7 +7,6 @@ import { MessageButton, MessageEmbed } from 'discord.js'; -import { ButtonPaginator } from '../../lib/common/ButtonPaginator'; export default class TestCommand extends BushCommand { public constructor() { diff --git a/src/commands/fun/eightBall.ts b/src/commands/fun/eightBall.ts index b3c56da..4e79beb 100644 --- a/src/commands/fun/eightBall.ts +++ b/src/commands/fun/eightBall.ts @@ -1,4 +1,4 @@ -import { BushCommand, BushMessage, BushSlashMessage } from '../../lib'; +import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; export default class EightBallCommand extends BushCommand { public constructor() { diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts index 7625b61..40debf0 100644 --- a/src/commands/info/avatar.ts +++ b/src/commands/info/avatar.ts @@ -1,5 +1,5 @@ +import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; import { GuildMember, MessageEmbed, User } from 'discord.js'; -import { BushCommand, BushMessage, BushSlashMessage } from '../../lib'; export default class AvatarCommand extends BushCommand { constructor() { diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts index 44c388d..2945050 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -1,5 +1,5 @@ +import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; import { BaseGuildVoiceChannel, Guild, GuildPreview, MessageEmbed, Snowflake, Vanity } from 'discord.js'; -import { BushCommand, BushMessage, BushSlashMessage } from '../../lib'; export default class GuildInfoCommand extends BushCommand { public constructor() { diff --git a/src/commands/info/icon.ts b/src/commands/info/icon.ts index ce27cc0..08538d7 100644 --- a/src/commands/info/icon.ts +++ b/src/commands/info/icon.ts @@ -1,5 +1,5 @@ +import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; import { MessageEmbed } from 'discord.js'; -import { BushCommand, BushMessage, BushSlashMessage } from '../../lib'; export default class IconCommand extends BushCommand { constructor() { diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts index 083acbf..b203d94 100644 --- a/src/commands/info/snowflake.ts +++ b/src/commands/info/snowflake.ts @@ -1,3 +1,4 @@ +import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; import { CategoryChannel, Channel, @@ -15,7 +16,6 @@ import { User, VoiceChannel } from 'discord.js'; -import { BushCommand, BushMessage, BushSlashMessage } from '../../lib'; export default class SnowflakeCommand extends BushCommand { public constructor() { diff --git a/src/commands/leveling/leaderboard.ts b/src/commands/leveling/leaderboard.ts index dde2270..3f7fac8 100644 --- a/src/commands/leveling/leaderboard.ts +++ b/src/commands/leveling/leaderboard.ts @@ -1,6 +1,5 @@ -import { BushCommand, BushMessage, BushSlashMessage, Level } from '@lib'; +import { BushCommand, BushMessage, BushSlashMessage, ButtonPaginator, Level } from '@lib'; import { MessageEmbed } from 'discord.js'; -import { ButtonPaginator } from '../../lib/common/ButtonPaginator'; export default class LeaderboardCommand extends BushCommand { public constructor() { diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index 74b1b54..a267b78 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -1,6 +1,5 @@ -import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage } from '@lib'; +import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage, Moderation } from '@lib'; import { Snowflake, User } from 'discord.js'; -import { Moderation } from '../../lib/common/Moderation'; export default class BanCommand extends BushCommand { public constructor() { @@ -35,8 +34,7 @@ export default class BanCommand extends BushCommand { id: 'days', flag: '--days', match: 'option', - customType: util.arg.range('integer', 0, 7, true), - default: 0 + customType: util.arg.range('integer', 0, 7, true) }, { id: 'force', @@ -83,25 +81,21 @@ export default class BanCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, - { - user: _user, - reason, - days, - force - }: { + args: { user: User | Snowflake; reason?: { duration: number | null; contentWithoutTime: string }; days?: number; force: boolean; } ): Promise<unknown> { - if (reason?.duration === null) reason.duration = 0; + if (typeof args.reason === 'object') args.reason.duration ??= 0; + args.days ??= 0; if (!message.guild) return message.util.reply(`${util.emojis.error} This command cannot be used in dms.`); - const member = message.guild!.members.cache.get((_user as User)?.id); - const user = member?.user ?? (await util.resolveNonCachedUser(_user)); + const member = message.guild!.members.cache.get((args.user as User)?.id ?? args.user); + const user = member?.user ?? (await util.resolveNonCachedUser((args.user as User)?.id ?? args.user)); if (!user) return message.util.reply(`${util.emojis.error} Invalid user.`); - const useForce = force && message.author.isOwner(); + const useForce = args.force && message.author.isOwner(); if (!message.member) throw new Error(`message.member is null`); const canModerateResponse = member ? await Moderation.permissionCheck(message.member, member, 'ban', true, useForce) : true; @@ -110,31 +104,33 @@ export default class BanCommand extends BushCommand { return await message.util.reply(canModerateResponse); } - if (message.util.parsed?.alias === 'dban' && !days) days = 1; + if (message.util.parsed?.alias === 'dban' && !args.days) args.days = 1; + + if (!Number.isInteger(args.days) || args.days! < 0 || args.days! > 7) { + client.console.debug(args.days); - if (!Number.isInteger(days) || days! < 0 || days! > 7) { return message.util.reply(`${util.emojis.error} The delete days must be an integer between 0 and 7.`); } let time: number; - if (reason) { - time = typeof reason === 'string' ? await util.arg.cast('duration', message, reason) : reason.duration; + if (args.reason) { + time = typeof args.reason === 'string' ? await util.arg.cast('duration', message, args.reason) : args.reason.duration; } - const parsedReason = reason?.contentWithoutTime ?? null; + const parsedReason = args.reason?.contentWithoutTime ?? null; const responseCode = member ? await member.bushBan({ reason: parsedReason, moderator: message.member, duration: time! ?? 0, - deleteDays: days ?? 0 + deleteDays: args.days }) : await message.guild.bushBan({ user, reason: parsedReason, moderator: message.member, duration: time! ?? 0, - deleteDays: days ?? 0 + deleteDays: args.days }); const responseMessage = () => { diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts index 3238217..d4edb07 100644 --- a/src/commands/moderation/kick.ts +++ b/src/commands/moderation/kick.ts @@ -1,5 +1,4 @@ -import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage, BushUser } from '@lib'; -import { Moderation } from '../../lib/common/Moderation'; +import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage, BushUser, Moderation } from '@lib'; export default class KickCommand extends BushCommand { public constructor() { diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts index 4abaa6f..6840f4e 100644 --- a/src/commands/moderation/modlog.ts +++ b/src/commands/moderation/modlog.ts @@ -1,6 +1,5 @@ -import { BushCommand, BushMessage, BushSlashMessage, BushUser, ModLog } from '@lib'; +import { BushCommand, BushMessage, BushSlashMessage, BushUser, ButtonPaginator, ModLog } from '@lib'; import { MessageEmbed, User } from 'discord.js'; -import { ButtonPaginator } from '../../lib/common/ButtonPaginator'; export default class ModlogCommand extends BushCommand { public constructor() { diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts index 00631ba..897e95a 100644 --- a/src/commands/moderation/mute.ts +++ b/src/commands/moderation/mute.ts @@ -1,5 +1,4 @@ -import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage, BushUser } from '@lib'; -import { Moderation } from '../../lib/common/Moderation'; +import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage, BushUser, Moderation } from '@lib'; export default class MuteCommand extends BushCommand { public constructor() { diff --git a/src/commands/moderation/purge.ts b/src/commands/moderation/purge.ts index a77e46a..65555a1 100644 --- a/src/commands/moderation/purge.ts +++ b/src/commands/moderation/purge.ts @@ -1,5 +1,5 @@ +import { BushCommand, BushMessage } from '@lib'; import { Collection, Snowflake } from 'discord.js'; -import { BushCommand, BushMessage } from '../../lib'; export default class PurgeCommand extends BushCommand { public constructor() { diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts index f9335c4..3b4f5bd 100644 --- a/src/commands/moderation/unmute.ts +++ b/src/commands/moderation/unmute.ts @@ -1,5 +1,4 @@ -import { AllowedMentions, BushCommand, BushGuildMember, BushMessage, BushSlashMessage, BushUser } from '@lib'; -import { Moderation } from '../../lib/common/Moderation'; +import { AllowedMentions, BushCommand, BushGuildMember, BushMessage, BushSlashMessage, BushUser, Moderation } from '@lib'; export default class UnmuteCommand extends BushCommand { public constructor() { diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts index c67466b..c510929 100644 --- a/src/commands/moderation/warn.ts +++ b/src/commands/moderation/warn.ts @@ -1,5 +1,4 @@ -import { AllowedMentions, BushCommand, BushGuildMember, BushMessage, BushSlashMessage, BushUser } from '@lib'; -import { Moderation } from '../../lib/common/Moderation'; +import { AllowedMentions, BushCommand, BushGuildMember, BushMessage, BushSlashMessage, BushUser, Moderation } from '@lib'; export default class WarnCommand extends BushCommand { public constructor() { diff --git a/src/commands/moulberry-bush/capes.ts b/src/commands/moulberry-bush/capes.ts index 1a09eb0..96b4685 100644 --- a/src/commands/moulberry-bush/capes.ts +++ b/src/commands/moulberry-bush/capes.ts @@ -1,8 +1,6 @@ +import { BushCommand, BushMessage, ButtonPaginator, DeleteButton } from '@lib'; import { MessageEmbedOptions } from 'discord.js'; import got from 'got'; -import { BushCommand, BushMessage } from '../../lib'; -import { ButtonPaginator } from '../../lib/common/ButtonPaginator'; -import { DeleteButton } from '../../lib/common/DeleteButton'; export interface GithubFile { path: string; diff --git a/src/commands/moulberry-bush/moulHammer.ts b/src/commands/moulberry-bush/moulHammer.ts index 129eb84..26841cb 100644 --- a/src/commands/moulberry-bush/moulHammer.ts +++ b/src/commands/moulberry-bush/moulHammer.ts @@ -1,5 +1,5 @@ +import { BushCommand, BushMessage } from '@lib'; import { MessageEmbed, User } from 'discord.js'; -import { BushCommand, BushMessage } from '../../lib'; export default class MoulHammerCommand extends BushCommand { public constructor() { diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index 13976bb..24aa4aa 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -1,6 +1,6 @@ +import { AllowedMentions, BushCommand, BushMessage } from '@lib'; import { GuildMember, MessageEmbed } from 'discord.js'; import moment from 'moment'; -import { AllowedMentions, BushCommand, BushMessage } from '../../lib'; export default class ReportCommand extends BushCommand { public constructor() { diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index 59c9e43..909ea92 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -1,5 +1,5 @@ +import { AllowedMentions, BushCommand, BushMessage } from '@lib'; import { MessageEmbed, User } from 'discord.js'; -import { AllowedMentions, BushCommand, BushMessage } from '../../lib'; const rules = [ { diff --git a/src/commands/moulberry-bush/serverStatus.ts b/src/commands/moulberry-bush/serverStatus.ts index 568dd38..6c3664e 100644 --- a/src/commands/moulberry-bush/serverStatus.ts +++ b/src/commands/moulberry-bush/serverStatus.ts @@ -1,6 +1,6 @@ +import { BushCommand, BushMessage } from '@lib'; import { MessageEmbed } from 'discord.js'; import got from 'got'; -import { BushCommand, BushMessage } from '../../lib'; export default class ServerStatusCommand extends BushCommand { public constructor() { diff --git a/src/commands/utilities/activity.ts b/src/commands/utilities/activity.ts index e2a3352..4066934 100644 --- a/src/commands/utilities/activity.ts +++ b/src/commands/utilities/activity.ts @@ -1,5 +1,5 @@ +import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; import { DiscordAPIError, Message, VoiceChannel } from 'discord.js'; -import { BushCommand, BushMessage, BushSlashMessage } from '../../lib'; const activityMap = { 'Poker Night': '755827207812677713', diff --git a/src/commands/utilities/hash.ts b/src/commands/utilities/hash.ts index df604c8..a8fdee1 100644 --- a/src/commands/utilities/hash.ts +++ b/src/commands/utilities/hash.ts @@ -1,6 +1,6 @@ +import { BushCommand, BushMessage } from '@lib'; import crypto from 'crypto'; import got from 'got'; -import { BushCommand, BushMessage } from '../../lib'; export default class HashCommand extends BushCommand { public constructor() { diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts index be3da8e..4d21c02 100644 --- a/src/commands/utilities/price.ts +++ b/src/commands/utilities/price.ts @@ -1,7 +1,7 @@ +import { BushCommand, BushMessage } from '@lib'; import { CommandInteraction, MessageEmbed } from 'discord.js'; import Fuse from 'fuse.js'; import got from 'got'; -import { BushCommand, BushMessage } from '../../lib'; interface Summary { amount: number; diff --git a/src/commands/utilities/uuid.ts b/src/commands/utilities/uuid.ts index 9484729..823d1ff 100644 --- a/src/commands/utilities/uuid.ts +++ b/src/commands/utilities/uuid.ts @@ -1,4 +1,4 @@ -import { BushCommand, BushMessage } from '../../lib'; +import { BushCommand, BushMessage } from '@lib'; export default class UuidCommand extends BushCommand { public constructor() { diff --git a/src/commands/utilities/viewRaw.ts b/src/commands/utilities/viewRaw.ts index b7017c6..60529c5 100644 --- a/src/commands/utilities/viewRaw.ts +++ b/src/commands/utilities/viewRaw.ts @@ -1,5 +1,5 @@ +import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; import { DMChannel, MessageEmbed, NewsChannel, Snowflake, TextChannel } from 'discord.js'; -import { BushCommand, BushMessage, BushSlashMessage } from '../../lib'; export default class ViewRawCommand extends BushCommand { public constructor() { diff --git a/src/commands/utilities/whoHasRole.ts b/src/commands/utilities/whoHasRole.ts index bce88d6..be27c7c 100644 --- a/src/commands/utilities/whoHasRole.ts +++ b/src/commands/utilities/whoHasRole.ts @@ -1,6 +1,5 @@ -import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; +import { BushCommand, BushMessage, BushSlashMessage, ButtonPaginator } from '@lib'; import { CommandInteraction, Role, Util } from 'discord.js'; -import { ButtonPaginator } from '../../lib/common/ButtonPaginator'; export default class WhoHasRoleCommand extends BushCommand { public constructor() { |