Use CommandContextType over deprecated EnabledInDm attributes

This commit is contained in:
Noi 2024-04-28 19:45:51 -07:00
parent b3e9241235
commit d94c98aed2
5 changed files with 5 additions and 5 deletions

View file

@ -4,7 +4,7 @@ using System.Text;
namespace BirthdayBot.ApplicationCommands; namespace BirthdayBot.ApplicationCommands;
[Group("birthday", HelpCmdBirthday)] [Group("birthday", HelpCmdBirthday)]
[EnabledInDm(false)] [CommandContextType(InteractionContextType.Guild)]
public class BirthdayModule : BotModuleBase { public class BirthdayModule : BotModuleBase {
public const string HelpCmdBirthday = "Commands relating to birthdays."; public const string HelpCmdBirthday = "Commands relating to birthdays.";
public const string HelpCmdSetDate = "Sets or updates your birthday."; public const string HelpCmdSetDate = "Sets or updates your birthday.";

View file

@ -5,7 +5,7 @@ using static BirthdayBot.Common;
namespace BirthdayBot.ApplicationCommands; namespace BirthdayBot.ApplicationCommands;
[Group("override", HelpCmdOverride)] [Group("override", HelpCmdOverride)]
[DefaultMemberPermissions(GuildPermission.ManageGuild)] [DefaultMemberPermissions(GuildPermission.ManageGuild)]
[EnabledInDm(false)] [CommandContextType(InteractionContextType.Guild)]
public class BirthdayOverrideModule : BotModuleBase { public class BirthdayOverrideModule : BotModuleBase {
public const string HelpCmdOverride = "Commands to set options for other users."; public const string HelpCmdOverride = "Commands to set options for other users.";
const string HelpOptOvTarget = "The user whose data to modify."; const string HelpOptOvTarget = "The user whose data to modify.";

View file

@ -5,7 +5,7 @@ using System.Text;
namespace BirthdayBot.ApplicationCommands; namespace BirthdayBot.ApplicationCommands;
[Group("config", HelpCmdConfig)] [Group("config", HelpCmdConfig)]
[DefaultMemberPermissions(GuildPermission.ManageGuild)] [DefaultMemberPermissions(GuildPermission.ManageGuild)]
[EnabledInDm(false)] [CommandContextType(InteractionContextType.Guild)]
public class ConfigModule : BotModuleBase { public class ConfigModule : BotModuleBase {
public const string HelpCmdConfig = "Configure basic settings for the bot."; public const string HelpCmdConfig = "Configure basic settings for the bot.";
public const string HelpCmdAnnounce = "Settings regarding birthday announcements."; public const string HelpCmdAnnounce = "Settings regarding birthday announcements.";

View file

@ -7,7 +7,7 @@ public class ExportModule : BotModuleBase {
[SlashCommand("export-birthdays", HelpCmdExport)] [SlashCommand("export-birthdays", HelpCmdExport)]
[DefaultMemberPermissions(GuildPermission.ManageGuild)] [DefaultMemberPermissions(GuildPermission.ManageGuild)]
[EnabledInDm(false)] [CommandContextType(InteractionContextType.Guild)]
public async Task CmdExport([Summary(description: "Specify whether to export the list in CSV format.")] bool asCsv = false) { public async Task CmdExport([Summary(description: "Specify whether to export the list in CSV format.")] bool asCsv = false) {
if (!await HasMemberCacheAsync(Context.Guild)) { if (!await HasMemberCacheAsync(Context.Guild)) {
await RespondAsync(MemberCacheEmptyError, ephemeral: true); await RespondAsync(MemberCacheEmptyError, ephemeral: true);

View file

@ -1,7 +1,7 @@
using Discord.Interactions; using Discord.Interactions;
namespace BirthdayBot.ApplicationCommands; namespace BirthdayBot.ApplicationCommands;
[EnabledInDm(true)] [CommandContextType(InteractionContextType.Guild, InteractionContextType.BotDm)]
public class HelpModule : BotModuleBase { public class HelpModule : BotModuleBase {
private const string TopMessage = private const string TopMessage =
"Thank you for using Birthday Bot!\n" + "Thank you for using Birthday Bot!\n" +