-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeow.js
43 lines (38 loc) · 1014 Bytes
/
meow.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
const Meow = async (message, client) => {
const chat = await message.getChat();
const msg = message.body;
const author = message.from;
const isGroup = chat.isGroup;
const isBot =
isGroup &&
chat.participants.find(
(chatObj) => chatObj.id.user === client.info.wid.user
);
const isBotAdmin = chat.isGroup && isBot.isAdmin;
const mentions = await message.getMentions();
const isBotMentioned = isGroup && mentions.find((chatObj) => chatObj.isMe);
const args = msg.split(" ");
const prefix = args[0].slice(0, 1);
const command = args[0].replace(prefix, "");
const value = args.slice(1);
const isValidMessage = args[0] === "!meow";
const isAdmin =
isGroup &&
chat.participants.find(
(chatObj) => chatObj.id._serialized === message.author && chatObj.isAdmin
);
return {
chat,
msg,
author,
isGroup,
isBotAdmin,
command,
value,
isAdmin,
isValidMessage,
mentions,
isBotMentioned,
};
};
exports.Meow = Meow;