Skip to content

Commit

Permalink
fix(hub leave): check user's
Browse files Browse the repository at this point in the history
guild permissions instead
  • Loading branch information
dev-737 committed Nov 19, 2023
1 parent dcef1d5 commit bb1fc12
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/commands/slash/Main/hub/leave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ export default class Leave extends Hub {
});
}

// check if user has manage channels permission
const channel = await interaction.guild?.channels.fetch(channelId);
if (!channel?.permissionsFor(interaction.user.id)?.has('ManageChannels')) {
if (interaction.inCachedGuild() && interaction.member.permissions.has('ManageChannels')) {
return await interaction.reply({
embeds: [
errorEmbed(
`${emojis.no} You do not have the \`Manage Channels\` permission in ${channel}.`,
`${emojis.no} You must have the \`Manage Channels\` permission in this server to leave a hub.`,
),
],
ephemeral: true,
Expand Down

0 comments on commit bb1fc12

Please sign in to comment.