-
Notifications
You must be signed in to change notification settings - Fork 202
/
Copy pathclean.js
25 lines (22 loc) · 1.06 KB
/
clean.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
const { MessageType, GroupSettingChange, ChatModification, WAConnectionTest } = require('@adiwajshing/baileys');
const Aqua = require('../events');
const Config = require('../config');
var CLEAR_DESC = ''
if (Config.LANG == 'SI') {
CLEAR_DESC = 'කණ්ඩායමේ chat clear කරයි'
}
if (Config.LANG == 'EN') {
CLEAR_DESC = 'Clears all the messages in the commanded group'
}
async function checkImAdmin(message, user = message.client.user.jid) {
var grup = await message.client.groupMetadata(message.jid);
var sonuc = grup['participants'].map((member) => {
if (member.id.split('@')[0] === user.split('@')[0] && member.isAdmin) return true; else; return false;
});
return sonuc.includes(true);
}
Aqua.addCommand({ pattern: 'clear', fromMe: true, desc: CLEAR_DESC, dontAddCommandList: false, deleteCommand: false }, (async (message, match) => {
await message.sendMessage('```cleaning chat... 🧹```');
await message.client.modifyChat(message.jid, ChatModification.delete);
await message.sendMessage('```Chat cleared 🚮```');
}));