mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-27 21:21:03 +00:00
fix(discord-bot): check if the member has the role
This commit is contained in:
@@ -1,18 +1,30 @@
|
||||
export default {
|
||||
name: 'callback_query',
|
||||
once: false,
|
||||
async execute(cb) {
|
||||
const admins = await global.bot.getChatAdministrators(cb.message.chat.id);
|
||||
const isAdmin = admins.find(admin => admin.user.id === cb.message.from.id);
|
||||
name: 'callback_query',
|
||||
once: false,
|
||||
async execute(cb) {
|
||||
const admins = await global.bot.getChatAdministrators(cb.message.chat.id);
|
||||
const isAdmin = admins.find(
|
||||
(admin) => admin.user.id === cb.message.from.id
|
||||
);
|
||||
|
||||
if (!isAdmin) return global.bot.sendMessage(cb.message.chat.id, 'You\'re not an admin.', {
|
||||
message_thread_id: cb.message.message_thread_id, reply_to_message_id: cb.message.message_id
|
||||
});;
|
||||
if (!isAdmin)
|
||||
return global.bot.sendMessage(
|
||||
cb.message.chat.id,
|
||||
'You\'re not an admin.',
|
||||
{
|
||||
message_thread_id: cb.message.message_thread_id,
|
||||
reply_to_message_id: cb.message.message_id
|
||||
}
|
||||
);
|
||||
|
||||
global.helper.sendTrainData(cb.message.reply_to_message.text.toLowerCase(), cb.data.replace('label_', '').toUpperCase());
|
||||
global.helper.sendTrainData(
|
||||
cb.message.reply_to_message.text.toLowerCase(),
|
||||
cb.data.replace('label_', '').toUpperCase()
|
||||
);
|
||||
|
||||
global.bot.sendMessage(cb.message.chat.id, 'Sent train data to server.', {
|
||||
message_thread_id: cb.message.message_thread_id, reply_to_message_id: cb.message.message_id
|
||||
});
|
||||
}
|
||||
}
|
||||
global.bot.sendMessage(cb.message.chat.id, 'Sent train data to server.', {
|
||||
message_thread_id: cb.message.message_thread_id,
|
||||
reply_to_message_id: cb.message.message_id
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user