-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.js
54 lines (46 loc) · 1.33 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
53
54
const { Client } = require("discord.js");
require("dotenv").config();
// Declares our bot,
// the disableEveryone prevents the client to ping @everyone
const client = new Client({
disableEveryone: true,
});
config({
path: __dirname + "/.env",
});
// When the bot's online, what's in these brackets will be executed
client.on("ready", () => {
// Set the user presence
client.user.setPresence({
status: "online",
game: {
name: "me getting developed",
type: "WATCHING",
},
});
});
client.on("message", async (message) => {
if (message.author.bot && !(message.author.username == "Manager")) return;
if (!message.guild) return;
let channel = client.channels.cache.get("ENTER_CHANNEL_ID_HERE");
if (message.author.username == "Manager" && message.author.bot) {
if (message.content == "/muteAll") {
for (let member of channel.members) {
await member[1].voice.setMute(true);
}
await message.channel.send(
"Sssshhhhhhhhhh ! Users muted by the Moderator !"
);
}
if (message.content == "/unmuteAll") {
for (let member of channel.members) {
await member[1].voice.setMute(false);
}
await message.channel.send(
"Discuss!!!!! Users unmuted by the Moderator !"
);
}
}
});
// Login the bot
client.login(process.env.DISCORD_TOKEN);