mirror of
https://github.com/xHyroM/roles-bot.git
synced 2024-11-10 03:08:06 +01:00
readme + permissions check
This commit is contained in:
parent
73574947d8
commit
f9e6269f99
3 changed files with 16 additions and 1 deletions
7
README.md
Normal file
7
README.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<div align="center">
|
||||||
|
<h1>Discord Roles Bot</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
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).
|
|
@ -26,6 +26,15 @@ export const handleRequest = async(request: Request): Promise<Response> => {
|
||||||
})
|
})
|
||||||
|
|
||||||
if (interaction.type === InteractionType.ApplicationCommand && interaction.data.name === 'setup') {
|
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
|
// @ts-ignore
|
||||||
const json = isJSON(interaction.data.options[0].value) ? JSON.parse(interaction.data.options[0].value) : null;
|
const json = isJSON(interaction.data.options[0].value) ? JSON.parse(interaction.data.options[0].value) : null;
|
||||||
|
|
||||||
|
|
1
src/bot/types.d.ts
vendored
1
src/bot/types.d.ts
vendored
|
@ -1,3 +1,2 @@
|
||||||
// secrets: wrangler secret put <name>
|
|
||||||
declare const CLIENT_PUBLIC_KEY: string
|
declare const CLIENT_PUBLIC_KEY: string
|
||||||
declare const CLIENT_TOKEN: string
|
declare const CLIENT_TOKEN: string
|
Loading…
Reference in a new issue