/bao-discord

Discord Whitelist- and Permission-System for alt:V

Primary LanguageJavaScript

bao-discord

Discord Whitelist- and Permission-System for alt:V

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

install the following modules for NodeJS: axios fs useful discord.js

You need to create a bot in your Discord: https://discord.com/developers

when creating the bot under "OAuth2 --> Redirects --> General" enter the following:
http://127.0.0.1

Activate the following when creating the bot under "Bot":
PRESENCE INTENT
SERVER MEMBERS INTENT
MESSAGE CONTENT INTENT

To invite your bot to your server, go to: "OAuth2 --> URL Generator"
here you activate under SCOPES: bot
and under BOT PERMISSIONS: Administrator

Now you can open the url generated at the bottom in a TAB or window

note the following for the config.js:
Application ID / Client ID
Client Secret

now you open the ./config/config.js in an editor and fill out ALL fields
save and close, copy the whole folder in your resource.
now add "bao-discord" to your server.cfg
and if you did everything right, the bot will appear in your discord when you start the resource and your console should list who is whitelisted, admin, mod, supporter

you can use the rights management in your scripts:
import { refreshWhitelist, isAdmin, isMod, isSupporter } from 'bao-discord'.


refreshWhitelist() --> reload your whitelist
isAdmin(player) --> return true or false
isMod(player) --> return true or false
isSupporter(player) --> return true or false