Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const messageKV = new pylon.KVNamespace('messages');
- discord.on('MESSAGE_CREATE', async (msg) => {
- const timestamp: number | undefined = await messageKV.get(msg.author!.id);
- const key = channelBurstCount;
- const prevCount = await messageKV.get<number>(key);
- await messageKV.cas(key, prevCount, (prevCount || 0) + 1, 5000);
- if (prevCount > 4) {
- msg.reply(
- **${msg.author?.username}** if you don't stop **spamming**, you will be **kicked!!!**
- );
- }
- if (prevCount > 7) {
- msg.reply(
- **${msg.author?.username}** has been kicked from the server because they were spamming. Goodbye!
- );
- msg.member!.kick();
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement