aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arguments/durationSeconds.ts2
-rw-r--r--src/arguments/permission.ts2
-rw-r--r--src/arguments/snowflake.ts2
-rw-r--r--src/commands/admin/channelPermissions.ts3
-rw-r--r--src/commands/admin/roleAll.ts2
-rw-r--r--src/commands/config/blacklist.ts22
-rw-r--r--src/commands/config/config.ts2
-rw-r--r--src/commands/dev/say.ts6
-rw-r--r--src/commands/dev/servers.ts3
-rw-r--r--src/commands/dev/test.ts3
-rw-r--r--src/commands/fun/eightBall.ts2
-rw-r--r--src/commands/info/avatar.ts2
-rw-r--r--src/commands/info/guildInfo.ts2
-rw-r--r--src/commands/info/icon.ts2
-rw-r--r--src/commands/info/snowflake.ts2
-rw-r--r--src/commands/leveling/leaderboard.ts3
-rw-r--r--src/commands/moderation/ban.ts38
-rw-r--r--src/commands/moderation/kick.ts3
-rw-r--r--src/commands/moderation/modlog.ts3
-rw-r--r--src/commands/moderation/mute.ts3
-rw-r--r--src/commands/moderation/purge.ts2
-rw-r--r--src/commands/moderation/unmute.ts3
-rw-r--r--src/commands/moderation/warn.ts3
-rw-r--r--src/commands/moulberry-bush/capes.ts4
-rw-r--r--src/commands/moulberry-bush/moulHammer.ts2
-rw-r--r--src/commands/moulberry-bush/report.ts2
-rw-r--r--src/commands/moulberry-bush/rule.ts2
-rw-r--r--src/commands/moulberry-bush/serverStatus.ts2
-rw-r--r--src/commands/utilities/activity.ts2
-rw-r--r--src/commands/utilities/hash.ts2
-rw-r--r--src/commands/utilities/price.ts2
-rw-r--r--src/commands/utilities/uuid.ts2
-rw-r--r--src/commands/utilities/viewRaw.ts2
-rw-r--r--src/commands/utilities/whoHasRole.ts3
-rw-r--r--src/config/example-options.ts2
-rw-r--r--src/context-menu-commands/message/viewRaw.ts2
-rw-r--r--src/lib/common/ButtonPaginator.ts16
-rw-r--r--src/lib/extensions/discord-akairo/BushCommandUtil.ts7
-rw-r--r--src/lib/extensions/discord-akairo/BushSlashMessage.ts2
-rw-r--r--src/lib/extensions/discord.js/BushClientEvents.d.ts4
-rw-r--r--src/lib/extensions/discord.js/BushMessage.ts2
-rw-r--r--src/lib/index.ts24
-rw-r--r--src/lib/utils/BushConstants.ts70
-rw-r--r--src/listeners/client/interactionCreate.ts4
-rw-r--r--src/listeners/commands/commandCooldown.ts2
-rw-r--r--src/listeners/commands/commandError.ts2
-rw-r--r--src/listeners/commands/slashNotFound.ts2
-rw-r--r--src/listeners/custom/bushBan.ts3
-rw-r--r--src/listeners/custom/bushKick.ts3
-rw-r--r--src/listeners/custom/bushLevelUpdate.ts3
-rw-r--r--src/listeners/custom/bushMute.ts3
-rw-r--r--src/listeners/custom/bushPunishRole.ts3
-rw-r--r--src/listeners/custom/bushPunishRoleRemove.ts3
-rw-r--r--src/listeners/custom/bushPurge.ts3
-rw-r--r--src/listeners/custom/bushUnban.ts3
-rw-r--r--src/listeners/custom/bushUnmute.ts3
-rw-r--r--src/listeners/custom/bushUpdateModlog.ts3
-rw-r--r--src/listeners/custom/bushUpdateSettings.ts3
-rw-r--r--src/listeners/custom/bushWarn.ts3
-rw-r--r--src/listeners/guild/guildCreate.ts3
-rw-r--r--src/listeners/guild/guildDelete.ts3
-rw-r--r--src/listeners/guild/guildMemberAdd.ts3
-rw-r--r--src/listeners/guild/guildMemberRemove.ts3
-rw-r--r--src/listeners/guild/syncUnban.ts3
-rw-r--r--src/listeners/message/autoPublisher.ts3
-rw-r--r--src/listeners/message/autoThread.ts3
-rw-r--r--src/listeners/message/automodCreate.ts4
-rw-r--r--src/listeners/message/automodUpdate.ts4
-rw-r--r--src/listeners/message/blacklistedFile.ts3
-rw-r--r--src/listeners/message/boosterMessage.ts3
-rw-r--r--src/listeners/message/directMessage.ts3
-rw-r--r--src/listeners/message/verbose.ts3
-rw-r--r--src/tasks/removeExpiredPunishements.ts3
-rw-r--r--src/tasks/updateCache.ts4
-rw-r--r--src/tasks/updateStats.ts2
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' && !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 MuteCom