Skip to content
This repository was archived by the owner on Sep 25, 2024. It is now read-only.

Commit 54fc812

Browse files
committed
Check if the member exists in the chat box before kicking it out of the chat box
1 parent cbc07ae commit 54fc812

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

scripts/cmds/ban.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const moment = require("moment-timezone");
44
module.exports = {
55
config: {
66
name: "ban",
7-
version: "1.3",
7+
version: "1.4",
88
author: "NTKhang",
99
countDown: 5,
1010
role: 1,
@@ -161,9 +161,11 @@ module.exports = {
161161
await threadsData.set(event.threadID, dataBanned, 'data.banned_ban');
162162
message.reply(getLang('bannedSuccess', name), () => {
163163
if (members.some(item => item.userID == target)) {
164-
if (adminIDs.includes(api.getCurrentUserID()))
165-
api.removeUserFromGroup(target, event.threadID);
166-
else
164+
if (adminIDs.includes(api.getCurrentUserID())) {
165+
if (event.participantIDs.includes(target))
166+
api.removeUserFromGroup(target, event.threadID);
167+
}
168+
else {
167169
message.send(getLang('needAdmin'), (err, info) => {
168170
global.GoatBot.onEvent.push({
169171
messageID: info.messageID,
@@ -177,6 +179,7 @@ module.exports = {
177179
}
178180
});
179181
});
182+
}
180183
}
181184
});
182185
},

0 commit comments

Comments
 (0)