mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-30 06:31:02 +00:00
feat(bots/discord)!: add admin config
This commit is contained in:
@@ -12,7 +12,7 @@ export default {
|
||||
.setDMPermission(true)
|
||||
.toJSON(),
|
||||
|
||||
ownerOnly: true,
|
||||
adminOnly: true,
|
||||
global: true,
|
||||
|
||||
async execute(_, interaction) {
|
||||
|
||||
@@ -25,7 +25,7 @@ export default {
|
||||
.setDMPermission(true)
|
||||
.toJSON(),
|
||||
|
||||
ownerOnly: true,
|
||||
adminOnly: true,
|
||||
global: true,
|
||||
|
||||
async execute(_, interaction) {
|
||||
|
||||
@@ -11,7 +11,7 @@ export default {
|
||||
.setDMPermission(true)
|
||||
.toJSON(),
|
||||
|
||||
ownerOnly: true,
|
||||
adminOnly: true,
|
||||
global: true,
|
||||
|
||||
async execute({ api, logger }, interaction) {
|
||||
|
||||
@@ -24,7 +24,7 @@ export default {
|
||||
|
||||
global: false,
|
||||
|
||||
async execute({ logger }, interaction, { userIsOwner }) {
|
||||
async execute({ logger }, interaction, { isExecutorBotAdmin: isExecutorAdmin }) {
|
||||
const user = interaction.options.getUser('member', true)
|
||||
const reason = interaction.options.getString('reason') ?? 'No reason provided'
|
||||
const duration = interaction.options.getString('duration')
|
||||
@@ -48,7 +48,7 @@ export default {
|
||||
if (!member.manageable)
|
||||
throw new CommandError(CommandErrorType.Generic, 'This user cannot be managed by the bot.')
|
||||
|
||||
if (moderator.roles.highest.comparePositionTo(member.roles.highest) <= 0 && !userIsOwner)
|
||||
if (moderator.roles.highest.comparePositionTo(member.roles.highest) <= 0 && !isExecutorAdmin)
|
||||
throw new CommandError(
|
||||
CommandErrorType.InvalidUser,
|
||||
'You cannot mute a user with a role equal to or higher than yours.',
|
||||
|
||||
@@ -35,7 +35,7 @@ export default {
|
||||
|
||||
global: false,
|
||||
|
||||
async execute({ logger }, interaction, { userIsOwner }) {
|
||||
async execute({ logger }, interaction, { isExecutorBotAdmin: isExecutorAdmin }) {
|
||||
const action = interaction.options.getString('action', true) as 'apply' | 'remove'
|
||||
const user = interaction.options.getUser('member', true)
|
||||
const preset = interaction.options.getString('preset', true)
|
||||
@@ -61,7 +61,7 @@ export default {
|
||||
'The duration must be at least 1 millisecond long.',
|
||||
)
|
||||
|
||||
if (moderator.roles.highest.comparePositionTo(member.roles.highest) <= 0 && !userIsOwner)
|
||||
if (moderator.roles.highest.comparePositionTo(member.roles.highest) <= 0 && !isExecutorAdmin)
|
||||
throw new CommandError(
|
||||
CommandErrorType.InvalidUser,
|
||||
'You cannot apply a role preset to a user with a role equal to or higher than yours.',
|
||||
|
||||
@@ -39,10 +39,10 @@ export type Command = {
|
||||
roles?: string[]
|
||||
}
|
||||
/**
|
||||
* Whether this command can only be used by bot owners.
|
||||
* Whether this command can only be used by bot admins.
|
||||
* @default false
|
||||
*/
|
||||
ownerOnly?: boolean
|
||||
adminOnly?: boolean
|
||||
/**
|
||||
* Whether to register this command as a global slash command.
|
||||
* This is set to `false` and commands will be registered in allowed guilds only by default.
|
||||
@@ -52,5 +52,5 @@ export type Command = {
|
||||
}
|
||||
|
||||
export interface Info {
|
||||
userIsOwner: boolean
|
||||
isExecutorBotAdmin: boolean
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user