aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-15 08:03:06 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-15 08:03:06 -0400
commite5702b5fda9023cd28fc966ce0bce3d9ec432455 (patch)
tree1077ca52543f14b4a42feb2eed5ccefffe5609ac /src
parent71d66837de247c9136291842702503a5834937a6 (diff)
downloadtanzanite-e5702b5fda9023cd28fc966ce0bce3d9ec432455.tar.gz
tanzanite-e5702b5fda9023cd28fc966ce0bce3d9ec432455.tar.bz2
tanzanite-e5702b5fda9023cd28fc966ce0bce3d9ec432455.zip
better error handling
Diffstat (limited to 'src')
-rw-r--r--src/lib/extensions/discord.js/BushGuildMember.ts24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/lib/extensions/discord.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts
index a877ea6..7db31c5 100644
--- a/src/lib/extensions/discord.js/BushGuildMember.ts
+++ b/src/lib/extensions/discord.js/BushGuildMember.ts
@@ -101,7 +101,7 @@ export class BushGuildMember extends GuildMember {
content: `You have been warned in **${this.guild}** for **${options.reason || 'No reason provided'}**.${
ending ? `\n\n${ending}` : ''
}`
- }).catch(() => null);
+ }).catch(() => false);
if (!dmSuccess) return { result: 'failed to dm', caseNum: result.caseNum };
@@ -200,7 +200,10 @@ export class BushGuildMember extends GuildMember {
// add role
const muteSuccess = await this.roles
.add(muteRole, `[Mute] ${moderator.tag} | ${options.reason || 'No reason provided.'}`)
- .catch(() => null);
+ .catch(async (e) => {
+ await client.console.warn('muteRoleAddError', e?.stack || e);
+ return false;
+ });
if (!muteSuccess) return 'error giving mute role';
// add modlog entry
@@ -232,7 +235,7 @@ export class BushGuildMember extends GuildMember {
content: `You have been muted ${
options.duration ? 'for ' + util.humanizeDuration(options.duration) : 'permanently'
} in **${this.guild}** for **${options.reason || 'No reason provided'}**.${ending ? `\n\n${ending}` : ''}`
- });
+ }).catch(() => false);
if (!dmSuccess) return 'failed to dm';
@@ -253,7 +256,10 @@ export class BushGuildMember extends GuildMember {
//remove role
const muteSuccess = await this.roles
.remove(muteRole, `[Unmute] ${moderator.tag} | ${options.reason || 'No reason provided.'}`)
- .catch(() => null);
+ .catch(async (e) => {
+ await client.console.warn('muteRoleAddError', e?.stack || e);
+ return false;
+ });
if (!muteSuccess) return 'error removing mute role';
//remove modlog entry
@@ -279,7 +285,7 @@ export class BushGuildMember extends GuildMember {
//dm user
const dmSuccess = await this.send({
content: `You have been unmuted in **${this.guild}** because **${options.reason || 'No reason provided'}**.`
- }).catch(() => null);
+ }).catch(() => false);
if (!dmSuccess) return 'failed to dm';
@@ -298,10 +304,10 @@ export class BushGuildMember extends GuildMember {
content: `You have been kicked from **${this.guild}** for **${options.reason || 'No reason provided'}**.${
ending ? `\n\n${ending}` : ''
}`
- }).catch(() => null);
+ }).catch(() => false);
// kick
- const kickSuccess = await this.kick(`${moderator.tag} | ${options.reason || 'No reason provided.'}`).catch(() => null);
+ const kickSuccess = await this.kick(`${moderator.tag} | ${options.reason || 'No reason provided.'}`).catch(() => false);
if (!kickSuccess) return 'error kicking';
// add modlog entry
@@ -331,13 +337,13 @@ export class BushGuildMember extends GuildMember {
content: `You have been banned ${
options.duration ? 'for ' + util.humanizeDuration(options.duration) : 'permanently'
} from **${this.guild}** for **${options.reason || 'No reason provided'}**.${ending ? `\n\n${ending}` : ''}`
- }).catch(() => null);
+ }).catch(() => false);
// ban
const banSuccess = await this.ban({
reason: `${moderator.tag} | ${options.reason || 'No reason provided.'}`,
days: options.deleteDays
- });
+ }).catch(() => false);
if (!banSuccess) return 'error banning';
// add modlog entry