aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.yarn/sdks/typescript/package.json2
-rw-r--r--package.json8
-rw-r--r--src/bot.ts2
-rw-r--r--src/commands/admin/channelPermissions.ts9
-rw-r--r--src/commands/dev/reload.ts2
-rw-r--r--src/commands/info/pronouns.ts8
-rw-r--r--src/commands/moderation/kick.ts2
-rw-r--r--src/commands/moderation/lockdown.ts2
-rw-r--r--src/commands/moderation/mute.ts2
-rw-r--r--src/commands/moderation/unmute.ts6
-rw-r--r--src/commands/moulberry-bush/report.ts2
-rw-r--r--src/commands/skyblock-reborn/chooseColorCommand.ts2
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts6
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts12
-rw-r--r--src/lib/extensions/discord-akairo/BushInhibitor.ts2
-rw-r--r--src/lib/extensions/discord.js/BushGuildMember.ts2
-rw-r--r--src/lib/utils/BushLogger.ts2
-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.ts6
-rw-r--r--src/listeners/commands/commandMissingPermissions.ts2
-rw-r--r--src/listeners/commands/commandStarted.ts2
-rw-r--r--src/listeners/commands/slashBlocked.ts2
-rw-r--r--src/listeners/commands/slashCommandError.ts6
-rw-r--r--src/listeners/commands/slashMissingPermissions.ts2
-rw-r--r--src/listeners/commands/slashStarted.ts2
-rw-r--r--src/listeners/message/level.ts10
-rw-r--r--src/listeners/other/promiseRejection.ts4
-rw-r--r--src/listeners/other/uncaughtException.ts4
-rw-r--r--src/tasks/removeExpiredPunishements.ts8
-rw-r--r--src/tasks/updateCache.ts2
32 files changed, 65 insertions, 62 deletions
diff --git a/.yarn/sdks/typescript/package.json b/.yarn/sdks/typescript/package.json
index 27270c7..f564d3a 100644
--- a/.yarn/sdks/typescript/package.json
+++ b/.yarn/sdks/typescript/package.json
@@ -1,6 +1,6 @@
{
"name": "typescript",
- "version": "4.2.4-pnpify",
+ "version": "4.2.4-sdk",
"main": "./lib/typescript.js",
"type": "commonjs"
}
diff --git a/package.json b/package.json
index 6f39ed3..76e625e 100644
--- a/package.json
+++ b/package.json
@@ -27,7 +27,7 @@
"format": "yarn prettier . --write",
"lint": "yarn eslint --ext js,jsx,ts,tsx src",
"format-check": "yarn prettier . --check",
- "upgrade": "rimraf yarn.lock && yarn cache clean && yarn install && yarn up"
+ "upgrade": "rimraf yarn.lock && yarn cache clean && yarn install && yarn up && yarn dlx @yarnpkg/sdks vscode"
},
"devDependencies": {
"@types/common-tags": "^1.8.0",
@@ -84,7 +84,8 @@
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
- "sourceType": "module"
+ "sourceType": "module",
+ "project": "./tsconfig.json"
},
"plugins": [
"@typescript-eslint"
@@ -109,7 +110,8 @@
"ts-check": "allow-with-description",
"minimumDescriptionLength": 5
}
- ]
+ ],
+ "@typescript-eslint/no-floating-promises": "error"
}
},
"prettier": {
diff --git a/src/bot.ts b/src/bot.ts
index 0cd9884..4edab6e 100644
--- a/src/bot.ts
+++ b/src/bot.ts
@@ -4,4 +4,4 @@ import { BushClient } from './lib/';
BushClient.preStart();
const client: BushClient = new BushClient(config);
-client.start();
+void client.start();
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts
index c397855..08d0068 100644
--- a/src/commands/admin/channelPermissions.ts
+++ b/src/commands/admin/channelPermissions.ts
@@ -65,7 +65,7 @@ export default class ChannelPermissionsCommand extends BushCommand {
permission: string;
state: 'true' | 'false' | 'neutral';
}
- ): Promise<void> {
+ ): Promise<unknown> {
const failedChannels = [];
for (const channel of message.guild.channels.cache.array()) {
try {
@@ -89,9 +89,12 @@ export default class ChannelPermissionsCommand extends BushCommand {
paginate.push(new MessageEmbed().setDescription(failure.substring(i, Math.min(failure.length, i + 2000))));
}
const normalMessage = `Finished changing perms! Failed channels:`;
- util.buttonPaginate(message, paginate, normalMessage);
+ return await client.util.buttonPaginate(message, paginate, normalMessage);
} else {
- await message.util.reply({ content: `Finished changing perms! Failed channels:`, embeds: [{ description: failure }] });
+ return await message.util.reply({
+ content: `Finished changing perms! Failed channels:`,
+ embeds: [{ description: failure }]
+ });
}
}
}
diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts
index 2be67fa..4748aba 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) await 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/info/pronouns.ts b/src/commands/info/pronouns.ts
index 0a5c0bc..82ee04f 100644
--- a/src/commands/info/pronouns.ts
+++ b/src/commands/info/pronouns.ts
@@ -60,14 +60,14 @@ export default class PronounsCommand extends BushCommand {
slash: true
});
}
- async exec(message: Message | BushSlashMessage, args: { user?: User }): Promise<void> {
+ async exec(message: Message | BushSlashMessage, args: { user?: User }): Promise<unknown> {
const user = args.user || message.author;
const author = user.id === message.author.id;
try {
const apiRes: { pronouns: pronounsType } = await got
.get(`https://pronoundb.org/api/v1/lookup?platform=discord&id=${user.id}`)
.json();
- message.util.reply({
+ return await message.util.reply({
embeds: [
new MessageEmbed({
title: `${author ? 'Your' : `${user.tag}'s`} pronouns:`,
@@ -81,11 +81,11 @@ export default class PronounsCommand extends BushCommand {
} catch (e) {
if (e instanceof HTTPError && e.response.statusCode === 404) {
if (author) {
- await message.util.reply(
+ return await message.util.reply(
'You do not appear to have any pronouns set. Please go to https://pronoundb.org/ and set your pronouns.'
);
} else {
- await message.util.reply(
+ return await message.util.reply(
`${user.tag} does not appear to have any pronouns set. Please tell them to go to https://pronoundb.org/ and set their pronouns.`
);
}
diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts
index bc7d9d2..5fd83b7 100644
--- a/src/commands/moderation/kick.ts
+++ b/src/commands/moderation/kick.ts
@@ -61,7 +61,7 @@ export default class KickCommand extends BushCommand {
): Promise<unknown> {
const member = message.guild.members.cache.get(user.id) as BushGuildMember;
- if (!member) message.util.reply(`${util.emojis.error} You cannot kick members that are not in the server.`);
+ if (!member) return await message.util.reply(`${util.emojis.error} You cannot kick members that are not in the server.`);
const useForce = force && message.author.isOwner();
const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'kick', true, useForce);
diff --git a/src/commands/moderation/lockdown.ts b/src/commands/moderation/lockdown.ts
index 4eaeceb..db074b1 100644
--- a/src/commands/moderation/lockdown.ts
+++ b/src/commands/moderation/lockdown.ts
@@ -36,6 +36,8 @@ export default class LockdownCommand extends BushCommand {
if (!all) {
if (!['GUILD_TEXT', 'GUILD_NEWS'].includes(message.channel.type))
return message.util.reply(`${util.emojis.error} You can only lock down text and announcement channels.`);
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
const lockdownSuccess = await util.lockdownChannel({
channel: message.channel as BushTextChannel | BushNewsChannel,
moderator: message.author
diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts
index 779f60d..31cd233 100644
--- a/src/commands/moderation/mute.ts
+++ b/src/commands/moderation/mute.ts
@@ -61,7 +61,7 @@ export default class MuteCommand extends BushCommand {
{ user, reason, force }: { user: BushUser; reason?: { duration: number; contentWithoutTime: string }; force: boolean }
): Promise<unknown> {
const member = message.guild.members.cache.get(user.id) as BushGuildMember;
- if (!member) message.util.reply(`${util.emojis.error} You cannot kick members that are not in the server.`);
+ if (!member) return await message.util.reply(`${util.emojis.error} You cannot kick members that are not in the server.`);
const useForce = force && message.author.isOwner();
const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'mute', true, useForce);
diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts
index 807cf2c..528317c 100644
--- a/src/commands/moderation/unmute.ts
+++ b/src/commands/moderation/unmute.ts
@@ -65,8 +65,8 @@ export default class UnmuteCommand extends BushCommand {
moderator: message.author
});
- const responseMessage = () => {
- const prefix = message.guild.getSetting('prefix');
+ const responseMessage = async () => {
+ const prefix = await message.guild.getSetting('prefix');
switch (responseCode) {
case 'missing permissions':
return `${error} Could not unmute ${victimBoldTag} because I am missing the \`Manage Roles\` permission.`;
@@ -88,6 +88,6 @@ export default class UnmuteCommand extends BushCommand {
return `${util.emojis.success} Successfully unmuted **${member.user.tag}**.`;
}
};
- return await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
+ return await message.util.reply({ content: await responseMessage(), allowedMentions: AllowedMentions.none() });
}
}
diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts
index 64dcdff..4c6adc1 100644
--- a/src/commands/moulberry-bush/report.ts
+++ b/src/commands/moulberry-bush/report.ts
@@ -111,7 +111,7 @@ export default class ReportCommand extends BushCommand {
await ReportMessage.react(util.emojis.success);
await ReportMessage.react(util.emojis.error);
} catch {
- client.console.warn('ReportCommand', 'Could not react to report message.');
+ void client.console.warn('ReportCommand', 'Could not react to report message.');
}
});
return await message.util.reply('Successfully made a report.');
diff --git a/src/commands/skyblock-reborn/chooseColorCommand.ts b/src/commands/skyblock-reborn/chooseColorCommand.ts
index 344fa60..0138e36 100644
--- a/src/commands/skyblock-reborn/chooseColorCommand.ts
+++ b/src/commands/skyblock-reborn/chooseColorCommand.ts
@@ -171,7 +171,7 @@ export default class ChooseColorCommand extends BushCommand {
);
}
- message.util.reply({
+ return await message.util.reply({
content: `${util.emojis.success} Assigned you the <@&${colorID}> role.`,
allowedMentions: AllowedMentions.none()
});
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts
index c283eb9..10db18d 100644
--- a/src/lib/extensions/discord-akairo/BushClient.ts
+++ b/src/lib/extensions/discord-akairo/BushClient.ts
@@ -228,14 +228,14 @@ export class BushClient extends AkairoClient {
for (const loader of Object.keys(loaders)) {
try {
loaders[loader].loadAll();
- await this.logger.success('Startup', `Successfully loaded <<${loader}>>.`, false);
+ void this.logger.success('Startup', `Successfully loaded <<${loader}>>.`, false);
} catch (e) {
- await 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);
- this.console.success('Startup', `Successfully created <<cache>>.`, false);
+ void this.console.success('Startup', `Successfully created <<cache>>.`, false);
this.taskHandler.startAll();
}
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index 20fb468..ebac9eb 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -170,7 +170,7 @@ export class BushClientUtil extends ClientUtil {
const res: hastebinRes = await got.post(`${url}/documents`, { body: content }).json();
return `${url}/${res.key}`;
} catch {
- client.console.error('Haste', `Unable to upload haste to ${url}`);
+ void client.console.error('Haste', `Unable to upload haste to ${url}`);
}
}
return 'Unable to post';
@@ -681,7 +681,7 @@ export class BushClientUtil extends ClientUtil {
guild
});
const saveResult: ModLog = await modLogEntry.save().catch((e) => {
- client.console.error('createModLogEntry', e?.stack || e);
+ void client.console.error('createModLogEntry', e?.stack || e);
return null;
});
@@ -708,7 +708,7 @@ export class BushClientUtil extends ClientUtil {
? ActivePunishment.build({ user, type, guild, expires, modlog: options.modlog, extraInfo: options.extraInfo })
: ActivePunishment.build({ user, type, guild, expires, modlog: options.modlog });
return await entry.save().catch((e) => {
- client.console.error('createPunishmentEntry', e?.stack || e);
+ void client.console.error('createPunishmentEntry', e?.stack || e);
return null;
});
}
@@ -728,13 +728,13 @@ export class BushClientUtil extends ClientUtil {
// finding all cases of a certain type incase there were duplicates or something
where: { user, guild, type }
}).catch((e) => {
- client.console.error('removePunishmentEntry', e?.stack || e);
+ void client.console.error('removePunishmentEntry', e?.stack || e);
success = false;
});
if (entries) {
entries.forEach(async (entry) => {
await entry.destroy().catch((e) => {
- client.console.error('removePunishmentEntry', e?.stack || e);
+ void client.console.error('removePunishmentEntry', e?.stack || e);
});
success = false;
});
@@ -791,7 +791,7 @@ export class BushClientUtil extends ClientUtil {
public async automod(message: BushMessage) {
const autoModPhases = await message.guild.getSetting('autoModPhases');
- if (autoModPhases.includes(message.content.toString()) && message.deletable) message.delete();
+ if (autoModPhases.includes(message.content.toString()) && message.deletable) return await message.delete();
}
public capitalizeFirstLetter(string: string): string {
diff --git a/src/lib/extensions/discord-akairo/BushInhibitor.ts b/src/lib/extensions/discord-akairo/BushInhibitor.ts
index ae91494..f924458 100644
--- a/src/lib/extensions/discord-akairo/BushInhibitor.ts
+++ b/src/lib/extensions/discord-akairo/BushInhibitor.ts
@@ -10,6 +10,6 @@ export class BushInhibitor extends Inhibitor {
public exec(message: BushMessage, command: BushCommand): any;
public exec(message: BushMessage | BushSlashMessage, command: BushCommand): any {
- super.exec(message, command);
+ return super.exec(message, command);
}
}
diff --git a/src/lib/extensions/discord.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts
index 70feb90..142b766 100644
--- a/src/lib/extensions/discord.js/BushGuildMember.ts
+++ b/src/lib/extensions/discord.js/BushGuildMember.ts
@@ -94,7 +94,7 @@ export class BushGuildMember extends GuildMember {
true
)
.catch((e) => {
- client.console.error('warn', e, true, 1);
+ void client.console.error('warn', e, true, 1);
return { log: null, caseNum: null };
});
if (!result || !result.log) return { result: 'error creating modlog entry', caseNum: null };
diff --git a/src/lib/utils/BushLogger.ts b/src/lib/utils/BushLogger.ts
index d0c482f..e7532d8 100644
--- a/src/lib/utils/BushLogger.ts
+++ b/src/lib/utils/BushLogger.ts
@@ -8,7 +8,7 @@ import { BushClient, BushSendMessageType } from '../extensions/discord-akairo/Bu
export class BushLogger {
private client: BushClient;
public constructor(client: BushClient) {
- client = client;
+ this.client = client;
}
private parseFormatting(
diff --git a/src/listeners/client/interactionCreate.ts b/src/listeners/client/interactionCreate.ts
index 41905f7..b0d1786 100644
--- a/src/listeners/client/interactionCreate.ts
+++ b/src/listeners/client/interactionCreate.ts
@@ -13,7 +13,7 @@ export default class InteractionCreateListener extends BushListener {
async exec(...[interaction]: ClientEvents['interactionCreate']): Promise<unknown> {
if (!interaction) return;
if (interaction.isCommand()) {
- client.console.info(
+ void client.console.info(
'SlashCommand',
`The <<${interaction.commandName}>> command was used by <<${interaction.user.tag}>> in <<${
interaction.channel.type == 'DM' ? interaction.channel.recipient + 's DMs' : interaction.channel.name
diff --git a/src/listeners/client/ready.ts b/src/listeners/client/ready.ts
index 9c04aea..449ec42 100644
--- a/src/listeners/client/ready.ts
+++ b/src/listeners/client/ready.ts
@@ -14,7 +14,7 @@ export default class ReadyListener extends BushListener {
guildCount = `<<${client.guilds.cache.size.toLocaleString()}>>`,
userCount = `<<${client.users.cache.size.toLocaleString()}>>`;
- 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 d33721e..526977b 100644
--- a/src/listeners/commands/commandBlocked.ts
+++ b/src/listeners/commands/commandBlocked.ts
@@ -9,7 +9,7 @@ export default class CommandBlockedListener extends BushListener {
}
public async exec(...[message, command, reason]: BushCommandHandlerEvents['commandBlocked']): Promise<unknown> {
- client.console.info(
+ void client.console.info(
'CommandBlocked',
`<<${message.author.tag}>> tried to run <<${message.util.parsed.command}>> but was blocked because <<${reason}>>.`,
true
diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts
index 62906ab..c287656 100644
--- a/src/listeners/commands/commandError.ts
+++ b/src/listeners/commands/commandError.ts
@@ -39,7 +39,7 @@ export default class CommandErrorListener extends BushListener {
);
(await message.util?.send({ embeds: [errorUserEmbed] }).catch((e) => {
const channel = message.channel.type === 'DM' ? message.channel.recipient.tag : message.channel.name;
- client.console.warn('CommandError', `Failed to send user error embed in <<${channel}>>:\n` + e?.stack || e);
+ void client.console.warn('CommandError', `Failed to send user error embed in <<${channel}>>:\n` + e?.stack || e);
})) ?? client.console.error('CommandError', `Failed to send user error embed.` + error?.stack || error, false);
} else {
const errorDevEmbed = new MessageEmbed()
@@ -49,12 +49,12 @@ export default class CommandErrorListener extends BushListener {
.setDescription(await util.codeblock(`${error?.stack || error}`, 2048, 'js'));
(await message.util?.send({ embeds: [errorDevEmbed] }).catch((e) => {
const channel = message.channel.type === 'DM' ? message.channel.recipient.tag : message.channel.name;
- client.console.warn('CommandError', `Failed to send owner error stack in <<${channel}>>.` + e?.stack || e);
+ void client.console.warn('CommandError', `Failed to send owner error stack in <<${channel}>>.` + e?.stack || e);
})) ?? client.console.error('CommandError', `Failed to send owner error stack.` + error?.stack || error, false);
}
}
const channel = message.channel.type === 'DM' ? message.channel.recipient.tag : message.channel.name;
- client.console.error(
+ void client.console.error(
'CommandError',
`an error occurred with the <<${command}>> 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 ef1205b..3ada70f 100644
--- a/src/listeners/commands/commandMissingPermissions.ts
+++ b/src/listeners/commands/commandMissingPermissions.ts
@@ -21,7 +21,7 @@ export default class CommandMissingPermissionsListener extends BushListener {
const discordFormat = util.oxford(util.surroundArray(niceMissing, '**'), 'and', '');
const consoleFormat = util.oxford(util.surroundArray(niceMissing, '<<', '>>'), 'and', '');
- client.console.info(
+ void client.console.info(
'CommandMissingPermissions',
`<<${message.author.tag}>> tried to run <<${
command?.id
diff --git a/src/listeners/commands/commandStarted.ts b/src/listeners/commands/commandStarted.ts
index b9aaf53..bccb500 100644
--- a/src/listeners/commands/commandStarted.ts
+++ b/src/listeners/commands/commandStarted.ts
@@ -9,7 +9,7 @@ export default class CommandStartedListener extends BushListener {
});
}
exec(...[message, command]: BushCommandHandlerEvents['commandStarted']): void {
- client.logger.info(
+ void client.logger.info(
'Command',
`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/slashBlocked.ts b/src/listeners/commands/slashBlocked.ts
index b65dac4..f79cec3 100644
--- a/src/listeners/commands/slashBlocked.ts
+++ b/src/listeners/commands/slashBlocked.ts
@@ -10,7 +10,7 @@ export default class SlashBlockedListener extends BushListener {
}
public async exec(...[message, command, reason]: BushCommandHandlerEvents['slashBlocked']): Promise<unknown> {
- client.console.info(
+ void client.console.info(
'SlashBlocked',
`<<${message.author.tag}>> tried to run <<${message.util.parsed.command}>> but was blocked because <<${reason}>>.`,
true
diff --git a/src/listeners/commands/slashCommandError.ts b/src/listeners/commands/slashCommandError.ts
index 41f941c..a108151 100644
--- a/src/listeners/commands/slashCommandError.ts
+++ b/src/listeners/commands/slashCommandError.ts
@@ -39,7 +39,7 @@ export default class SlashCommandErrorListener extends BushListener {
`Oh no! While running the command \`${command.id}\`, an error occurred. Please give the developers code \`${errorNo}\`.`
);
(await message.util?.send({ embeds: [errorUserEmbed] }).catch((e) => {
- client.console.warn('SlashError', `Failed to send user error embed in <<${channel}>>:\n` + e?.stack || e);
+ void client.console.warn('SlashError', `Failed to send user error embed in <<${channel}>>:\n` + e?.stack || e);
})) ?? client.console.error('SlashError', `Failed to send user error embed.` + error?.stack || error, false);
} else {
const errorDevEmbed = new MessageEmbed()
@@ -48,12 +48,12 @@ export default class SlashCommandErrorListener extends BushListener {
.setTimestamp()
.setDescription(await util.codeblock(`${error?.stack || error}`, 2048, 'js'));
(await message.util?.send({ embeds: [errorDevEmbed] }).catch((e) => {
- client.console.warn('SlashError', `Failed to send owner error stack in <<${channel}>>.` + e?.stack || e);
+ void client.console.warn('SlashError', `Failed to send owner error stack in <<${channel}>>.` + e?.stack || e);
})) ?? client.console.error('SlashError', `Failed to send user error embed.` + error?.stack || error, false);
}
}
const channel = (message.channel as GuildChannel)?.name || message.interaction.user.tag;
- client.console.error(
+ void client.console.error(
'SlashError',
`an error occurred with the <<${command}>> command in <<${channel}>> triggered by <<${message?.author?.tag}>>:\n` +
error?.stack || error,
diff --git a/src/listeners/commands/slashMissingPermissions.ts b/src/listeners/commands/slashMissingPermissions.ts
index aa2bc50..70ed7c2 100644
--- a/src/listeners/commands/slashMissingPermissions.ts
+++ b/src/listeners/commands/slashMissingPermissions.ts
@@ -21,7 +21,7 @@ export default class SlashMissingPermissionsListener extends BushListener {
const discordFormat = util.oxford(util.surroundArray(niceMissing, '`'), 'and', '');
const consoleFormat = util.oxford(util.surroundArray(niceMissing, '<<', '>>'), 'and', '');
- client.console.info(
+ void client.console.info(
'CommandMissingPermissions',
`<<${message.author.tag}>> tried to run <<${
command?.id
diff --git a/src/listeners/commands/slashStarted.ts b/src/listeners/commands/slashStarted.ts
index 1b0590f..dbb0c0d 100644
--- a/src/listeners/commands/slashStarted.ts
+++ b/src/listeners/commands/slashStarted.ts
@@ -9,7 +9,7 @@ export default class SlashStartedListener extends BushListener {
});
}
async exec(...[message, command]: BushCommandHandlerEvents['slashStarted']): Promise<unknown> {
- return await client.logger.info(
+ return void client.logger.info(
'SlashCommand',
`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/message/level.ts b/src/listeners/message/level.ts
index b3bd08c..e8edfcf 100644
--- a/src/listeners/message/level.ts
+++ b/src/listeners/message/level.ts
@@ -32,16 +32,12 @@ export default class LevelListener extends BushListener {
}
});
const xpToGive = Level.genRandomizedXp();
- user.increment('xp', { by: xpToGive });
- const success = await user.save().catch((e) => {
- console.debug(`User: ${message.author.id}`);
- console.debug(`Guild: ${message.author.id}`);
- console.debug(`Model: ${user}`);
- client.logger.error('LevelMessageListener', e?.stack || e);
+ const success = await user.increment('xp', { by: xpToGive }).catch((e) => {
+ void client.logger.error('LevelMessageListener', e?.stack || e);
return false;
});
if (success)
- client.logger.verbose(
+ void client.logger.verbose(
`LevelMessageListener`,
`Gave <<${xpToGive}>> XP to <<${message.author.tag}>> in <<${message.guild}>>.`
);
diff --git a/src/listeners/other/promiseRejection.ts b/src/listeners/other/promiseRejection.ts
index 204e43a..e0a62c0 100644
--- a/src/listeners/other/promiseRejection.ts
+++ b/src/listeners/other/promiseRejection.ts
@@ -9,8 +9,8 @@ export default class PromiseRejectionListener extends BushListener {
}
public async exec(error: Error): Promise<void> {
- client.console.error('PromiseRejection', `An unhanded promise rejection occurred:\n${error?.stack || error}`, false);
- client.console.channelError({
+ void client.console.error('PromiseRejection', `An unhanded promise rejection occurred:\n${error?.stack || error}`, false);
+ void client.console.channelError({
embeds: [
{
title: 'Unhandled promise rejection',
diff --git a/src/listeners/other/uncaughtException.ts b/src/listeners/other/uncaughtException.ts
index 651fefe..f1714f7 100644
--- a/src/listeners/other/uncaughtException.ts
+++ b/src/listeners/other/uncaughtException.ts
@@ -9,8 +9,8 @@ export default class UncaughtExceptionListener extends BushListener {
}
public async exec(error: Error): Promise<void> {
- client.console.error('uncaughtException', `An uncaught exception occurred:\n${error?.stack || error}`, false);
- client.console.channelError({
+ void client.console.error('uncaughtException', `An uncaught exception occurred:\n${error?.stack || error}`, false);
+ void client.console.channelError({
embeds: [
{
title: 'An uncaught exception occurred',
diff --git a/src/tasks/removeExpiredPunishements.ts b/src/tasks/removeExpiredPunishements.ts
index 0a6e417..fc3708d 100644
--- a/src/tasks/removeExpiredPunishements.ts
+++ b/src/tasks/removeExpiredPunishements.ts
@@ -22,7 +22,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask {
}
});
- client.logger.verbose(
+ void client.logger.verbose(
`removeExpiredPunishments`,
`Queried punishments, found <<${expiredEntries.length}>> expired punishments.`
);
@@ -41,7 +41,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask {
const result = await guild.unban({ user: entry.user, reason: 'Punishment expired.' });
if (['success', 'user not banned'].includes(result)) await entry.destroy();
else throw result;
- client.logger.verbose(`removeExpiredPunishments`, `Unbanned ${entry.user}.`);
+ void client.logger.verbose(`removeExpiredPunishments`, `Unbanned ${entry.user}.`);
break;
}
case ActivePunishmentType.BLOCK: {
@@ -52,7 +52,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask {
const result = await member.unmute({ reason: 'Punishment expired.' });
if (['success', 'failed to dm'].includes(result)) await entry.destroy();
else throw result;
- client.logger.verbose(`removeExpiredPunishments`, `Unmuted ${entry.user}.`);
+ void client.logger.verbose(`removeExpiredPunishments`, `Unmuted ${entry.user}.`);
break;
}
case ActivePunishmentType.ROLE: {
@@ -65,7 +65,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask {
if (['success', 'failed to dm'].includes(result)) await entry.destroy();
else throw result;
- client.logger.verbose(`removeExpiredPunishments`, `Removed a punishment role from ${entry.user}.`);
+ void client.logger.verbose(`removeExpiredPunishments`, `Removed a punishment role from ${entry.user}.`);
break;
}
}
diff --git a/src/tasks/updateCache.ts b/src/tasks/updateCache.ts
index 721b2db..9ca7926 100644
--- a/src/tasks/updateCache.ts
+++ b/src/tasks/updateCache.ts
@@ -14,7 +14,7 @@ export class UpdateCacheTask extends BushTask {
public async exec(): Promise<void> {
await UpdateCacheTask.updateGlobalCache(client);
await UpdateCacheTask.updateGuildCache(client);
- await client.logger.verbose(`UpdateCache`, `Updated cache.`);
+ void client.logger.verbose(`UpdateCache`, `Updated cache.`);
}
public static async init(client: BushClient): Promise<void> {