diff --git a/src/Scripts/hub/join.ts b/src/Scripts/hub/join.ts index 17331118..ee3e71f3 100644 --- a/src/Scripts/hub/join.ts +++ b/src/Scripts/hub/join.ts @@ -16,13 +16,6 @@ export default { const channel = interaction.options.getChannel('channel', true, [ChannelType.GuildText, ChannelType.PublicThread, ChannelType.PrivateThread]); let hubExists; - if (!interaction.guild.members.me?.permissionsIn(channel).has(['ManageWebhooks'])) { - return await interaction.reply({ - content: `${emojis.normal.no} I need to have the \`Manage Webhooks\` permission in ${channel} to connect it to a hub!`, - ephemeral: true, - }); - } - if (!interaction.member.permissionsIn(channel).has(['ManageChannels'])) { return await interaction.reply({ content: `${emojis.normal.no} You need to have the \`Manage Channels\` permission in ${channel} to connect it to a hub!`, @@ -114,7 +107,15 @@ export default { if (!await onboarding.execute(interaction, hubExists.name, channel.id)) return interaction.deleteReply().catch(() => null); - const created = await createConnection.execute(interaction, hubExists, channel); - if (created) await displaySettings.execute(interaction, created.channelId); + const created = await createConnection.execute(interaction, hubExists, channel).catch(() => null); + if (!created) { + return await interaction.reply({ + content: `${emojis.normal.no} An error occured while connecting this channel to the hub! Please make sure I have the [required permissions](https://discord-interchat.github.io/docs/#adding-interchat-to-your-server) and try again.`, + ephemeral: true, + }); + } + else { + await displaySettings.execute(interaction, created.channelId); + } }, }; \ No newline at end of file diff --git a/src/Scripts/network/createConnection.ts b/src/Scripts/network/createConnection.ts index 05b03b12..2ee66426 100644 --- a/src/Scripts/network/createConnection.ts +++ b/src/Scripts/network/createConnection.ts @@ -63,7 +63,7 @@ export default { return existingWebhook; } - return channelOrParent?.createWebhook({ + return await channelOrParent?.createWebhook({ name: 'InterChat Network', avatar, });