aboutsummaryrefslogtreecommitdiff
path: root/src/listeners/guild
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-04 12:39:08 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-04 12:39:08 -0400
commitbb774bbe0cfedd77be852f73448df061252b7c0a (patch)
tree579c2f11717dd5aa3a0d6ea990479368b338cd66 /src/listeners/guild
parent939f19c1a8a7efea00fc3df3504a41fc58a3b286 (diff)
downloadtanzanite-bb774bbe0cfedd77be852f73448df061252b7c0a.tar.gz
tanzanite-bb774bbe0cfedd77be852f73448df061252b7c0a.tar.bz2
tanzanite-bb774bbe0cfedd77be852f73448df061252b7c0a.zip
I sure do love when one line causes 400 errors
Diffstat (limited to 'src/listeners/guild')
-rw-r--r--src/listeners/guild/guildMemberAdd.ts32
-rw-r--r--src/listeners/guild/guildMemberRemove.ts8
2 files changed, 15 insertions, 25 deletions
diff --git a/src/listeners/guild/guildMemberAdd.ts b/src/listeners/guild/guildMemberAdd.ts
index ca10cd7..631eb5d 100644
--- a/src/listeners/guild/guildMemberAdd.ts
+++ b/src/listeners/guild/guildMemberAdd.ts
@@ -20,26 +20,23 @@ export default class GuildMemberAddListener extends BushListener {
if (client.config.isDevelopment) return;
const welcomeChannel = await member.guild.getSetting('welcomeChannel');
if (!welcomeChannel) return;
- const welcome = this.client.channels.cache.get(welcomeChannel) as BushTextChannel | undefined;
+ const welcome = client.channels.cache.get(welcomeChannel) as BushTextChannel | undefined;
if (!welcome) return;
if (member.guild.id !== welcome?.guild.id) throw new Error('Welcome channel must be in the guild.');
const embed = new MessageEmbed()
.setDescription(
- `${this.client.util.emojis.join} **${Util.escapeMarkdown(
+ `${util.emojis.join} **${Util.escapeMarkdown(
member.user.tag
)}** joined the server. There are now ${member.guild.memberCount.toLocaleString()} members.`
)
- .setColor(this.client.util.colors.green);
+ .setColor(util.colors.green);
await welcome
.send({ embeds: [embed] })
.then(() =>
- this.client.console.info('guildMemberAdd', `Sent a message for <<${member.user.tag}>> in <<${member.guild.name}>>.`)
+ client.console.info('guildMemberAdd', `Sent a message for <<${member.user.tag}>> in <<${member.guild.name}>>.`)
)
.catch(() =>
- this.client.console.warn(
- 'guildMemberAdd',
- `Failed to send message for <<${member.user.tag}>> in <<${member.guild.name}>>.`
- )
+ client.console.warn('guildMemberAdd', `Failed to send message for <<${member.user.tag}>> in <<${member.guild.name}>>.`)
);
}
@@ -63,11 +60,10 @@ export default class GuildMemberAddListener extends BushListener {
const addedRoles = await member.roles
.add(rolesArray, "Returning member's previous roles.")
.catch(
- () =>
- void this.client.console.warn('guildMemberAdd', `There was an error returning <<${member.user.tag}>>'s roles.`)
+ () => void client.console.warn('guildMemberAdd', `There was an error returning <<${member.user.tag}>>'s roles.`)
);
if (addedRoles) {
- void this.client.console.info(
+ void client.console.info(
'guildMemberAdd',
`Assigned sticky roles to <<${member.user.tag}>> in <<${member.guild.name}>>.`
);
@@ -79,12 +75,9 @@ export default class GuildMemberAddListener extends BushListener {
.catch(() => failedRoles.push(rolesArray[i]));
}
if (failedRoles.length) {
- void this.client.console.warn(
- 'guildMemberAdd',
- `Failed assigning the following roles on Fallback:${failedRoles}`
- );
+ void client.console.warn('guildMemberAdd', `Failed assigning the following roles on Fallback:${failedRoles}`);
} else {
- void this.client.console.info(
+ void client.console.info(
'guildMemberAdd',
`[Fallback] Assigned sticky roles to <<${member.user.tag}>> in <<${member.guild.name}>>.`
);
@@ -98,14 +91,11 @@ export default class GuildMemberAddListener extends BushListener {
await member.roles
.add(joinRoles, 'Join roles.')
.then(() =>
- this.client.console.info(
- 'guildMemberAdd',
- `Assigned join roles to <<${member.user.tag}>> in <<${member.guild.name}>>.`
- )
+ client.console.info('guildMemberAdd', `Assigned join roles to <<${member.user.tag}>> in <<${member.guild.name}>>.`)
)
.catch(
() =>
- void this.client.console.warn(
+ void client.console.warn(
'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 f72f061..74404a3 100644
--- a/src/listeners/guild/guildMemberRemove.ts
+++ b/src/listeners/guild/guildMemberRemove.ts
@@ -23,11 +23,11 @@ export default class GuildMemberRemoveListener extends BushListener {
const isBan = member.guild.bans.cache.has(member.id);
const welcomeChannel = await member.guild.getSetting('welcomeChannel');
if (!welcomeChannel) return;
- const welcome = this.client.channels.cache.get(welcomeChannel) as BushTextChannel | undefined;
+ const welcome = client.channels.cache.get(welcomeChannel) as BushTextChannel | undefined;
if (member.guild.id !== welcome?.guild.id) throw new Error('Welcome channel must be in the guild.');
const embed: MessageEmbed = new MessageEmbed()
.setDescription(
- `${this.client.util.emojis.leave} **${Util.escapeBold(user.tag)}** ${
+ `${util.emojis.leave} **${Util.escapeBold(user.tag)}** ${
isBan ? 'banned from' : 'left'
} the server. There are now ${welcome.guild.memberCount.toLocaleString()} members.`
)
@@ -36,7 +36,7 @@ export default class GuildMemberRemoveListener extends BushListener {
.send({ embeds: [embed] })
.then(() => client.console.info('guildMemberRemove', `Sent a message for <<${user.tag}>> in <<${member.guild.name}>>.`))
.catch(() =>
- this.client.console.warn('guildMemberRemove', `Failed to send message for <<${user.tag}>> in <<${member.guild.name}>>.`)
+ client.console.warn('guildMemberRemove', `Failed to send message for <<${user.tag}>> in <<${member.guild.name}>>.`)
);
}
@@ -62,7 +62,7 @@ export default class GuildMemberRemoveListener extends BushListener {
await row
.save()
.then(() =>
- this.client.console.info('guildMemberRemove', `${isNew ? 'Created' : 'Updated'} info for <<${member.user.tag}>>.`)
+ client.console.info('guildMemberRemove', `${isNew ? 'Created' : 'Updated'} info for <<${member.user.tag}>>.`)
);
}
}