DiscordSRV

DiscordSRV

86.8k Downloads

Multi-Server Support

Abadima opened this issue ยท 0 comments

commented

Why?

Some users may want to have the bot in let's say 3 servers, but also want their members to still be synced regardless which one of those three, a capability such as that could coe in handy.

What and How?

The package in itself doesn't seem very friendly to more than one server, for LuckPerms context for example, inputting a role_id that isn't from the "main server" seems to not work.

This URL goes to PlaceholderAPI that seems to only be friendly with MainServer
https://github.com/DiscordSRV/DiscordSRV/blob/master/src/main/java/github/scarsz/discordsrv/hooks/PlaceholderAPIExpansion.java#L138

And here, for LuckPerms, while it checks other servers, it doesn't fetch the roles from them...
https://github.com/DiscordSRV/DiscordSRV/blob/master/src/main/java/github/scarsz/discordsrv/hooks/permissions/LuckPermsHook.java#L176

Are there alternatives?

Simple modification of this code:

        for (Guild guild : DiscordSRV.getPlugin().getJda().getGuilds()) {
            builder.add(CONTEXT_SERVER_ID, guild.getId());
        }

an example of an update could be:

        for (Guild guild : DiscordSRV.getPlugin().getJda().getGuilds()) {
          builder.add(CONTEXT_SERVER_ID, guild.getId());
            for (Role role : guild.getRoles()) {
              if (StringUtils.isBlank(role.getName())) {
                  continue;
              }
              builder.add(CONTEXT_ROLE, role.getName());
              builder.add(CONTEXT_ROLE_ID, role.getId());
          }
      }

and with something like that, we could get rid of the "mainServer" loop altogther, just an idea though...

Checks

  • I have used the search at least once to check if my idea has already been suggested and perhaps already implemented.

Anything else

No response