-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.js
More file actions
47 lines (34 loc) · 2.28 KB
/
Copy pathcode.js
File metadata and controls
47 lines (34 loc) · 2.28 KB
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
const client = //new Client() حط الكلاينت بتاعك
const db = require('pro.db') // npm i pro.db
const whiteListServers = ["id"] // السيرفرات المسموح لها حتى ولو واخده بلاك ليست
const developers = ["621296906357964810"] // حط ايدي اليوزرات المسموح لها باعطاء بلاك ليست
const prefix = "!" // البريفيكس
client.isGuildAllowed = async (src) => {
if (!src || !src.guild?.id) throw new Error('Provide The src !');
const blackListedServers = await db.get('blackListedServers') || []
if (!whiteListServers.includes(src.guild?.id) && blackListedServers.includes(src.guild?.id)) return false;
return true;
}
client.on('messageCreate', async (message) => {
if (!message.content.toLowerCase().startsWith(prefix + "blacklist") || !developers.includes(message.author.id)) return;
const args = message.content.split(' ')
if (!args[1] || !args[2]) return message.reply(`> **مثال للاستخدام:**\n \`${args[0]} add ${message.guild.id}\``);
const st = args[1].toLowerCase()
const guildID = args[2]
const targetGuild = message.client.guilds.cache.get(guildID)
if (!targetGuild) return message.reply(`> **خطأ: لم يتم العثور علي هذا الخادم**`)
const blackListedServers = await db.get('blackListedServers') || []
const theServerInDB = blackListedServers.find(bl => bl === guildID)
if (st === "add") {
if (theServerInDB) return message.reply(`> **الخادم \`${targetGuild.name}\` تم اضافته للقائمة السوداء من قبل !**`);
blackListedServers.push(guildID)
message.reply(`> **تم اضافه الخادم ${targetGuild.name} الي القائمة السوداء بنجاح**`)
} else if (st === "remove") {
if (!theServerInDB) return message.reply(`> **هذا الخادم ليس ضمن الخوادم بالقائمة السوداء !**`);
blackListedServers.splice(blackListedServers.indexOf(theServerInDB),1)
message.reply(`> **تم ازالة الخادم ${targetGuild.name} من القائمة السوداء بنجاح**`)
} else {
return message.reply(`> **خطأ: يجب ان تكون قيمة \`${st}\` اما \`add\` او \`remove\`**`)
}
db.set('blackListedServers',blackListedServers)
})