add missing permission warning to bridge setup
This commit is contained in:
parent
755609901c
commit
b65a1bd70c
2 changed files with 19 additions and 5 deletions
|
@ -31,11 +31,21 @@ export default {
|
||||||
expires: Date.now() + (1000 * 60 * 15),
|
expires: Date.now() + (1000 * 60 * 15),
|
||||||
});
|
});
|
||||||
|
|
||||||
await message.reply(`### Link request created.\n`
|
let text = `### Link request created.\n` +
|
||||||
+ `Request ID: \`${reqId}\`\n\n`
|
`Request ID: \`${reqId}\`\n\n` +
|
||||||
+ `[Invite the bridge bot to your Discord server](<${DISCORD_INVITE_URL}>) `
|
`[Invite the bridge bot to your Discord server](<${DISCORD_INVITE_URL}>) ` +
|
||||||
+ `and run \`/bridge confirm ${reqId}\` in the channel you wish to link.\n`
|
`and run \`/bridge confirm ${reqId}\` in the channel you wish to link.\n` +
|
||||||
+ `This request expires in 15 minutes.`);
|
`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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,10 @@ client.on('messageCreate', async message => {
|
||||||
return logger.debug(`Discord: Lacking SendEmbeds permission; refusing to send`);
|
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'))) {
|
if (!(channel.havePermission('Masquerade'))) {
|
||||||
return logger.debug(`Discord: Lacking Masquerade permission; refusing to send`);
|
return logger.debug(`Discord: Lacking Masquerade permission; refusing to send`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue