Assume I have a module that only contains commands for guilds, like the following:
using Discord;
using Discord.Interactions;
using System.Linq;
using System.Threading.Tasks;
namespace MyDiscordBot;
[EnabledInDm(false)]
public class GuildActionsModule : InteractionModuleBase<SocketInteractionContext>
{
[SlashCommand("guild-action", "Perform an action in a guild")]
public async Task GuildActionAsync()
{
var guild = Context.Guild;
await RespondAsync("Performing a very serious action in a guild...");
await Task.Delay(2000);
await ModifyOriginalResponseAsync(m => m.Content = "The very serious action was performed!");
}
}
I have specified the [EnabledInDm(false)] attribute, but when I register the command module
using
var entryAssembly = Assembly.GetEntryAssembly();
InteractionService = new InteractionService(RestClient);
InteractionService.AddTypeConverters(entryAssembly);
await InteractionService.AddModulesAsync(entryAssembly, null);
await InteractionService.RegisterCommandsGloballyAsync();
the command still appears in the autocomplete section in my DMs. How do I disable an entire module's commands from appearing in DMs?