-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
60 lines (45 loc) · 1.79 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
55
56
57
58
59
60
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
]
});
const { token, prefix } = require('./config.json');
// List of forbidden words
const forbiddenWords = ['badword1', 'badword2', 'badword3'];
// Set the fake activity status
const { ActivityType } = require('discord.js')
client.once('ready', () => {
console.log('Bot is ready.');
client.user.setPresence({
activities: [{
name: 'you hit that bong.',
type: ActivityType.Watching,
status: 'online'
}],
});
});
client.on('messageCreate', async message => {
if (message.author.bot) return; // Ignore messages from bots
const content = message.content.toLowerCase();
const hasForbiddenWord = forbiddenWords.some(word => content.includes(word));
if (hasForbiddenWord) {
// Delete the message
message.delete();
// Send a warning to the user
message.channel.send("Oh dear, dearie! Please mind your language and remember, I'm just a sweet grandmother trying to keep things civil.");
// Optional: Log the moderation action
console.log(`${message.author.tag}'s message was removed for using inappropriate language.`);
}
if (message.content === `${prefix}calmdown`) {
try {
await message.channel.send("Oh dear, dearie! Please mind your language and remember, I'm just a sweet grandmother trying to keep things civil.");
await message.delete(); // Delete the user's command message
} catch (error) {
console.error('Error:', error);
}
}
});
client.login(token);