aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands/config/settings.ts191
-rw-r--r--src/commands/info/avatar.ts4
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts12
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts4
-rw-r--r--src/listeners/client/interactionCreate.ts2
-rw-r--r--src/listeners/client/ready.ts2
-rw-r--r--src/listeners/commands/commandBlocked.ts2
-rw-r--r--src/listeners/commands/commandError.ts2
-rw-r--r--src/listeners/commands/commandMissingPermissions.ts2
-rw-r--r--src/listeners/commands/commandStarted.ts2
-rw-r--r--src/listeners/commands/messageBlocked.ts2
-rw-r--r--src/listeners/commands/slashStarted.ts2
-rw-r--r--src/listeners/guild/guildCreate.ts5
-rw-r--r--src/listeners/guild/guildDelete.ts2
-rw-r--r--src/listeners/guild/guildMemberAdd.ts28
-rw-r--r--src/listeners/guild/guildMemberRemove.ts8
-rw-r--r--src/listeners/message/autoPublisher.ts13
-rw-r--r--src/listeners/message/automodCreate.ts2
-rw-r--r--src/listeners/message/blacklistedFile.ts4
-rw-r--r--src/listeners/message/boosterMessage.ts2
-rw-r--r--src/listeners/message/level.ts7
-rw-r--r--src/listeners/message/verbose.ts14
-rw-r--r--src/listeners/other/promiseRejection.ts2
23 files changed, 161 insertions, 153 deletions
diff --git a/src/commands/config/settings.ts b/src/commands/config/settings.ts
index 032b4e5..c28b4dd 100644
--- a/src/commands/config/settings.ts
+++ b/src/commands/config/settings.ts
@@ -20,88 +20,63 @@ export default class SettingsCommand extends BushCommand {
examples: ['settings']
},
slash: true,
- slashOptions: [
- {
- name: 'view',
- description: 'See a all settings or a particular setting',
- type: 'SUB_COMMAND',
- options: [
- {
- name: 'setting',
- description: 'What setting would you like to see?',
- type: 'STRING',
- required: false,
- choices: settingsArr.map((s) => ({ name: guildSettingsObj[s].name, value: s }))
- }
- ]
- },
- {
- name: 'set',
- description: 'Set a particular setting.',
- type: 'SUB_COMMAND',
- options: [
- {
- name: 'setting',
- description: 'What setting would you like to set?',
- type: 'STRING',
- required: true,
- choices: settingsArr
- .filter((s) => !guildSettingsObj[s].type.includes('array'))
- .map((s) => ({ name: guildSettingsObj[s].name, value: s }))
- },
- {
- name: 'value',
- description: 'What would you like the new value to be?',
- type: 'STRING',
- required: true
- }
- ]
- },
- {
- name: 'add',
- description: 'Add a value to a particular setting.',
- type: 'SUB_COMMAND',
- options: [
- {
- name: 'setting',
- description: 'What setting would you like to add to?',
- type: 'STRING',
- required: true,
- choices: settingsArr
- .filter((s) => guildSettingsObj[s].type.includes('array'))
- .map((s) => ({ name: guildSettingsObj[s].name, value: s }))
- },
- {
- name: 'value',
- description: 'What would you like the new value to be?',
- type: 'STRING',
- required: true
- }
- ]
- },
- {
- name: 'remove',
- description: 'Remove a value to a particular setting.',
- type: 'SUB_COMMAND',
- options: [
- {
- name: 'setting',
- description: 'What setting would you like to set?',
- type: 'STRING',
- required: true,
- choices: settingsArr
- .filter((s) => guildSettingsObj[s].type.includes('array'))
- .map((s) => ({ name: guildSettingsObj[s].name, value: s }))
- },
- {
- name: 'value',
- description: 'What would you like the new value to be?',
- type: 'STRING',
- required: true
- }
- ]
- }
- ],
+ slashOptions: settingsArr.map((setting) => {
+ return {
+ name: util.camelToSnakeCase(setting),
+ description: `Set the server's ${guildSettingsObj[setting].name.toLowerCase()}`,
+ type: /* guildSettingsObj[setting].type.includes('-array') ? */ 'SUB_COMMAND_GROUP' /* : 'SUB_COMMAND' */,
+ options: guildSettingsObj[setting].type.includes('-array')
+ ? [
+ {
+ name: 'add',
+ description: `Add a value to the server's ${guildSettingsObj[setting].name.toLowerCase()}.`,
+ type: 'SUB_COMMAND',
+ options: [
+ {
+ name: 'value',
+ description: `What would you like to add to the server's ${guildSettingsObj[
+ setting
+ ].name.toLowerCase()}?'`,
+ type: guildSettingsObj[setting].type.replace('-array', '').toUpperCase() as 'ROLE' | 'STRING' | 'CHANNEL',
+ required: true
+ }
+ ]
+ },
+ {
+ name: 'remove',
+ description: `Remove a value from the server's ${guildSettingsObj[setting].name.toLowerCase()}.`,
+ type: 'SUB_COMMAND',
+ options: [
+ {
+ name: 'value',
+ description: `What would you like to remove from the server's ${guildSettingsObj[
+ setting
+ ].name.toLowerCase()}?'`,
+ type: guildSettingsObj[setting].type.replace('-array', '').toUpperCase() as 'ROLE' | 'STRING' | 'CHANNEL',
+ required: true
+ }
+ ]
+ }
+ ]
+ : [
+ {
+ name: 'set',
+ description: `Set the server's ${guildSettingsObj[setting].name.toLowerCase()}.`,
+ type: 'SUB_COMMAND',
+ options: [
+ {
+ name: 'value',
+ description: `What would you like to set the server's ${guildSettingsObj[
+ setting
+ ].name.toLowerCase()} to?'`,
+ type: guildSettingsObj[setting].type.toUpperCase() as 'ROLE' | 'STRING' | 'CHANNEL',
+ required: true
+ }
+ ]
+ }
+ ]
+ };
+ }),
slashGuilds: ['516977525906341928'],
channel: 'guild',
clientPermissions: ['SEND_MESSAGES'],
@@ -113,6 +88,7 @@ export default class SettingsCommand extends BushCommand {
// *args(): any {}
public override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> {
+ client.console.debug(message.interaction, 6);
if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`);
const messageOptions = await this.generateMessageOptions(message);
const msg = (await message.util.reply(messageOptions)) as Message;
@@ -167,32 +143,39 @@ export default class SettingsCommand extends BushCommand {
);
return { embeds: [settingsEmbed], components: [selMenu] };
} else {
+ const generateCurrentValue = async (
+ type: 'string' | 'channel' | 'channel-array' | 'role' | 'role-array'
+ ): Promise<string> => {
+ const feat = await message.guild!.getSetting(feature);
+ switch (type.replace('-array', '') as 'string' | 'channel' | 'role') {
+ case 'string': {
+ return Array.isArray(feat)
+ ? feat.map((feat) => util.discord.escapeInlineCode(util.inspectAndRedact(feat))).join('\n')
+ : util.discord.escapeInlineCode(util.inspectAndRedact(feat));
+ }
+ case 'channel': {
+ return Array.isArray(feat) ? feat.map((feat) => `<#${feat}>`).join('\n') : `<#${feat}>`;
+ }
+ case 'role': {
+ return Array.isArray(feat) ? feat.map((feat) => `<@&${feat}>`).join('\n') : `<@&${feat}>`;
+ }
+ }
+ };
const components = new MessageActionRow().addComponents(
new MessageButton().setStyle('PRIMARY').setCustomId('command_settingsBack').setLabel('Back')
);
settingsEmbed.setDescription(guildSettingsObj[feature].description);
- switch (guildSettingsObj[feature].type as 'string' | 'channel' | 'channel-array' | 'role' | 'role-array') {
- case 'string': {
- settingsEmbed.addField(guildSettingsObj[feature].name, (await message.guild.getSetting(feature)).toString());
- settingsEmbed.setFooter(
- `Run "${await message.guild.getSetting('prefix')}settings set ${feature} <value>" to set this setting.`
- );
- return { embeds: [settingsEmbed], components: [components] };
- }
- case 'channel': {
- break;
- }
- case 'channel-array': {
- break;
- }
- case 'role': {
- break;
- }
- case 'role-array': {
- break;
- }
- }
- return {};
+
+ settingsEmbed.setFooter(
+ `Run "${message.util.isSlash ? '/' : await message.guild.getSetting('prefix')}settings ${feature} ${
+ guildSettingsObj[feature].type.includes('-array') ? 'add/remove' : 'set'
+ } <value>" to set this setting.`
+ );
+ settingsEmbed.addField(
+ guildSettingsObj[feature].name,
+ await generateCurrentValue(feature as 'string' | 'channel' | 'channel-array' | 'role' | 'role-array')
+ );
+ return { embeds: [settingsEmbed], components: [components] };
}
}
}
diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts
index 7100afa..7654d2f 100644
--- a/src/commands/info/avatar.ts
+++ b/src/commands/info/avatar.ts
@@ -35,8 +35,8 @@ export default class AvatarCommand extends BushCommand {
});
}
- override async exec(message: BushMessage | BushSlashMessage, { user }: { user: User }): Promise<void> {
- user = user ?? message.author;
+ override async exec(message: BushMessage | BushSlashMessage, args: { user: User }): Promise<void> {
+ const user = args.user ?? message.author;
const embed = new MessageEmbed()
.setTimestamp()
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts
index 54392fd..ca5f325 100644
--- a/src/lib/extensions/discord-akairo/BushClient.ts
+++ b/src/lib/extensions/discord-akairo/BushClient.ts
@@ -277,14 +277,14 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
for (const loader of Object.keys(loaders)) {
try {
loaders[loader as keyof typeof loaders].loadAll();
- void this.logger.success('Startup', `Successfully loaded <<${loader}>>.`, false);
+ void this.logger.success('startup', `Successfully loaded <<${loader}>>.`, false);
} catch (e) {
- void this.logger.error('Startup', `Unable to load loader <<${loader}>> with error:\n${e?.stack || e}`, false);
+ void this.logger.error('startup', `Unable to load loader <<${loader}>> with error:\n${e?.stack || e}`, false);
}
}
await this.dbPreInit();
await UpdateCacheTask.init(this);
- void this.console.success('Startup', `Successfully created <<cache>>.`, false);
+ void this.console.success('startup', `Successfully created <<cache>>.`, false);
this.taskHandler.startAll!();
}
@@ -298,10 +298,10 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
Level.initModel(this.db);
StickyRole.initModel(this.db);
await this.db.sync({ alter: true }); // Sync all tables to fix everything if updated
- await this.console.success('Startup', `Successfully connected to <<database>>.`, false);
+ await this.console.success('startup', `Successfully connected to <<database>>.`, false);
} catch (e) {
await this.console.error(
- 'Startup',
+ 'startup',
`Failed to connect to <<database>> with error:\n` + typeof e === 'object' ? e?.stack : e,
false
);
@@ -330,7 +330,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
await this.#init();
await this.login(this.token!);
} catch (e) {
- await this.console.error('Start', chalk.red(e?.stack || e), false);
+ await this.console.error('start', chalk.red(e?.stack || e), false);
exit(2);
}
}
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index ef51b63..9ed890a 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -1354,6 +1354,10 @@ export class BushClientUtil extends ClientUtil {
return new Promise((resolve) => setTimeout(resolve, s * 1000));
}
+ camelToSnakeCase(str: string) {
+ return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
+ }
+
//~ modified from https://stackoverflow.com/questions/31054910/get-functions-methods-of-a-class
//~ answer by Bruno Grieder
//~ public getMethods(obj: any): string {
diff --git a/src/listeners/client/interactionCreate.ts b/src/listeners/client/interactionCreate.ts
index d2bc6b5..e755ad6 100644
--- a/src/listeners/client/interactionCreate.ts
+++ b/src/listeners/client/interactionCreate.ts
@@ -14,7 +14,7 @@ export default class InteractionCreateListener extends BushListener {
if (!interaction) return;
if (interaction.isCommand()) {
void client.console.info(
- 'SlashCommand',
+ 'slashCommand',
`The <<${interaction.commandName}>> command was used by <<${interaction.user.tag}>> in <<${
interaction.channel
? interaction.channel.type == 'DM'
diff --git a/src/listeners/client/ready.ts b/src/listeners/client/ready.ts
index 5806f7f..cf616ce 100644
--- a/src/listeners/client/ready.ts
+++ b/src/listeners/client/ready.ts
@@ -15,7 +15,7 @@ export default class ReadyListener extends BushListener {
guildCount = `<<${client.guilds.cache.size.toLocaleString()}>>`,
userCount = `<<${client.users.cache.size.toLocaleString()}>>`;
- void client.logger.success('Ready', `Logged in to ${tag} serving ${guildCount} guilds and ${userCount} users.`);
+ void client.logger.success('ready', `Logged in to ${tag} serving ${guildCount} guilds and ${userCount} users.`);
console.log(
chalk.blue(
`------------------------------------------------------------------------------${
diff --git a/src/listeners/commands/commandBlocked.ts b/src/listeners/commands/commandBlocked.ts
index 03e34f5..3be9d1f 100644
--- a/src/listeners/commands/commandBlocked.ts
+++ b/src/listeners/commands/commandBlocked.ts
@@ -21,7 +21,7 @@ export default class CommandBlockedListener extends BushListener {
const isSlash = !!command && !!message.util?.isSlash;
void client.console.info(
- `${isSlash ? 'Slash' : 'Command'}Blocked`,
+ `${isSlash ? 'SlashC' : 'c'}ommandBlocked`,
`<<${message.author.tag}>>${
command ? ` tried to run <<${command}>> but` : "'s message"
} was blocked because <<${reason}>>.`,
diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts
index a3618e7..1cf7c08 100644
--- a/src/listeners/commands/commandError.ts
+++ b/src/listeners/commands/commandError.ts
@@ -26,7 +26,7 @@ export default class CommandErrorListener extends BushListener {
const command = _command ?? message.util?.parsed?.command;
void client.console.error(
- `${isSlash ? 'Slash' : 'Command'}Error`,
+ `${isSlash ? 'slashC' : 'c'}ommandError`,
`an error occurred with the <<${command}>> ${isSlash ? 'slash ' : ''}command in <<${channel}>> triggered by <<${
message?.author?.tag
}>>:\n` + error?.stack || error,
diff --git a/src/listeners/commands/commandMissingPermissions.ts b/src/listeners/commands/commandMissingPermissions.ts
index dc04ac2..49a2e7a 100644
--- a/src/listeners/commands/commandMissingPermissions.ts
+++ b/src/listeners/commands/commandMissingPermissions.ts
@@ -33,7 +33,7 @@ export default class CommandMissingPermissionsListener extends BushListener {
const discordFormat = util.oxford(util.surroundArray(niceMissing, '**'), 'and', '');
const consoleFormat = util.oxford(util.surroundArray(niceMissing, '<<', '>>'), 'and', '');
void client.console.info(
- 'CommandMissingPermissions',
+ 'commandMissingPermissions',
`<<${message.author.tag}>> tried to run <<${
command?.id
}>> but could not because <<${type}>> is missing the ${consoleFormat} permissions${missing.length ? 's' : ''}.`
diff --git a/src/listeners/commands/commandStarted.ts b/src/listeners/commands/commandStarted.ts
index 8b9c7e1..f74a765 100644
--- a/src/listeners/commands/commandStarted.ts
+++ b/src/listeners/commands/commandStarted.ts
@@ -10,7 +10,7 @@ export default class CommandStartedListener extends BushListener {
}
public override exec(...[message, command]: BushCommandHandlerEvents['commandStarted']): void {
void client.logger.info(
- 'Command',
+ 'commandStarted',
`The <<${command.id}>> command was used by <<${message.author.tag}>> in ${
message.channel.type === 'DM' ? `their <<DMs>>` : `<<#${message.channel.name}>> in <<${message.guild?.name}>>`
}.`,
diff --git a/src/listeners/commands/messageBlocked.ts b/src/listeners/commands/messageBlocked.ts
index a36c03d..fc64802 100644
--- a/src/listeners/commands/messageBlocked.ts
+++ b/src/listeners/commands/messageBlocked.ts
@@ -12,6 +12,6 @@ export default class MessageBlockedListener extends BushListener {
const reasons = client.consts.BlockedReasons;
if ([reasons.CLIENT, reasons.BOT].includes(reason)) return;
// return await CommandBlockedListener.handleBlocked(message as Message, null, reason);
- return void client.console.verbose(`MessageBlocked`, `<<${message.author.tag}>>'s message was blocked because ${reason}`);
+ return void client.console.verbose(`messageBlocked`, `<<${message.author.tag}>>'s message was blocked because ${reason}`);
}
}
diff --git a/src/listeners/commands/slashStarted.ts b/src/listeners/commands/slashStarted.ts
index 855c026..aaeecbc 100644
--- a/src/listeners/commands/slashStarted.ts
+++ b/src/listeners/commands/slashStarted.ts
@@ -10,7 +10,7 @@ export default class SlashStartedListener extends BushListener {
}
public override async exec(...[message, command]: BushCommandHandlerEvents['slashStarted']): Promise<unknown> {
return void client.logger.info(
- 'SlashCommand',
+ 'slashStarted',
`The <<${command.id}>> command was used by <<${message.author.tag}>> in ${
message.channel
? message.channel.type === 'DM'
diff --git a/src/listeners/guild/guildCreate.ts b/src/listeners/guild/guildCreate.ts
index bc5694a..64e5285 100644
--- a/src/listeners/guild/guildCreate.ts
+++ b/src/listeners/guild/guildCreate.ts
@@ -11,7 +11,10 @@ export default class GuildCreateListener extends BushListener {
}
public override async exec(...[guild]: BushClientEvents['guildCreate']): Promise<void> {
- void client.console.info('JoinGuild', `Joined <<${guild.name}>> with <<${guild.memberCount?.toLocaleString()}>> members.`);
+ void client.console.info(
+ 'guildCreate',
+ `Joined <<${guild.name}>> with <<${guild.memberCount?.toLocaleString()}>> members.`
+ );
const g = await Guild.findByPk(guild.id);
if (!g) void Guild.create({ id: guild.id });
}
diff --git a/src/listeners/guild/guildDelete.ts b/src/listeners/guild/guildDelete.ts
index 3126bd6..e260a63 100644
--- a/src/listeners/guild/guildDelete.ts
+++ b/src/listeners/guild/guildDelete.ts
@@ -11,6 +11,6 @@ export default class GuildDeleteListener extends BushListener {
}
public override exec(...[guild]: BushClientEvents['guildDelete']): void {
- void client.console.info('LeaveGuild', `Left <<${guild.name}>> with <<${guild.memberCount?.toLocaleString()}>> members.`);
+ void client.console.info('guildDelete', `Left <<${guild.name}>> with <<${guild.memberCount?.toLocaleString()}>> members.`);
}
}
diff --git a/src/listeners/guild/guildMemberAdd.ts b/src/listeners/guild/guildMemberAdd.ts
index 7bef6b8..e0a0426 100644
--- a/src/listeners/guild/guildMemberAdd.ts
+++ b/src/listeners/guild/guildMemberAdd.ts
@@ -32,9 +32,14 @@ export default class GuildMemberAddListener extends BushListener {
.setColor(this.client.util.colors.green);
await welcome
.send({ embeds: [embed] })
- .then(() => this.client.console.info('OnJoin', `Sent a message for <<${member.user.tag}>> in <<${member.guild.name}>>.`))
+ .then(() =>
+ this.client.console.info('guildMemberAdd', `Sent a message for <<${member.user.tag}>> in <<${member.guild.name}>>.`)
+ )
.catch(() =>
- this.client.console.warn('OnJoin', `Failed to send message for <<${member.user.tag}>> in <<${member.guild.name}>>.`)
+ this.client.console.warn(
+ 'guildMemberAdd',
+ `Failed to send message for <<${member.user.tag}>> in <<${member.guild.name}>>.`
+ )
);
}
@@ -58,11 +63,12 @@ export default class GuildMemberAddListener extends BushListener {
const addedRoles = await member.roles
.add(rolesArray, "Returning member's previous roles.")
.catch(
- () => void this.client.console.warn('ReturnRoles', `There was an error returning <<${member.user.tag}>>'s roles.`)
+ () =>
+ void this.client.console.warn('guildMemberAdd', `There was an error returning <<${member.user.tag}>>'s roles.`)
);
if (addedRoles) {
void this.client.console.info(
- 'RoleData',
+ 'guildMemberAdd',
`Assigned sticky roles to <<${member.user.tag}>> in <<${member.guild.name}>>.`
);
} else if (!addedRoles) {
@@ -73,10 +79,13 @@ export default class GuildMemberAddListener extends BushListener {
.catch(() => failedRoles.push(rolesArray[i]));
}
if (failedRoles.length) {
- void this.client.console.warn('RoleData', 'Failed assigning the following roles on Fallback:' + failedRoles);
+ void this.client.console.warn(
+ 'guildMemberAdd',
+ 'Failed assigning the following roles on Fallback:' + failedRoles
+ );
} else {
void this.client.console.info(
- 'RoleData',
+ 'guildMemberAdd',
`[Fallback] Assigned sticky roles to <<${member.user.tag}>> in <<${member.guild.name}>>.`
);
}
@@ -89,12 +98,15 @@ export default class GuildMemberAddListener extends BushListener {
await member.roles
.add(joinRoles, 'Join roles.')
.then(() =>
- this.client.console.info('RoleData', `Assigned join roles to <<${member.user.tag}>> in <<${member.guild.name}>>.`)
+ this.client.console.info(
+ 'guildMemberAdd',
+ `Assigned join roles to <<${member.user.tag}>> in <<${member.guild.name}>>.`
+ )
)
.catch(
() =>
void this.client.console.warn(
- 'OnJoin',
+ 'guildMemberAdd',
`Failed to assign join roles to <<${member.user.tag}>>, in <<${member.guild.name}>>.`
)
);
diff --git a/src/listeners/guild/guildMemberRemove.ts b/src/listeners/guild/guildMemberRemove.ts
index f25108f..f72f061 100644
--- a/src/listeners/guild/guildMemberRemove.ts
+++ b/src/listeners/guild/guildMemberRemove.ts
@@ -34,9 +34,9 @@ export default class GuildMemberRemoveListener extends BushListener {
.setColor(isBan ? util.colors.orange : util.colors.red);
welcome
.send({ embeds: [embed] })
- .then(() => client.console.info('OnLeave', `Sent a message for <<${user.tag}>> in <<${member.guild.name}>>.`))
+ .then(() => client.console.info('guildMemberRemove', `Sent a message for <<${user.tag}>> in <<${member.guild.name}>>.`))
.catch(() =>
- this.client.console.warn('OnLeave', `Failed to send message for <<${user.tag}>> in <<${member.guild.name}>>.`)
+ this.client.console.warn('guildMemberRemove', `Failed to send message for <<${user.tag}>> in <<${member.guild.name}>>.`)
);
}
@@ -61,7 +61,9 @@ export default class GuildMemberRemoveListener extends BushListener {
if (nickname) row.nickname = nickname;
await row
.save()
- .then(() => this.client.console.info('RoleData', `${isNew ? 'Created' : 'Updated'} info for <<${member.user.tag}>>.`));
+ .then(() =>
+ this.client.console.info('guildMemberRemove', `${isNew ? 'Created' : 'Updated'} info for <<${member.user.tag}>>.`)
+ );
}
}
}
diff --git a/src/listeners/message/autoPublisher.ts b/src/listeners/message/autoPublisher.ts
index 1be58a3..3a7bbb7 100644
--- a/src/listeners/message/autoPublisher.ts
+++ b/src/listeners/message/autoPublisher.ts
@@ -15,10 +15,15 @@ export default class autoPublisherListener extends BushListener {
const autoPublishChannels = await message.guild.getSetting('autoPublishChannels');
if (autoPublishChannels) {
if (message.channel.type === 'GUILD_NEWS' && autoPublishChannels.some((x) => message.channel.id.includes(x))) {
- const success = await message.crosspost().catch(() => false);
- if (!success)
- void client.console.warn('AutoPublisher', `Failed to publish <<${message.id}>> in <<${message.guild.name}>>.`);
- void client.logger.log('AutoPublisher', `Published message <<${message.id}>> in <<${message.guild.name}>>.`);
+ await message
+ .crosspost()
+ .then(
+ () => void client.logger.log('autoPublisher', `Published message <<${message.id}>> in <<${message.guild!.name}>>.`)
+ )
+ .catch(
+ () =>
+ void client.console.warn('autoPublisher', `Failed to publish <<${message.id}>> in <<${message.guild!.name}>>.`)
+ );
}
}
}
diff --git a/src/listeners/message/automodCreate.ts b/src/listeners/message/automodCreate.ts
index 4165043..ac05bf9 100644
--- a/src/listeners/message/automodCreate.ts
+++ b/src/listeners/message/automodCreate.ts
@@ -85,7 +85,7 @@ export default class AutomodMessageCreateListener extends BushListener {
}
void client.console.info(
- 'AutoMod',
+ 'autoMod',
`Severity <<${highestOffence}>> action performed on <<${message.author.tag}>> (<<${message.author.id}>>) in <<#${message.channel.name}>> in <<${message.guild.name}>>`
);
diff --git a/src/listeners/message/blacklistedFile.ts b/src/listeners/message/blacklistedFile.ts
index 5aa5477..733ab73 100644
--- a/src/listeners/message/blacklistedFile.ts
+++ b/src/listeners/message/blacklistedFile.ts
@@ -133,7 +133,7 @@ export default class BlacklistedFileListener extends BushListener {
);
if (message.channel.type === 'DM') return;
void this.client.console.info(
- 'BlacklistedFile',
+ 'blacklistedFile',
`Deleted <<${foundFiles.map((f) => f.description).join(' and ')}>> sent by <<${message.author.tag}>> in ${
message.channel.name
}.`
@@ -143,7 +143,7 @@ export default class BlacklistedFileListener extends BushListener {
`<@!${message.author.id}>, please do not send ${foundFiles.map((f) => f.description).join(' or ')}.`
);
void this.client.console.warn(
- 'BlacklistedFile',
+ 'blacklistedFile',
`Failed to delete <<${foundFiles.map((f) => f.description).join(' and ')}>> sent by <<${message.author.tag}>> in <<${
message.channel.type === 'DM' ? `${message.channel.recipient.tag}'s DMs` : message.channel.name
}>>.`
diff --git a/src/listeners/message/boosterMessage.ts b/src/listeners/message/boosterMessage.ts
index 5d49661..122fa39 100644
--- a/src/listeners/message/boosterMessage.ts
+++ b/src/listeners/message/boosterMessage.ts
@@ -14,7 +14,7 @@ export default class BoosterMessageListener extends BushListener {
if (!message.guild || !(await message.guild?.hasFeature('boosterMessageReact'))) return;
if (message.type === 'USER_PREMIUM_GUILD_SUBSCRIPTION') {
return await message.react('<:nitroboost:785160348885975062>').catch(() => {
- void this.client.console.warn('BoosterMessage', `Failed to react to <<${message.id}>>.`);
+ void this.client.console.warn('boosterMessage', `Failed to react to <<${message.id}>>.`);
});
}
}
diff --git a/src/listeners/message/level.ts b/src/listeners/message/level.ts
index 83d9e3b..7722db7 100644
--- a/src/listeners/message/level.ts
+++ b/src/listeners/message/level.ts
@@ -30,14 +30,11 @@ export default class LevelListener extends BushListener {
});
const xpToGive = Level.genRandomizedXp();
const success = await user.increment('xp', { by: xpToGive }).catch((e) => {
- void client.logger.error('levelMessageListener', e?.stack || e);
+ void client.logger.error('level', e?.stack || e);
return false;
});
if (success)
- void client.logger.verbose(
- `levelMessage`,
- `Gave <<${xpToGive}>> XP to <<${message.author.tag}>> in <<${message.guild}>>.`
- );
+ void client.logger.verbose(`level`, `Gave <<${xpToGive}>> XP to <<${message.author.tag}>> in <<${message.guild}>>.`);
this.#levelCooldowns.add(`${message.guild.id}-${message.author.id}`);
setTimeout(() => this.#levelCooldowns.delete(`${message.guild!.id}-${message.author.id}`), 60_000);
}
diff --git a/src/listeners/message/verbose.ts b/src/listeners/message/verbose.ts
index 9404412..8177529 100644
--- a/src/listeners/message/verbose.ts
+++ b/src/listeners/message/verbose.ts
@@ -10,11 +10,13 @@ export default class MessageVerboseListener extends BushListener {
});
}
- public override exec(...[message]: BushClientEvents['messageCreate']): Promise<void> | undefined {
- if (message.channel?.type === 'DM') return;
- void this.client.console.verbose(
- 'messageVerbose',
- `A message was sent by <<${message.author.tag}>> in <<${message.channel.name}>> in <<${message.guild!.name}>>.`
- );
+ public override exec(...[message]: BushClientEvents['messageCreate']): void {
+ if (client.isReady()) {
+ if (message.channel?.type === 'DM') return;
+ void this.client.console.verbose(
+ 'messageVerbose',
+ `A message was sent by <<${message.author.tag}>> in <<${message.channel.name}>> in <<${message.guild!.name}>>.`
+ );
+ }
}
}
diff --git a/src/listeners/other/promiseRejection.ts b/src/listeners/other/promiseRejection.ts
index ea6f9d1..d60c9c7 100644
--- a/src/listeners/other/promiseRejection.ts
+++ b/src/listeners/other/promiseRejection.ts
@@ -11,7 +11,7 @@ export default class PromiseRejectionListener extends BushListener {
public override async exec(error: Error): Promise<void> {
// eslint-disable-next-line @typescript-eslint/no-base-to-string
- void client.console.error('PromiseRejection', `An unhanded promise rejection occurred:\n${error?.stack ?? error}`, false);
+ void client.console.error('promiseRejection', `An unhanded promise rejection occurred:\n${error?.stack ?? error}`, false);
void client.console.channelError({
embeds: [await CommandErrorListener.generateErrorEmbed({ type: 'unhandledRejection', error: error })]
});