From 6d3d906e604d530c5f1e03d2c8dc191f8b6f45e7 Mon Sep 17 00:00:00 2001 From: Christopher Felegy Date: Sun, 2 Dec 2018 13:36:54 -0500 Subject: [PATCH] docs: add example of custom error message to sample --- samples/02_commands_framework/Modules/PublicModule.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/samples/02_commands_framework/Modules/PublicModule.cs b/samples/02_commands_framework/Modules/PublicModule.cs index f30dfd73f..8d55d8ba8 100644 --- a/samples/02_commands_framework/Modules/PublicModule.cs +++ b/samples/02_commands_framework/Modules/PublicModule.cs @@ -59,5 +59,10 @@ namespace _02_commands_framework.Modules [Command("list")] public Task ListAsync(params string[] objects) => ReplyAsync("You listed: " + string.Join("; ", objects)); + + [Command("guild_only")] + [RequireContext(ContextType.Guild, ErrorMessage = "Sorry, this command must be ran from within a server, not a DM!")] + public Task GuildOnlyCommand() + => ReplyAsync("Nothing to see here!"); } }