zfbx / zdiscord

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

Can i use this script to run 2 dicord server !! 1 For Discord Allowlisted and 1 for Admin Works Like Ban Kick and all !!! #60

Closed subhampro closed 2 years ago

subhampro commented 2 years ago

Like

const DiscordGuildId = "959067219550146600, 959764564696760350";

This ????

zfbx commented 2 years ago

You can but you'll have to do a little refactoring on the ready.js event having it register guild commands for the second server. but the one that does allowlisting you should have in the DiscordGuildId only since it fetches users from that server

subhampro commented 2 years ago

Can you guide me in detail or I can wait if you have some future plan to execute any config like :: CMDDiscordGuildId : AllowListedDiscordGuildId : !!!!!!!

zfbx commented 2 years ago

I have no future plans to do this as fivem isn't really a suitable system to host a bot for anything quite so demanding. Also what I'm about to say is untested and may have some issues with permissions but as I was saying before to add support for another discord server you just need to duplicate these lines here https://github.com/zfbx/zdiscord/blob/djs/server/events/ready.js#L17-L19 and replace everywhere guild is used with guild2 and that first line where it gets the server/guild ID replace it with the other server's ID and the bot will register commands for it. Alternatively you could replace the guild command registration with global command registration but it will break some things out of the box as the bot doesn't expect to receive slash command from DMs but could if registered globally.

But my 2 cents, In the end I really don't suggest doing this and instead suggest getting a bot hosted directly from nodejs outside of fivem.. in fact, an outside bot with hooks for fivem to use would be 10x better than zdiscord's implementation just because it would have its own thread and proper code, fivem does really weird stuff with scripting and I only made it like that for just being dead simple to add in and move around with a server for most people while not hammering the discord API as hard as other solutions do

subhampro commented 2 years ago

I have no future plans to do this as fivem isn't really a suitable system to host a bot for anything quite so demanding. Also what I'm about to say is untested and may have some issues with permissions but as I was saying before to add support for another discord server you just need to duplicate these lines here https://github.com/zfbx/zdiscord/blob/djs/server/events/ready.js#L17-L19 and replace everywhere guild is used with guild2 and that first line where it gets the server/guild ID replace it with the other server's ID and the bot will register commands for it. Alternatively you could replace the guild command registration with global command registration but it will break some things out of the box as the bot doesn't expect to receive slash command from DMs but could if registered globally.

But my 2 cents, In the end I really don't suggest doing this and instead suggest getting a bot hosted directly from nodejs outside of fivem.. in fact, an outside bot with hooks for fivem to use would be 10x better than zdiscord's implementation just because it would have its own thread and proper code, fivem does really weird stuff with scripting and I only made it like that for just being dead simple to add in and move around with a server for most people while not hammering the discord API as hard as other solutions do

Understand the whole thing dude !! Appreciated !! I suggest you watch Dr. Strange in the Multiverse of Madness for relaxing in life 🙂