GithubHelp home page GithubHelp logo

zfbx / zdiscord Goto Github PK

View Code? Open in Web Editor NEW
197.0 15.0 78.0 621 KB

A Discord bot that runs in FiveM for the purpose of whitelisting, moderation and utilties using discord.js

License: Other

JavaScript 98.80% Lua 1.20%
fivem standalone qbcore discord-bot commands discord discord-js bot

zdiscord's Introduction

zdiscord (v7)

Note: zdiscord v7 and high REQUIRE FiveM artifacts build 4890 or newer
zdiscord v5-6 REQUIRES artifacts 4800 or newer.
Older artifacts will require use of the v4 eris branch instead.

Setup | Donate | FAQ | Support | Docs

About

A Discord bot that runs in FiveM for the purpose of whitelisting, moderation and utilities using discord.js. The goal is for this this resource to be easy to setup and expand upon while giving your staff team an easy method of support and moderation of players in game without actually launching FiveM. This resource also heavily support QBCore in most of it's functionality but it's not required

Features

  • Standalone FiveM resource (no external hosting required)
  • Uses Slash commands with help/suggestions
  • Moderation tools (kick, ban, inspect, etc)
  • QBCore commands included!
  • Easy to expand and customize with modular commands!
  • Can be configured with convars
  • Automatic Ace Permission granting system
  • Helpful exports
  • bi-directional staff chat
  • AND MORE!

Setup

Requirements

  • FiveM artifacts build 4890 or higher
  • cfx-server-data in your resources (yarn ([system]/[builders]/yarn/) at least)
  • Optional: screenshot-basic if you want the /screenshot command to work

Steps

  1. Get a bot application if you haven't already Guide Here

  2. IMPORTANT: Enable BOTH intents on the bot page of step 1 (Picture example) *If you don't do this.. your bot will NOT work.

  3. Add the bot to your server - To do this copy the following link and replace YOUR-BOT-ID with your bots ID then follow the invite process to your discord from the link https://discord.com/api/oauth2/authorize?client_id=YOUR-BOT-ID&permissions=116928&scope=bot%20applications.commands
    NOTE: If the bot is already in your server you might need to run the link above again anyways to make sure it can get the needed slash command scope (unrelated to permissions)

  4. Copy the resource into your fiveM resources directory and make sure it's named zdiscord (not zdiscord-djs, zdiscord-eris or anything)

  5. Double check that you have the cfx-server-data resource in your resources (or yarn [system]/[builders]/yarn/ at the very least)

  6. In your server.cfg do the following:
    6a. Add ensure zdiscord (after qb-core and/or convars you may have)
    6b. Add the following anywhere in your .cfg:

    add_ace resource.zdiscord command allow
    add_ace group.zdiscordstaff zdiscord.staffchat allow
    
  7. Adjust the config.js variables to how you'd like them. (Optionally use Convars)

  8. If you missed step 2, go back and do it.. or else IT WONT WORK!

  9. If you run into any errors check out the FAQ where a lot of common problems are listed and answered

Support

Please note we only support the official, free and open source, QBCore framework and not old "qbus" or paid copies of QBCore

If you have any errors or problems please first check:

If neither of those solve your problem Open a ticket or message me on Discord (My name is Tony#1275 on discord)

Donate

I've built and polished this resource from the ground up for free and open sourced it for everybody. If you use it, enjoy it, get support from me or just want to support the project please consider sending a tip or donation through any of the following platforms:

Donate on PayPal Sub on Patreon Buy Me a Pizza

Any contribution is greatly appreciated but you're amazing regardless ♥

License

Note: as of version 7.0.0 zdiscord, it is licensed under CC-BY-NC-SA-4.0

zdiscord © 2021 by zfbx is licensed under Attribution-NonCommercial-ShareAlike 4.0 International

TL;DR

  • BY: Credit must be given to me, the creator. (Tony/zfbx)
  • NC: Only noncommercial use of your work is permitted. (You can use in your own FiveM server which may make money itself BUT can't in any way sell zdiscord itself in any way for any commercial advantage or monetary compensation)
  • SA: Adaptations must be shared under the same terms.

zdiscord's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zdiscord's Issues

Error: [yarn] error Could not write file

[ script:yarn] Error: [yarn] error Could not write file "/home/zap910470/g473470/gta5-fivem-txadmin/QBCoreFramework_B20DFB.base/resources/zdiscord/yarn-error.log": "EACCES: permission denied, open '/home/zap910470/g473470/gta5-fivem-txadmin/QBCoreFramework_B20DFB.base/resources/zdiscord/yarn-error.log'"
[ script:yarn] error An unexpected error occurred: "EACCES: permission denied, mkdir '/home/zap910470/g473470/gta5-fivem-txadmin/QBCoreFramework_B20DFB.base/resources/zdiscord/node_modules'".

[BUG] [ERR]: NO COMMAND CREATION PERMISSIONS

Have added the "add_ace resource.zdiscord command allow" to server CFG, and reinvited the bot to my discord multiple times, but I continue to get this error in my console:

"[zdiscord][2022-6-14 16:10:06][ERR]: NO COMMAND CREATION PERMISSIONS - You must reinvite the bot to your server with the invite link provided in setup"

Give Role/Remove Role

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Sometimes jobs, whitelist in particular for some cities have special discord roles that are used for out of game communication. Sometimes adding people to these roles or even removing them can be a pain especially in more active cities. It would be cool to have the ability to give a role in a hire event or something of that nature... and maybe a remove role if someone is fired.

Describe alternatives you've considered
N/A

Additional context
N/A

Couldn't find the binary git

Whenever I try to run zdiscord, the log tells me the following:

yarn install v1.22.5
info No lockfile found.
[1/4] Resolving packages...
error Couldn't find the binary git
[ citizen-server-impl] Building resource zdiscord failed.
[ citizen-server-impl] Error data: yarn failed!

I'm running the henkallsn/fivem_esx_bundle:light docker container and everything updated to latest version.

errors in console

I setup the bot with documentation provided and getting this error

[ script:zdiscord] Error: Error: Disallowed intents specified
[ script:zdiscord] at Shard._onWSClose (/home/container/txData/staging_v2.base/resources/[Scripts]/zdiscord/node_modules/eris/lib/gateway/Shard.js:2133:23)
[ script:zdiscord] at WebSocket.emit (events.js:210:5)
[ script:zdiscord] at WebSocket.emitClose (/home/container/txData/staging_v2.base/resources/[Scripts]/zdiscord/node_modules/ws/lib/websocket.js:246:10)
[ script:zdiscord] at TLSSocket.socketOnClose (/home/container/txData/staging_v2.base/resources/[Scripts]/zdiscord/node_modules/ws/lib/websocket.js:1063:15)
[ script:zdiscord] at TLSSocket.emit (events.js:215:7)
[ script:zdiscord] at net.js:658:12
[ script:zdiscord] at TCP.done (_tls_wrap.js:481:7)

Create a button that give role

Before submitting your question have you checked the check the FAQ or checked for similar issues already?: yes

Question:
I want to create an embed with a button and when someone click the button he obtain a discord role.
How can I do that ?

Information:
FiveM artifact #: latest
Using QBCore?: yes
When did you last update QBCore if you are using it?: 4 days ago

[Feature] Persistent player count channel

Would be nice to have a persistent locked voice channel in the server, that updates every second or so with the online player count. A lot of other bots do this with discord member counts. Potentially this could also be dynamic like the status messages.

Format could be: Players Online: {playercount}

Example:
image

[BUG]

Describe the bug
A clear and concise description of what the bug is.

Screenshots
If applicable, add screenshots to help explain your problem.
https://prnt.sc/26tb27z

Information:

  • FiveM Artifact #: [e.g. 3240]
  • Running QBCore?: [yes/no] yes
  • If running QBCore when did you last update it? [e.g. today, 1 week] 3 weeks
  • Have you checked for other issues reporting this bug?: [yes/no] yes

Additional context
Add any other context about the problem here.

Qbcore commands not working

Question:

Information:
Certain commands work like, screenshot player, restart resources. but certain commands like revive a player, or setjob is not working why?
Using QBCore?: [yes
When did you last update QBCore if you are using it? A month ago

[BUG] /players gives error

Describe the bug
A clear and concise description of what the bug is.
Whenever I do /players in the Discord, it loads forever and gives the following error in the console..

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Discord'
  2. Type '/players'
  3. See error in console

Expected behavior
A clear and concise description of what you expected to happen.
Giving a list of players in the server.

Screenshots
If applicable, add screenshots to help explain your problem.
image

Information:

  • FiveM Artifact #: tuner DLC
  • Running QBCore?: [yes]
  • If running QBCore when did you last update it? [1 month ago I think?]
  • Have you checked for other issues reporting this bug?: [yes]

Thankyou for the following help! :)

[Question]

Before submitting your question have you checked the check the FAQ or checked for similar issues already?: [yes/no]

Question:
Does "DeprecationWarning: Buffer() is deprecated due to security and usability issues" mean anything important?

multiple role id

Before submitting your question have you checked the check the FAQ or checked for similar issues already?: yes

Question:
Hey, when I need to put multiple DiscordModRoleId how I can do it?

Information:
FiveM artifact #: 4821
Using QBCore?: yes
When did you last update QBCore if you are using it?: last update

[BUG] DiscordAPIError: 405 : Method Not Allowed

Hi everyone.

I use Zdiscord for weeks and all work fine until this night. I have this error when the server is restarting and now my commands doesn't work. See pictures. Do you know how to fix this ?
Capture

Need some info

I am trying to figure out what discord.js version is running with the bot can't find it nowhere,
when I am trying to get the event "guildMemberUpdate" oldMember and newMember are just undefined, and I can't figure something out

[Suggestion]

Hey!

First off this resource is amazing. Great work sir. Donation incoming!

I had a suggestion. It would be great if we could add role ids in the config to give out certain ace permissions.

This helps with RP servers that use resources that are standalone and require use of ACE.

Appreciate the hard work and thanks again!

question

now its saying Connection rejected by server: You do not have the NewDistrict discord role required to join this server, are you allowlisted?

Discord commands not working

Good night. I performed all the steps and I can already use the role-based whitelist. The problem is that I can't send command through discord. Whenever I type a / , all commands appear unavailable and even if I try to execute them, nothing happens.

Does anyone know a way to solve the problem

Connection reset by peer

Hey after some time i got an error in my console, i use my own server Windows Server 2016, Gamebuild 2189 with onesync infinity.
The Bot start correct also all commands working fine.

[ script:zdiscord] Logged in on Discord as HSH Bot!
[ script:qb-core] [qb-core:LOG] PsYch0StylZ PLAYER SAVED!
[ script:qb-core] [qb-core:LOG] PsYch0StylZ PLAYER SAVED!
[ script:zdiscord] Error: Error: Connection reset by peer
[ script:zdiscord] at Shard._onWSClose (C:\txData\QBCoreFramework_3DD161.base\resources[standalone]\zdiscord\libs\eris\lib\gateway\Shard.js:2137:23)
[ script:zdiscord] at WebSocket.emit (events.js:210:5)
[ script:zdiscord] at WebSocket.emitClose (C:\txData\QBCoreFramework_3DD161.base\resources[standalone]\zdiscord\libs\ws\lib\websocket.js:247:10)
[ script:zdiscord] at TLSSocket.socketOnClose (C:\txData\QBCoreFramework_3DD161.base\resources[standalone]\zdiscord\libs\ws\lib\websocket.js:1102:15)
[ script:zdiscord] at TLSSocket.emit (events.js:215:7)
[ script:zdiscord] at net.js:658:12
[ script:zdiscord] at TCP.done (_tls_wrap.js:481:7)
[ script:zdiscord] Logged in on Discord as HSH Bot!

error

i get this error when i start the script
image

revive error

image
i get this error when i try to revive someone

[Feature] Connect queue

My very (un)original idea is to add a connect queue (or using a pre existing one like the one qbcore uses for example) and adding the possibility to give queue priority through discord roles.

qbcore latest update issue

since the last update of the qbcore this function no longer used

TriggerEvent('QBCore:GetObject', (obj) => { QBCore = obj });

so they are using this
local QBCore = exports['qb-core']:GetCoreObject()

i tried to add it on app.js but notworking

let QBCore;
TriggerEvent('QBCore:GetObject', (obj) => { QBCore = obj });
if (QBCore) console.log("QBCore found! Supported QB commands will be loaded.");

/revive

I really enjoying your bot! Huge Thanks.
But may add a revive function then your bot would be perfect.

[Feature Request] Ability to purge discord messages

I think this bot is very good, I have been modifying it so that the commands work with my server (ESX LEGACY), but I would like to know if I could add a purge text command, thus avoiding using another bot in my discord, something like /purge NUMBER, and to delete the messages indicated in the number

[BUG] Timed Message Addon (Non-Functioning)

Describe the bug
Timed message addon doesn't appear to actually work.

To Reproduce
Nothing. Simply doesn't do anything once the channel id is added. Attempted a few small troubleshooting steps, like permissions, making a new channel, and manually restarting script. Once I have more time later, I'll dig in and see what I can find out. Nothing out of the ordinary in debug, either.

Expected behavior
Function as intended.

Screenshots
None.

Information:

  • FiveM Artifact #: 5181
  • Running QBCore?: Yes
  • If running QBCore when did you last update it? Recent. Shouldn't impact this issue.
  • Have you checked for other issues reporting this bug?: Yes. It was horribly frustrating. People need to start describing their titles.

Additional context
Once I finish a few major functions, I plan on ripping into it to see if I can find out anything. I'll report any findings here. Everything else is working as intended, such as the voice channel, status switcher, and everything else. Bot is Admin on the server with proper permissions.

[BUG]

Describe the bug
(node:15524) DeprecationWarning: Message#deleted is deprecated, see discordjs/discord.js#7091.
(Use FXServer --trace-deprecation ... to show where the warning was created)

FXServer --trace-deprecation

That's what i have on my server running zdiscord. I don't know discord.js i see it is on my zdiscord folder.

To Reproduce
Steps to reproduce the behavior:
Just drag en drop into a server running directly and the fxserver will show a warning

Do you have an idea how to fix ? I'm using Artifact 5151

New Error on 5300 : (node:9264) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use FXServer --trace-deprecation ... to show where the warning was created)

[BUG] discord.js is not being found

Describe the bug
A clear and concise description of what the bug is.

Whenever I start the script, next error appears

image

Screenshots
If applicable, add screenshots to help explain your problem.

image

Information:

  • FiveM Artifact #: Latest recommended (4394)
  • Running QBCore?: [yes]: it is renamed but still should work with QBCore
  • If running QBCore when did you last update it? [custom, so not]
  • Have you checked for other issues reporting this bug?: [yes]

Additional context
Add any other context about the problem here.

[Question] Grant permission based on the role

Question:
Hi!
I'm not sure if this is possible, but my plan is that when they buy a package on tebex they are granted a role, VIP. This role in the server should have the rank vip, normally the command would be /addpermission ID (group)

Information:
FiveM artifact #: 5371
Using QBCore?: yes
When did you last update QBCore if you are using it?: This week

What happened

image

Bots been working fine no updates to core or anything. She just died on me!

[BUG]

Hi everyone.
I can use only two commands
Screenshots
image

Get error

error222
Hi
Im use zdiscord but get this error
Can you help me

[BUG]

Describe the bug

  • Discord Server not found - 'DiscordGuildId' not set correctly .

Actions
-Try many time copy server id or channel id . still same .

Screenshot
https://imgur.com/ghKTVEb.png

Information:

  • FiveM Artifact #: 4800
  • Running QBCore?: yes
  • If running QBCore when did you last update it? last month
  • Have you checked for other issues reporting this bug?: yes

QBCore slash commands are not showing up in Discord

Before submitting your question have you checked the check the FAQ or checked for similar issues already?: yes

Question:
After setting up the script. Everything works except the QBCore scripts. They wont even show up in discord text chat when typing /. Normal ones appear + /kill but commands like /money /revive are not working

Information:
FiveM artifact #: [eg. 3200]
Using QBCore?: yes
When did you last update QBCore if you are using it?: using old version, last updated 3 months ago

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.