Skip to content

imperfect-fivem/discord_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FiveM Discord API

Lua based Discord API for FiveM development environment.
Note: This is a server-side script, use events for any client interactions.
Note: This script is under development and not fully functional, star and watch the repo for updates.
Download Link

📥 Dependencies

ox_lib is required.

🔃 Variables (Convar)

For initializing two variables need to be set in server.cfg.

Example:

set discord_bot_token "XYZ123XYZ123XYZ123XYZ123.AB1C2D.XYZ1234_XYZ123XYZ123XYZ1_XYZ123XYZ1234"
set discord_server_id "000000000000000000"

📖 Guide

To be able to use the API you have to load a file in your script manifest.

server_script '@discord_api/init.lua'

Check some examples.

🔌 Alive/Dead API Switch

There is a built-in Alive/Dead API switch which takes place when discord_api resource is not started, the bot reached it's limit, etc...
What it does is pretty simple, just redefines some functions that we choose to be empty (dead) ones, so that we get empty results without have to go through a request that (we know for sure) will fail.
When the API is ready (discord_api resource is started again), it will automatically redefine those function to the Alive version again.
Check this live example.

📑 TODOs

  • Handle rate limit.

🤖 Language Server

About

Lua based Discord API for FiveM development environment.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages