feat(verify): add DM msg after verification

This commit is contained in:
smyalygames 2022-10-20 18:45:38 +01:00
parent 6f694d94fb
commit 3c0472eccc

View File

@ -138,7 +138,7 @@ class VerificationJoinVCListener extends Listener {
this.container.tasks.create('verifyTimeout', { this.container.tasks.create('verifyTimeout', {
channelId: channel.id, channelId: channel.id,
userId: member.id, userId: member.id,
}, 30_000); // TODO change before production to 15 mins }, 900_000); // 15 minutes
} }
// Check how many voice channels there are // Check how many voice channels there are
@ -630,6 +630,10 @@ class VerificationJoinVCListener extends Listener {
vegCurious: boolean, vegCurious: boolean,
convinced: boolean convinced: boolean
}) { }) {
// Send a DM with when their verification is finished
await this.finishDM(user, roles)
.catch(() => console.error('Verification: Closed DMs'));
// Not vegan // Not vegan
if (!roles.vegan) { if (!roles.vegan) {
const general = this.container.client.channels.cache.get(IDs.channels.nonVegan.general) as TextChannel | undefined; const general = this.container.client.channels.cache.get(IDs.channels.nonVegan.general) as TextChannel | undefined;
@ -670,6 +674,32 @@ class VerificationJoinVCListener extends Listener {
await activist.send(activistMsg); await activist.send(activistMsg);
} }
} }
// Messages after verifying the user
private async finishDM(user: User, roles: {
vegan: boolean,
activist: boolean,
trusted: boolean,
vegCurious: boolean,
convinced: boolean
}) {
if (!roles.vegan && !roles.convinced) {
const message = 'You\'ve been verified as non-vegan!'
+ `\n\nYou can next verify on ${time(Math.round(Date.now() / 1000) + 1814400)}`;
await user.send(message);
} else if (roles.convinced) {
const message = 'You\'ve been verified as convinced!'
+ `\n\nYou can next verify on ${time(Math.round(Date.now() / 1000) + 604800)}`;
await user.send(message);
} else if (roles.vegan && !roles.activist) {
const message = 'You\'ve been verified as a vegan!'
+ `\n\nYou can next get verified on ${time(Math.round(Date.now() / 1000) + 604800)} if you would wish to have the activist role.`;
await user.send(message);
}
}
} }
export default VerificationJoinVCListener; export default VerificationJoinVCListener;