2022-05-07 04:38:36 +00:00
|
|
|
|
using Discord.Interactions;
|
|
|
|
|
|
2022-12-31 07:22:22 +00:00
|
|
|
|
namespace WorldTime.Commands;
|
2022-05-07 04:38:36 +00:00
|
|
|
|
/// <summary>
|
2022-12-31 07:22:22 +00:00
|
|
|
|
/// Implements the included precondition from Discord.Net, requiring a guild context while using our custom error message.
|
2022-05-07 04:38:36 +00:00
|
|
|
|
/// </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) { }
|
|
|
|
|
}
|