This repository has been archived by the owner on Oct 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
52 lines (42 loc) · 2.45 KB
/
index.js
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
51
52
const Discord = require('discord.js');
const { prefix, token } = require('./config.json');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready')
client.user.setActivity("!help", {
//STREAMING,WATCHING,LISTENING,PLAYING
type: "STREAMING",
//Only for streaming ↓
url: "https://www.twitch.tv/user"
});
})
client.on('message', message => {
//If you want to log every message from every server, remove the // below
//console.log(message.content);
//prefix you set in config.json ↓
if (message.content.startsWith(`${prefix}test`))
message.channel.send("This test works")
//ban
if (message.content.startsWith(`${prefix}ban`)) {
if (!message.guild.member(message.author).hasPermission('BAN_MEMBERS')) { return message.channel.send('You do not have permission to ban users!'); }
if (!message.guild.member(client.user).hasPermission('BAN_MEMBERS')) { return message.channel.send('I don\'t have the permission for ban users!'); }
if (message.mentions.users.size === 0) { return message.channel.send('You need to mention a user!'); }
let banMember = message.guild.member(message.mentions.users.first());
if (!banMember) { return message.channel.send('User not found!'); }
banMember.ban().then((member) => {
message.channel.send(member.displayName + " has been successfully kicked from the server.");
})
}
//kick
if (message.content.startsWith(`${prefix}kick`)) {
if (!message.guild.member(message.author).hasPermission('KICK_MEMBERS')) { return message.channel.send('You do not have permission to kick users!'); }
if (!message.guild.member(client.user).hasPermission('KICK_MEMBERS')) { return message.channel.send('I don\'t have the permission for kick users!'); }
if (message.mentions.users.size === 0) { return message.channel.send('You need to mention a user!'); }
let kickMember = message.guild.member(message.mentions.users.first());
if (!kickMember) { return message.channel.send('User not found!'); }
kickMember.kick().then((member) => {
message.channel.send(member.displayName + " has been successfully kicked from the server.");
})
}
})
client.login(token);