Skip to content

Commit

Permalink
require that all commands are used in a guild
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxite committed Sep 1, 2024
1 parent 02e685f commit 0b1c591
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions HighlightBot/HighlightCommandModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace HighlightBot;

[ModuleLifespan(ModuleLifespan.Transient)]
[RequireGuild]
public class HighlightCommandModule : BaseCommandModule {
public HighlightDbContext DbContext { get; set; } = null!;

Expand Down Expand Up @@ -64,6 +65,7 @@ public Task SetHighlightDelay(CommandContext context, long minutes) {

[Group("ignore")]
[ModuleLifespan(ModuleLifespan.Transient)]
[RequireGuild]
public class IgnoreModule : HighlightCommandModule {
[Command("bots"), Priority(1)]
public Task IgnoreBots(CommandContext context, bool? ignore) {
Expand Down
3 changes: 3 additions & 0 deletions HighlightBot/SlashCommandModule.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using DSharpPlus.SlashCommands;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
using DSharpPlus.SlashCommands.Attributes;

namespace HighlightBot;

[SlashModuleLifespan(SlashModuleLifespan.Scoped)]
[SlashRequireGuild]
public class SlashCommandModule : ApplicationCommandModule {
public HighlightDbContext DbContext { get; set; } = null!;

Expand Down Expand Up @@ -56,6 +58,7 @@ public Task SetHighlightDelay(InteractionContext context, [Option("minutes", "Th

[SlashCommandGroup("ignore", "Ignore something.")]
[SlashModuleLifespan(SlashModuleLifespan.Scoped)]
[SlashRequireGuild]
public class SlashIgnoreModule : SlashCommandModule {
[SlashCommand("bots", "Ignore all bots."), Priority(1)]
public Task IgnoreBots(InteractionContext context, [Option("ignore", "Ignore bots?", true)] bool ignore) {
Expand Down

0 comments on commit 0b1c591

Please sign in to comment.