-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
43 lines (36 loc) · 1.05 KB
/
script.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
const { Client, GatewayIntentBits, Events } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
});
client.on(Events.ClientReady, () => {
console.log(`${client.user?.username ?? `Unknown`}が起動しました!`);
});
client.on(Events.MessageCreate, async (message) => {
if (message.author.bot){
return;
};
if (!message.content.startsWith("!allkick")){
return;
};
const members = await message.guild.members.fetch();
members.forEach(async member => {
if (member.user.bot){
return;
};
if (member.user.id === client.user.id){
return;
};
try {
await member.kick();
console.log(`${member.user.displayName}をキックしました.`);
} catch (error){
console.log("エラーが発生しました!");
}
})
});
client.login("");