From caa5b15e53427de0993d7f4d658d8fca836f006b Mon Sep 17 00:00:00 2001 From: Hsu Still <341464@gmail.com> Date: Sat, 30 Sep 2017 11:58:59 +0800 Subject: [PATCH] Modify module samples to use SocketCommandContext instead --- docs/guides/commands/samples/empty-module.cs | 2 +- docs/guides/commands/samples/module.cs | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/docs/guides/commands/samples/empty-module.cs b/docs/guides/commands/samples/empty-module.cs index cac9922b5..6483c7cd2 100644 --- a/docs/guides/commands/samples/empty-module.cs +++ b/docs/guides/commands/samples/empty-module.cs @@ -1,6 +1,6 @@ using Discord.Commands; -public class InfoModule : ModuleBase +public class InfoModule : ModuleBase { } \ No newline at end of file diff --git a/docs/guides/commands/samples/module.cs b/docs/guides/commands/samples/module.cs index 403acba06..6897665ee 100644 --- a/docs/guides/commands/samples/module.cs +++ b/docs/guides/commands/samples/module.cs @@ -1,13 +1,9 @@ -using Discord; -using Discord.Commands; -using Discord.WebSocket; - // Create a module with no prefix -public class Info : ModuleBase +public class Info : ModuleBase { // ~say hello -> hello [Command("say"), Summary("Echos a message.")] - public async Task Say([Remainder, Summary("The text to echo")] string echo) + public async Task SayAsync([Remainder, Summary("The text to echo")] string echo) { // ReplyAsync is a method on ModuleBase await ReplyAsync(echo); @@ -16,11 +12,11 @@ public class Info : ModuleBase // Create a module with the 'sample' prefix [Group("sample")] -public class Sample : ModuleBase +public class Sample : ModuleBase { // ~sample square 20 -> 400 [Command("square"), Summary("Squares a number.")] - public async Task Square([Summary("The number to square.")] int num) + public async Task SquareAsync([Summary("The number to square.")] int num) { // We can also access the channel from the Command Context. await Context.Channel.SendMessageAsync($"{num}^2 = {Math.Pow(num, 2)}"); @@ -34,7 +30,7 @@ public class Sample : ModuleBase // ~sample whois 96642168176807936 --> Khionu#8708 [Command("userinfo"), Summary("Returns info about the current user, or the user parameter, if one passed.")] [Alias("user", "whois")] - public async Task UserInfo([Summary("The (optional) user to get info for")] IUser user = null) + public async Task UserInfoAsync([Summary("The (optional) user to get info for")] SocketUser user = null) { var userInfo = user ?? Context.Client.CurrentUser; await ReplyAsync($"{userInfo.Username}#{userInfo.Discriminator}");