From e0207fdd8d5b8c4b4f7adb2f93a99ef81f841fb3 Mon Sep 17 00:00:00 2001 From: smyalygames Date: Wed, 19 Oct 2022 01:59:49 +0100 Subject: [PATCH] feat(verify): add welcome message after verify --- src/listeners/verification/joinVC.ts | 52 ++++++++++++++++++++++++++++ src/utils/devIDs.ts | 13 +++++++ src/utils/ids.ts | 13 +++++++ 3 files changed, 78 insertions(+) diff --git a/src/listeners/verification/joinVC.ts b/src/listeners/verification/joinVC.ts index 0dd6c36..872ed06 100644 --- a/src/listeners/verification/joinVC.ts +++ b/src/listeners/verification/joinVC.ts @@ -26,6 +26,7 @@ import type { VoiceState, GuildMember, Guild, + User, } from 'discord.js'; import { ButtonInteraction, @@ -517,6 +518,8 @@ class VerificationJoinVCListener extends Listener { embeds: [embed], components: [], }); + // Send welcome message after verification + await this.finishMessages(user.user, info.roles); } }); } @@ -618,6 +621,55 @@ class VerificationJoinVCListener extends Listener { } await user.roles.add(rolesAdd); } + + // Messages after verifying the user + private async finishMessages(user: User, roles: { + vegan: boolean, + activist: boolean, + trusted: boolean, + vegCurious: boolean, + convinced: boolean + }) { + // Not vegan + if (!roles.vegan) { + const general = this.container.client.channels.cache.get(IDs.channels.nonVegan.general) as TextChannel | undefined; + if (general === undefined) { + return; + } + let msg = `${user}, you have been verified! Please check <#${IDs.channels.information.roles}> ` + + `and remember to follow the <#${IDs.channels.information.conduct}> and to respect ongoing discussion and debates.`; + // Add extra info if the user got veg curious or convinced. + if (roles.vegCurious || roles.convinced) { + msg += `\n\nYou also have access to <#${IDs.channels.dietSupport.main}> for help on going vegan.`; + } + await general.send(msg); + return; + } + + // Vegan + const general = this.container.client.channels.cache.get(IDs.channels.vegan.general) as TextChannel | undefined; + if (general === undefined) { + return; + } + const msg = `Welcome ${user}! Please check out <#${IDs.channels.information.roles}> :)`; + await general.send(msg); + + // Activist role + if (roles.activist) { + const activist = this.container.client.channels.cache.get(IDs.channels.activism.activism) as TextChannel | undefined; + if (activist === undefined) { + return; + } + const activistMsg = `${user} you have been given the activist role! This means that if you'd wish to engage with non-vegans in ` + + `<#${IDs.channels.nonVegan.general}>, you should follow these rules:\n\n` + + '1. Try to move conversations with non-vegans towards veganism/animal ethics\n' + + '2. Don\'t discuss social topics while activism is happening\n' + + '3. Have evidence for claims you make. "I don\'t know" is an acceptable answer. Chances are someone here knows or you can take time to find out\n' + + '4. Don\'t advocate for baby steps towards veganism. Participation in exploitation can stop today\n' + + '5. Differences in opinion between activists should be resolved in vegan spaces, not in the chat with non-vegans'; + await activist.send(activistMsg); + } + } } export default VerificationJoinVCListener; diff --git a/src/utils/devIDs.ts b/src/utils/devIDs.ts index 9493355..772c2e9 100644 --- a/src/utils/devIDs.ts +++ b/src/utils/devIDs.ts @@ -59,15 +59,28 @@ const devIDs = { channels: { information: { news: '999431676058927247', + conduct: '999431676058927248', + roles: '999431676058927250', }, staff: { coordinators: '999431676058927254', standup: '999431676289622183', verifiers: '999431677006860411', }, + dietSupport: { + info: '999431677006860417', + introduction: '999431677325615184', + main: '999431677325615185', + }, nonVegan: { general: '999431677325615189', }, + vegan: { + general: '999431677535338575', + }, + activism: { + activism: '999431678214807604', + }, diversity: { women: '999431679053660187', lgbtqia: '999431679053660188', diff --git a/src/utils/ids.ts b/src/utils/ids.ts index 81b9eef..ec52e28 100644 --- a/src/utils/ids.ts +++ b/src/utils/ids.ts @@ -62,15 +62,28 @@ let IDs = { channels: { information: { news: '866000393259319306', + conduct: '990728521531920385', + roles: '990761562199457813', }, staff: { coordinators: '1006240682505142354', standup: '996009201237233684', verifiers: '873215538627756072', }, + dietSupport: { + info: '993891104346873888', + introduction: '993272252743286874', + main: '822665615612837918', + }, nonVegan: { general: '798967615636504657', }, + vegan: { + general: '787738272616808509', + }, + activism: { + activism: '730907954877956179', + }, diversity: { women: '938808963544285324', lgbtqia: '956224226556272670',