Skip to content

Commit

Permalink
replace hardcoded permission via enum
Browse files Browse the repository at this point in the history
  • Loading branch information
TiltedToast committed Sep 14, 2024
1 parent ab1b5cb commit bd5274a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/commands/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ export async function updatePrefix(input: NarrowedMessage | ChatInputCommandInte
return await sendOrReply(input, "Your prefix may only be 255 characters long at most");
}

// Finds the guild's document in the database
// Updates said document with the new prefix
if (input.guild === null || input.channel instanceof PartialGroupDMChannel) {
if (input.guild === null || !input.channel?.isSendable()) {
return await sendOrReply(input, "This command can only be used in a server!");
}

Expand Down
3 changes: 1 addition & 2 deletions src/commands/emoji.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ export async function addEmoji(message: NarrowedMessage, prefix: string) {
let emoji: GuildEmoji;
let url = "";

// They haven't added the "Create Expressions" permission (1 << 43) to the enum yet, hence the magic number
if (!hasPermission(message.member, 1n << 43n)) {
if (!hasPermission(message.member, PermissionFlagsBits.CreateGuildExpressions)) {
return await message.channel.send(
'You need the "Create Expressions" permission to add emojis!'
);
Expand Down

0 comments on commit bd5274a

Please sign in to comment.