Skip to content

Commit

Permalink
fix(hub): disallow non server-mod users being able to join hubs
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-737 committed Sep 19, 2023
1 parent 4544a47 commit 546af3c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Scripts/hub/browse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,18 @@ export async function execute(interaction: ChatInputCommandInteraction) {
channel = response.guild.channels.cache.get(response.values[0]) as GuildTextBasedChannel;
}


if (channel?.type !== ChannelType.GuildText && !channel?.isThread()) {
await response.update(`${i.client.emotes.normal.no} Only text and thread channels are supported!`);
return;
}

if (!response.member.permissionsIn(channel).has('ManageChannels')) {
await response.update(`${i.client.emotes.normal.no} You need to have the \`Manage Channels\` permission in ${channel} to connect it to a hub!`);
return;
}

if (
(channel?.type === ChannelType.GuildText || channel?.isThread()) &&
(response.customId === 'confirm' || response.customId === 'channel_select')
) {
const channelConnected = await db.connectedList.findFirst({
Expand Down

0 comments on commit 546af3c

Please sign in to comment.