mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-18 00:33:59 +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> {
|
async canExecute(executor: User | GuildMember, channelId: string): Promise<boolean> {
|
||||||
if (!this.requirements) return false
|
if (!this.requirements) return false
|
||||||
|
|
||||||
|
const isExecutorAdmin = isAdmin(executor)
|
||||||
|
if (isExecutorAdmin) return true
|
||||||
|
|
||||||
const {
|
const {
|
||||||
adminOnly,
|
adminOnly,
|
||||||
channels,
|
channels,
|
||||||
@@ -307,7 +310,7 @@ export default class Command<
|
|||||||
const bMemReqForUsers = memberRequirementsForUsers !== 'fail'
|
const bMemReqForUsers = memberRequirementsForUsers !== 'fail'
|
||||||
|
|
||||||
const conditions = [
|
const conditions = [
|
||||||
adminOnly ? isAdmin(executor) : bDefCond,
|
adminOnly ? isExecutorAdmin : bDefCond,
|
||||||
channels ? channels.includes(channelId) : bDefCond,
|
channels ? channels.includes(channelId) : bDefCond,
|
||||||
member ? (roles ? roles.some(role => member.roles.cache.has(role)) : bDefCond) : bMemReqForUsers,
|
member ? (roles ? roles.some(role => member.roles.cache.has(role)) : bDefCond) : bMemReqForUsers,
|
||||||
member ? (permissions ? member.permissions.has(permissions) : bDefCond) : bMemReqForUsers,
|
member ? (permissions ? member.permissions.has(permissions) : bDefCond) : bMemReqForUsers,
|
||||||
|
|||||||
Reference in New Issue
Block a user