Skip to content

Commit

Permalink
Allow adding extra intents to discord relay bot
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Jan 2, 2024
1 parent 6b3af74 commit 7bd2ad3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions MCGalaxy/Modules/Relay/Discord/DiscordBot.cs
Expand Up @@ -403,9 +403,11 @@ public sealed class DiscordBot : RelayBot


protected override void OnStart() {
session = new DiscordSession();
base.OnStart();
DiscordSession s = new DiscordSession();
s.Intents = DiscordWebsocket.DEFAULT_INTENTS | Config.ExtraIntents;
session = s;

base.OnStart();
OnPlayerConnectEvent.Register(HandlePlayerConnect, Priority.Low);
OnPlayerDisconnectEvent.Register(HandlePlayerDisconnect, Priority.Low);
OnPlayerActionEvent.Register(HandlePlayerAction, Priority.Low);
Expand Down
3 changes: 3 additions & 0 deletions MCGalaxy/Modules/Relay/Discord/DiscordPlugin.cs
Expand Up @@ -59,6 +59,9 @@ public sealed class DiscordConfig
[ConfigBool("embed-show-game-statuses", "Embeds", true)]
public bool EmbedGameStatuses = true;

[ConfigInt("extra-intents", "Intents", 0)]
public int ExtraIntents;

public const string PROPS_PATH = "properties/discordbot.properties";
static ConfigElement[] cfg;

Expand Down
2 changes: 1 addition & 1 deletion MCGalaxy/Modules/Relay/Discord/DiscordWebsocket.cs
Expand Up @@ -31,7 +31,7 @@ namespace MCGalaxy.Modules.Relay.Discord
public sealed class DiscordSession
{
public string ID, LastSeq;
public int Intents = DiscordWebsocket.DEFAULT_INTENTS;
public int Intents;
}
public delegate string DiscordGetStatus();

Expand Down

0 comments on commit 7bd2ad3

Please sign in to comment.