sjstein / R8DIUM

A discord bot to manage individual run8 users
GNU General Public License v3.0
2 stars 0 forks source link

Look into a single instance of bot handling multiple servers #70

Open sjstein opened 11 months ago

sjstein commented 11 months ago

Can the bot tell which discord server it is running from? Do we keep a separate db for each discord server? How to associate each discord server with each run8 server (HostSecurity)

sjstein commented 11 months ago

As of now, I can find the server (which Discord refers to as a guild) name off of the Interaction object:

server_name = interaction.guild.name

From reading a bit more on this, there appear to be some privacy concerns about a bot actually being able to access this info, so this functionality may not be around long...

sjstein commented 11 months ago

So given that (for now) I can identify which server is sending me a command, it is feasible on the surface to separate functionality for how the bot handles back-end (run8) admin.

This may be a can of worms however - at least with how the bot authorizes who can access what commands. Those role names are specified in the configuration file and are tied to a specific discord server at present.

Perhaps it is time to abandon the authorizing of commands locally (at the bot level) and just push that responsibility to the Discord server admin

sjstein commented 11 months ago

Channel names are also a dependency - for example the name of the channel on a specific server in which to write the log of bot executed commands

I suppose we could specify a server name as part of these parameters - would have to look into what that means from the configuration parser - probably maintaining a dict of log channels with the keys being the server names: {server_name1 : log_channel_name, server_name2: log_channel_name} etc.

given the current dependency in the codebase on an implied single-server, this may be a lot of work

sjstein commented 11 months ago

Channel names are also a dependency - for example the name of the channel on a specific server in which to write the log of bot executed commands

I suppose we could specify a server name as part of these parameters - would have to look into what that means from the configuration parser - probably maintaining a dict of log channels with the keys being the server names: {server_name1 : log_channel_name, server_name2: log_channel_name} etc.

given the current dependency in the codebase on an implied single-server, this may be a lot of work

Maybe not that big of a deal seeing as the idea of channel restrictions wasn't really a feature that was wanted and can also be restricted by the Discord server admin

sjstein commented 11 months ago

I rescind my previous hopeful thoughts - I think the initial design decisions and assumptions making disconnecting the 1-1 association between a bot instance and a run8 server instance beyond the effort I'm willing to expend at this time.

sjstein commented 11 months ago

Since this issue isn't really closed - I'll reopen. Branch created (70_multiple_discord_servers) to hold first bit of investigation