-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmoderation.ts
50 lines (32 loc) · 1.16 KB
/
moderation.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { Client } from 'revolt.io';
const client = new Client({
fetchMembers: true,
});
const prefix = '!';
client.on('ready', () => {
console.log('Ready!');
});
client.on('message', async (msg) => {
if (!msg.channel.inServer() || msg.author.bot) return;
if (!msg.content.startsWith(prefix)) return;
const [command, ...args] = msg.content.slice(prefix.length).trim().split(/ /);
if (command === 'kick') {
const member = msg.mentions.members.first();
if (!member) return msg.reply('Please mention someone first.');
await member.kick();
msg.reply(`**${member.user.username}** has been kicked`);
}
if (command === 'ban') {
const member = msg.mentions.members.first();
if (!member) return msg.reply('Please mention someone first.');
await member.ban();
msg.reply(`**${member.user.username}** has been banned`);
}
if (command === 'warn') {
const member = msg.mentions.members.first();
if (!member) return msg.reply('Please mention someone first.');
const reason = args.join(' ') || 'No reason';
msg.channel.send(`${member}, You have been warned for **${reason}**`);
}
});
client.login('revolt-token-here');