Browse Source

docs: add example of custom error message to sample

tags/2.0
Christopher Felegy 6 years ago
parent
commit
6d3d906e60
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      samples/02_commands_framework/Modules/PublicModule.cs

+ 5
- 0
samples/02_commands_framework/Modules/PublicModule.cs View File

@@ -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!");
}
}

Loading…
Cancel
Save