Skip to content

Commit

Permalink
fix slash command registration
Browse files Browse the repository at this point in the history
  • Loading branch information
FloatingMilkshake committed Mar 8, 2024
1 parent c126d97 commit 880a11d
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@ internal static async Task Main()

foreach (var type in slashCommandClasses)
slash.RegisterCommands(type, HomeServer.Id);

if (ConfigJson.Base.UseServerSpecificFeatures)
{
// Register CommandsNext commands
commands.RegisterCommands<ServerSpecificFeatures.MessageCommands>();

// Register server-specific feature slash commands in home server when debugging
slash.RegisterCommands<ServerSpecificFeatures.RoleCommands>(HomeServer.Id);
}

Discord.Logger.LogInformation(BotEventId, "Slash commands registered for debugging");

Expand Down Expand Up @@ -213,24 +222,13 @@ internal static async Task Main()
// ignore
}
}


Discord.Logger.LogInformation(BotEventId, "Slash commands registered globally");
#endif
// Register server-specific feature slash commands
slash.RegisterCommands<ServerSpecificFeatures.RoleCommands>(984903591816990730);
slash.RegisterCommands<ServerSpecificFeatures.RoleCommands>(HomeServer.Id);

if (ConfigJson.Base.UseServerSpecificFeatures)
{
// Register CommandsNext commands
commands.RegisterCommands<ServerSpecificFeatures.MessageCommands>();

// Register slash commands
if (Discord.Guilds.ContainsKey(984903591816990730))
slash.RegisterCommands<ServerSpecificFeatures.RoleCommands>(984903591816990730);
// & in home server when debugging
#if DEBUG
slash.RegisterCommands<ServerSpecificFeatures.RoleCommands>(HomeServer.Id);
Discord.Logger.LogInformation(BotEventId, "Slash commands registered globally");
#endif
}

await Discord.ConnectAsync();

Expand Down

0 comments on commit 880a11d

Please sign in to comment.