diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-03-13 21:25:02 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-03-13 21:25:02 -0400 |
commit | 1eaf5bc2dadd9f811685038941479192345c6494 (patch) | |
tree | 1e55ca47dd48539b1dea2123b5aa87f701e609b5 /src | |
parent | 45d1ba227e11aa4c401b45df9db7402d239fae5b (diff) | |
download | tanzanite-1eaf5bc2dadd9f811685038941479192345c6494.tar.gz tanzanite-1eaf5bc2dadd9f811685038941479192345c6494.tar.bz2 tanzanite-1eaf5bc2dadd9f811685038941479192345c6494.zip |
fix: move join log errors to guild
Diffstat (limited to 'src')
-rw-r--r-- | src/listeners/guild/guildMemberAdd.ts | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/listeners/guild/guildMemberAdd.ts b/src/listeners/guild/guildMemberAdd.ts index 262cde3..adbca0f 100644 --- a/src/listeners/guild/guildMemberAdd.ts +++ b/src/listeners/guild/guildMemberAdd.ts @@ -21,6 +21,13 @@ export default class GuildMemberAddListener extends BushListener { 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.'); + + if (!welcome.guild.me) return; + + if (!welcome.permissionsFor(welcome.guild.me).has('SendMessages')) + // eslint-disable-next-line @typescript-eslint/no-base-to-string + return welcome.guild.error('Send Welcome Message', `I do not have permission to send messages in ${welcome}.`); + const embed = new Embed() .setDescription( `${util.emojis.join} ${util.format.input( @@ -28,6 +35,7 @@ export default class GuildMemberAddListener extends BushListener { )} joined the server. There are now ${member.guild.memberCount.toLocaleString()} members.` ) .setColor(util.colors.green); + await welcome .send({ embeds: [embed] }) .then(() => @@ -37,8 +45,8 @@ export default class GuildMemberAddListener extends BushListener { ) ) .catch(() => - client.console.warn( - 'guildMemberAdd', + welcome.guild.error( + 'Welcome Message', `Failed to send message for ${util.format.inputLog(member.user.tag)} in ${util.format.inputLog(member.guild.name)}.` ) ); |