Skip to content

Commit b519b56

Browse files
committed
fix(bots/discord): require roles for using utility commands
1 parent cafdbc0 commit b519b56

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

bots/discord/config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ export default {
3535
thread: 'THREAD_ID_HERE',
3636
},
3737
},
38+
utilities: {
39+
roles: ['ROLE_ID_HERE'],
40+
},
3841
rolePresets: {
3942
guilds: {
4043
GUILD_ID_HERE: {

bots/discord/config.schema.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ export type Config = {
1919
thread?: string
2020
}
2121
}
22+
utilities?: {
23+
roles?: string[]
24+
}
2225
rolePresets?: {
2326
checkExpiredEvery: number
2427
guilds: Record<string, Record<string, RolePresetConfig>>

bots/discord/src/commands/utility/remind.ts renamed to bots/discord/src/commands/utilities/remind.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { EmbedBuilder, MessageFlags } from 'discord.js'
22
import { eq } from 'drizzle-orm'
33
import Command from '$/classes/Command'
4-
import { database } from '$/context'
4+
import { config, database } from '$/context'
55
import { reminders } from '$/database/schemas'
66
import { applyCommonEmbedStyles } from '$/utils/discord/embeds'
77
import { durationToString, parseDuration } from '$/utils/duration'
@@ -15,7 +15,7 @@ export default new Command({
1515
description: 'Set a reminder or list your reminders',
1616
type: Command.Type.ChatGuild,
1717
requirements: {
18-
defaultCondition: 'pass',
18+
roles: config.utilities?.roles,
1919
},
2020
options: {
2121
message: {

bots/discord/src/commands/utility/unremind.ts renamed to bots/discord/src/commands/utilities/unremind.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { EmbedBuilder, MessageFlags } from 'discord.js'
22
import { eq } from 'drizzle-orm'
33
import Command from '$/classes/Command'
44
import CommandError, { CommandErrorType } from '$/classes/CommandError'
5-
import { database } from '$/context'
5+
import { config, database } from '$/context'
66
import { reminders } from '$/database/schemas'
77
import { applyCommonEmbedStyles } from '$/utils/discord/embeds'
88

@@ -11,7 +11,7 @@ export default new Command({
1111
description: 'Remove a reminder',
1212
type: Command.Type.ChatGuild,
1313
requirements: {
14-
defaultCondition: 'pass',
14+
roles: config.utilities?.roles,
1515
},
1616
options: {
1717
id: {

0 commit comments

Comments
 (0)