-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.js
30 lines (30 loc) · 1.22 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
const { Client, Intents, MessageEmbed } = require("discord.js");
const client = new Client({
intents: [Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILDS],
ws: { properties: { $browser: "Discord iOS" } }
})
require("dotenv").config()
client.once('ready', () => {
console.log(`Logged in as ${client.user.tag}!`)
client.user.setActivity(`Antiscam-Bot`, { type: 3, browser: "DISCORD IOS" })
});
client.on('messageCreate', async message => {
const array = require(`./scam.json`)
if (array.some(word => message.content.toLowerCase().includes(word))) {
message.delete()
const embed = new MessageEmbed()
.setTitle("Scam detected")
.setColor("#ff0000")
.setDescription("Please don't send any scam messages. Thank you.")
.setFooter("Antiscam-Bot by @HELLSNAKE#6851|Automatically delete messages after 1 minute")
message.channel.send({ embeds: [embed] }).then(m => { setTimeout(() => { m.delete() }, 60000) })
}
})
// anti crash
process.on("unhandledRejection", (reason, p) => {
console.log(reason, p)
})
process.on("uncaughtException", (err, origin) => {
console.log(err, origin)
})
client.login(process.env.token)