add missing permission warning to bridge setup

This commit is contained in:
janderedev 2022-04-30 22:38:16 +02:00
parent 755609901c
commit b65a1bd70c
Signed by: Lea
GPG key ID: 5D5E18ACB990F57A
2 changed files with 19 additions and 5 deletions

View file

@ -31,11 +31,21 @@ export default {
expires: Date.now() + (1000 * 60 * 15),
});
await message.reply(`### Link request created.\n`
+ `Request ID: \`${reqId}\`\n\n`
+ `[Invite the bridge bot to your Discord server](<${DISCORD_INVITE_URL}>) `
+ `and run \`/bridge confirm ${reqId}\` in the channel you wish to link.\n`
+ `This request expires in 15 minutes.`);
let text = `### Link request created.\n` +
`Request ID: \`${reqId}\`\n\n` +
`[Invite the bridge bot to your Discord server](<${DISCORD_INVITE_URL}>) ` +
`and run \`/bridge confirm ${reqId}\` in the channel you wish to link.\n` +
`This request expires in 15 minutes.`;
if (!message.channel!.havePermission('Masquerade')
|| !message.channel!.havePermission('SendEmbeds')
|| !message.channel!.havePermission('UploadFiles')) {
text += '\n\n> :warning: I currently don\'t have all required permissions in this ' +
'channel for the bridge to work. Please make sure to grant the "Masquerade", ' +
'"Upload Files" and "Send Embeds" permission.'
}
await message.reply(text, false);
break;
}

View file

@ -93,6 +93,10 @@ client.on('messageCreate', async message => {
return logger.debug(`Discord: Lacking SendEmbeds permission; refusing to send`);
}
if (!(channel.havePermission('UploadFiles'))) {
return logger.debug(`Discord: Lacking UploadFiles permission; refusing to send`);
}
if (!(channel.havePermission('Masquerade'))) {
return logger.debug(`Discord: Lacking Masquerade permission; refusing to send`);
}