mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
feat(bots/discord): allow admins to bypass permission checks
This commit is contained in:
@@ -291,6 +291,9 @@ export default class Command<
|
||||
async canExecute(executor: User | GuildMember, channelId: string): Promise<boolean> {
|
||||
if (!this.requirements) return false
|
||||
|
||||
const isExecutorAdmin = isAdmin(executor)
|
||||
if (isExecutorAdmin) return true
|
||||
|
||||
const {
|
||||
adminOnly,
|
||||
channels,
|
||||
@@ -307,7 +310,7 @@ export default class Command<
|
||||
const bMemReqForUsers = memberRequirementsForUsers !== 'fail'
|
||||
|
||||
const conditions = [
|
||||
adminOnly ? isAdmin(executor) : bDefCond,
|
||||
adminOnly ? isExecutorAdmin : bDefCond,
|
||||
channels ? channels.includes(channelId) : bDefCond,
|
||||
member ? (roles ? roles.some(role => member.roles.cache.has(role)) : bDefCond) : bMemReqForUsers,
|
||||
member ? (permissions ? member.permissions.has(permissions) : bDefCond) : bMemReqForUsers,
|
||||
|
||||
Reference in New Issue
Block a user