mirror of
https://github.com/NoiTheCat/BirthdayBot.git
synced 2024-11-22 05:54:36 +00:00
Noi
d700cd8ce9
With more preconditions in use, command logging has been modified to also be better able to respond to users in the event of an error. As a result, the bot is now able to respond to users and notify them properly if they fail any preconditions.
16 lines
No EOL
716 B
C#
16 lines
No EOL
716 B
C#
using Discord.Interactions;
|
|
|
|
namespace BirthdayBot.ApplicationCommands;
|
|
|
|
/// <summary>
|
|
/// Implements the included precondition from Discord.Net, requiring a guild context while using our custom error message.<br/><br/>
|
|
/// Combining this with <see cref="RequireBotModeratorAttribute"/> is redundant. If possible, only use the latter instead.
|
|
/// </summary>
|
|
class RequireGuildContextAttribute : RequireContextAttribute {
|
|
public const string Error = "Command not received within a guild context.";
|
|
public const string Reply = ":x: This command is only available within a server.";
|
|
|
|
public override string ErrorMessage => Error;
|
|
|
|
public RequireGuildContextAttribute() : base(ContextType.Guild) { }
|
|
} |