-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add handling of banned and kicked reverifications
Signed-off-by: Michal Drla <[email protected]>
- Loading branch information
Showing
4 changed files
with
220 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Listenes for kick or ban actions and adds either a kick or ban value to user status if user is verified | ||
*/ | ||
|
||
import { Client, GuildBan } from 'discord.js'; | ||
import { prisma } from '../model'; | ||
|
||
export default (client: Client) => { | ||
client.on('guildBanAdd', async (guildBan: GuildBan) => { | ||
const user = await prisma.users.findFirst({ | ||
where: { | ||
discordId: guildBan.user.id, | ||
}, | ||
}); | ||
if (user) { | ||
await prisma.users.update({ | ||
where: { | ||
id: user.id, | ||
}, | ||
data: { | ||
status: 'banned', | ||
}, | ||
}); | ||
} | ||
}); | ||
|
||
client.on('guildMemberRemove', async (member) => { | ||
const user = await prisma.users.findFirst({ | ||
where: { | ||
discordId: member.id, | ||
}, | ||
}); | ||
if (user) { | ||
await prisma.users.update({ | ||
where: { | ||
id: user.id, | ||
}, | ||
data: { | ||
status: 'removed', | ||
}, | ||
}); | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters