zfbx / zdiscord

A Discord bot that runs in FiveM for the purpose of whitelisting, moderation and utilties using discord.js
Other
211 stars 79 forks source link

[BUG] Bot not stopping anyone? #86

Closed twigmasters closed 1 year ago

twigmasters commented 1 year ago

I'm not sure if it is just me or something I over looked but out of curiosity I wanted to make sure my discord whitelisting was working. So I shut down my discord and tried to connect to my server and I was allowed to connect without discord even running.

Has anyone else noticed this and know how to fix it? I even tried another whitelisting script to see if it was something with zdiscord and that one did the same thing.

Any suggestions?

zfbx commented 1 year ago

have you checked to see what fivem returns for your discord id when you connect? in another script that triggers on join add this

local id = exports.zdiscord:getDiscordId(source);
print(id)

and compare it to your discord user id, if it's the same then it's probably being cached by fivem cause as long as it knows your discord id the bot can check if you have the roles. were you shutting down fivem completely and relaunching it while testing?

twigmasters commented 1 year ago

I am not sure where the best place would be to put the code and I am using qb so I added it in "qb-core/client/main.lua" No idea if that will work but I did not see anything in the server console or client when I connected. Any suggestions on a better place to put the code?

Yes I have shut fivem down completely each time each time I would make a change for testing. I can see the bot active on my discord from another pc so I know that much is working.

zfbx commented 1 year ago

you can add it right before this line in qbcore https://github.com/qbcore-framework/qb-core/blob/cd3b057bcdd2d45a2014074ee06d6132f4f2eba6/server/events.lua#L26

but i'd remove it after testing. and you're looking for it to print out a 17-20 digit number in your server console

twigmasters commented 1 year ago

I can confirm it is finding my discord ID and it matches. Is there anyway to know for sure my server is protected or to possibly clear it from fivem for testing?

I already cleared the server cache and had no effect.

zfbx commented 1 year ago

If it is your id being printed than that is on fivem's side. but I can assure you it's fairly secure as long as nobody shares discord accounts that get whitelisted. zdiscord is being used by over 700 active servers now without any mentions of security holes and I also did lots of security first practices in my design of it so it should be fairly safe :)

twigmasters commented 1 year ago

Thank you so much for your quick response and all your help!