diff --git a/README.md b/README.md new file mode 100644 index 0000000..831ab82 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +
+

Discord Roles Bot

+
+ +Discord bot for reaction roles that works with [Cloudflare Workers](https://https://workers.cloudflare.com/). + +You can add the bot to your server, just click [here](https://discord.com/oauth2/authorize?client_id=905540851718037565&scope=bot&permissions=268435456). \ No newline at end of file diff --git a/src/bot/bot.ts b/src/bot/bot.ts index 353e09c..31d46ff 100644 --- a/src/bot/bot.ts +++ b/src/bot/bot.ts @@ -26,6 +26,15 @@ export const handleRequest = async(request: Request): Promise => { }) if (interaction.type === InteractionType.ApplicationCommand && interaction.data.name === 'setup') { + // @ts-ignore + if ((interaction.member?.permissions & 0x10) !== 0x10) return respond({ + type: InteractionResponseType.ChannelMessageWithSource, + data: { + flags: 64, + content: `Required permissions: \`MANAGE_ROLES\`` + } + }) + // @ts-ignore const json = isJSON(interaction.data.options[0].value) ? JSON.parse(interaction.data.options[0].value) : null; diff --git a/src/bot/types.d.ts b/src/bot/types.d.ts index 5236fdf..63a613a 100644 --- a/src/bot/types.d.ts +++ b/src/bot/types.d.ts @@ -1,3 +1,2 @@ -// secrets: wrangler secret put declare const CLIENT_PUBLIC_KEY: string declare const CLIENT_TOKEN: string \ No newline at end of file