[Release] Discord Bot to FiveM

To cut it short and sweet this release allows you to send command to your FiveM server from a discord using a bot and a HTTP handler!


Dependencies
HTTP Handler by Cyntaax

In the github link provided there is the resource for FiveM which you should know how to install - if not you shouldn’t read any further - and the bot file which requires you to install Discordia. Refer to the wiki tab for instructions on how to install.


Preview
I made 2 example commands as seen in the config of the resource.

  • say – prints a message to chat (Args: [str]message required)


  • drop – drops a player from the server. (Args: [int]server id of player required, [str]reason)



Installation

  1. Clone the resource from github.
  2. Follow the instructions to make a discord bot using Discordia
  3. Put your bot token inside the config.json.
  4. Load the bot using luvit bot.lua and enjoy!

If you have any questions then ask in the comments!

5 Likes

will it work if we disabled the rcon ? :grimacing:

It has nothing to do with RCON.

2 Likes

tnx mate , i will test it now ! really needed smt like this <3

1 Like

Nice release! This will help people that are not always on server moderating so now they can do it through discord.

im getting 401 error even tho i set the both password the same ! it says check token http error 0 : 401: Unauthorized

This isn’t anything to do with the script. You haven’t formatted your bot token correctly.
It should be in the format Bot TOKENHERE.

1 Like

Can someone nice explain how to set this up?

Read the instructions, if you have an issue or don’t know what to do for a certain step lemme know.

I did but i’m not sure how to do the luvit bot.lua part. I also don’t know if I should put start http-discord-bot and start bot on my server cfg or not.

Download luvit.
Place the exe(s) into a folder where you want your bot to be.
Open the command prompt and CD to that folder.
Run the command lit install SinisterRectus/discordia
place the contents from the bot folder into your bot folder you just made above.
To start the bot run the command luvit bot.lua.

FiveM:
Place the http-discord-bot folder into your resources folder.
Add start http-discord-bot to your server.cfg. (Ensure this is after start http-wrapper

Nice! Love to see discord integrations! I have our FiveM server tightly integrated with discord to where we run all of our admin commands from discord vs in game.

p.s. You can include the http-wrapper with the resource to make it easier for users i.e.

server_scripts {
    'HTTP.lua'
    'server.lua'
}

It will work the same with no changes needed to your base code

1 Like

Glad you like it!
I’ll probably keep the resources seperate so people still have to check out your page regardless :slight_smile:

i am getting error 404 from my bot when trying to get it to say something in game?

Is this the response from the RCON request or from the bot itself?
Are you sure the endpoints and password match.

its from the bot im not sure how to know if the passwords and endpoints match

I assume you didn’t set up something correctly if it is to do with the bot.
If you didn’t touch the endpoints you should be fine however if you renamed the resource you will need to edit _RESOURCENAME in the config.json to the new resource name.

is it the name of the resource in my server resources?

resource refers to the folder you put in your server resources folder.

i’m a little lost in this configuration… what should i put in “Token”:“Bot BOTTOKENHERE”?