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 | |
| parent | 44521f4560dc8b0bab055685437d8fa65a34377f (diff) | |
| download | tanzanite-36ff682e742021918d134ff91a2bee3041b5a2b9.tar.gz tanzanite-36ff682e742021918d134ff91a2bee3041b5a2b9.tar.bz2 tanzanite-36ff682e742021918d134ff91a2bee3041b5a2b9.zip | |
a ton of bug fixes
Diffstat (limited to 'src')
75 files changed, 173 insertions, 192 deletions
diff --git a/src/arguments/durationSeconds.ts b/src/arguments/durationSeconds.ts index 6b0e91d..98a5262 100644 --- a/src/arguments/durationSeconds.ts +++ b/src/arguments/durationSeconds.ts @@ -1,4 +1,4 @@ -import { BushArgumentTypeCaster } from '../lib'; +import { BushArgumentTypeCaster } from '@lib'; export const durationSecondsTypeCaster: BushArgumentTypeCaster = (_, phrase): number | null => { phrase += 's'; diff --git a/src/arguments/permission.ts b/src/arguments/permission.ts index 3275c49..bb042d5 100644 --- a/src/arguments/permission.ts +++ b/src/arguments/permission.ts @@ -1,5 +1,5 @@ +import { BushArgumentTypeCaster } from '@lib'; import { Permissions } from 'discord.js'; -import { BushArgumentTypeCaster } from '../lib/extensions/discord-akairo/BushArgumentTypeCaster'; export const permissionTypeCaster: BushArgumentTypeCaster = (_, phrase) => { if (!phrase) return null; diff --git a/src/arguments/snowflake.ts b/src/arguments/snowflake.ts index 0e6136f..add3224 100644 --- a/src/arguments/snowflake.ts +++ b/src/arguments/snowflake.ts @@ -1,5 +1,5 @@ +import { BushArgumentTypeCaster } from '@lib'; import { Snowflake } from 'discord.js'; -import { BushArgumentTypeCaster } from '../lib'; export const snowflakeTypeCaster: BushArgumentTypeCaster = (_, phrase): Snowflake | null => { if (!phrase) return null; 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' &&am |
