aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord.js
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-30 19:42:10 +0000
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-30 19:42:10 +0000
commitbada2976eed34a2530bc09683d2de17c71c744a8 (patch)
treefe459cebb005dd90d1ae7ed3269a77248f780499 /src/lib/extensions/discord.js
parentaaef32128f8c8c30254836932805d0745647c646 (diff)
downloadtanzanite-bada2976eed34a2530bc09683d2de17c71c744a8.tar.gz
tanzanite-bada2976eed34a2530bc09683d2de17c71c744a8.tar.bz2
tanzanite-bada2976eed34a2530bc09683d2de17c71c744a8.zip
some fixes + some more error stuff
Diffstat (limited to 'src/lib/extensions/discord.js')
-rw-r--r--src/lib/extensions/discord.js/BushGuild.ts28
-rw-r--r--src/lib/extensions/discord.js/BushGuildMember.ts24
2 files changed, 24 insertions, 28 deletions
diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts
index 2c3b4bd..09e355c 100644
--- a/src/lib/extensions/discord.js/BushGuild.ts
+++ b/src/lib/extensions/discord.js/BushGuild.ts
@@ -84,25 +84,21 @@ export class BushGuild extends Guild {
if (!unbanSuccess) return 'error unbanning';
// add modlog entry
- const modlog = await util
- .createModLogEntry({
- type: ModLogType.UNBAN,
- user,
- moderator: moderator.id,
- reason: options.reason,
- guild: this
- })
- .catch(() => null);
+ const modlog = await util.createModLogEntry({
+ type: ModLogType.UNBAN,
+ user,
+ moderator: moderator.id,
+ reason: options.reason,
+ guild: this
+ });
if (!modlog) return 'error creating modlog entry';
// remove punishment entry
- const removePunishmentEntrySuccess = await util
- .removePunishmentEntry({
- type: 'ban',
- user,
- guild: this
- })
- .catch(() => null);
+ const removePunishmentEntrySuccess = await util.removePunishmentEntry({
+ type: 'ban',
+ user,
+ guild: this
+ });
if (!removePunishmentEntrySuccess) return 'error removing ban entry';
const userObject = client.users.cache.get(user);
diff --git a/src/lib/extensions/discord.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts
index e738b5e..f71a435 100644
--- a/src/lib/extensions/discord.js/BushGuildMember.ts
+++ b/src/lib/extensions/discord.js/BushGuildMember.ts
@@ -132,9 +132,10 @@ export class BushGuildMember extends GuildMember {
})
: { log: null };
- if (!modlog) return 'error creating modlog entry';
+ if (!modlog && options.addToModlog) return 'error creating modlog entry';
- if (options.addToModlog) {
+ if (options.addToModlog || options.duration) {
+ client.console.debug('got to punishment');
const punishmentEntrySuccess = await util.createPunishmentEntry({
type: 'role',
user: this,
@@ -212,7 +213,8 @@ export class BushGuildMember extends GuildMember {
const muteSuccess = await this.roles
.add(muteRole, `[Mute] ${moderator.tag} | ${options.reason ?? 'No reason provided.'}`)
.catch(async (e) => {
- await client.console.warn('muteRoleAddError', e?.stack || e);
+ await client.console.warn('muteRoleAddError', e);
+ client.console.debug(e);
return false;
});
if (!muteSuccess) return 'error giving mute role';
@@ -322,15 +324,13 @@ export class BushGuildMember extends GuildMember {
if (!kickSuccess) return 'error kicking';
// add modlog entry
- const { log: modlog } = await util
- .createModLogEntry({
- type: ModLogType.KICK,
- user: this,
- moderator: moderator.id,
- reason: options.reason,
- guild: this.guild
- })
- .catch(() => ({ log: null }));
+ const { log: modlog } = await util.createModLogEntry({
+ type: ModLogType.KICK,
+ user: this,
+ moderator: moderator.id,
+ reason: options.reason,
+ guild: this.guild
+ });
if (!modlog) return 'error creating modlog entry';
if (!dmSuccess) return 'failed to dm';
return 'success';