forked from Neeraj-x0/X-Asena
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbanbot.js
58 lines (56 loc) · 1.42 KB
/
banbot.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
const { command, isPrivate } = require("../../lib/");
const { parsedJid } = require("../../lib/functions");
const { banUser, unbanUser, isBanned } = require("../database/ban");
command(
{
on: "message",
fromMe: true,
dontAddCommandList: true,
},
async (message, match) => {
if (!message.isBaileys) return;
const isban = await isBanned(message.jid);
if (!isban) return;
await message.reply("_Bot is banned in this chat_");
const jid = parsedJid(message.participant);
return await message.client.groupParticipantsUpdate(
message.jid,
jid,
"remove"
);
}
);
command(
{
pattern: "banbot",
fromMe: true,
desc: "ban bot from a chat",
type: "",
},
async (message, match) => {
const chatid = message.jid;
const isban = await isBanned(chatid);
if (isban) {
return await message.sendMessage(message.jid, "Bot is already banned");
}
await banUser(chatid);
return await message.sendMessage(message.jid, "Bot banned");
}
);
command(
{
pattern: "unbanbot",
fromMe: true,
desc: "Unban bot from a chat",
type: "user",
},
async (message, match) => {
const chatid = message.jid;
const isban = await isBanned(chatid);
if (!isban) {
return await message.sendMessage(message.jid, "Bot is not banned");
}
await unbanUser(chatid);
return await message.sendMessage(message.jid, "Bot unbanned");
}
);