|
|
@@ -1,14 +1,13 @@ |
|
|
|
// Create a module with no prefix |
|
|
|
public class Info : ModuleBase<SocketCommandContext> |
|
|
|
{ |
|
|
|
// ~say hello -> hello |
|
|
|
// ~say hello world -> hello world |
|
|
|
[Command("say")] |
|
|
|
[Summary("Echoes a message.")] |
|
|
|
public async Task SayAsync([Remainder] [Summary("The text to echo")] string echo) |
|
|
|
{ |
|
|
|
// ReplyAsync is a method on ModuleBase |
|
|
|
await ReplyAsync(echo); |
|
|
|
} |
|
|
|
public Task SayAsync([Remainder] [Summary("The text to echo")] string echo) |
|
|
|
=> ReplyAsync(echo); |
|
|
|
|
|
|
|
// ReplyAsync is a method on ModuleBase |
|
|
|
} |
|
|
|
|
|
|
|
// Create a module with the 'sample' prefix |
|
|
@@ -18,7 +17,9 @@ public class Sample : ModuleBase<SocketCommandContext> |
|
|
|
// ~sample square 20 -> 400 |
|
|
|
[Command("square")] |
|
|
|
[Summary("Squares a number.")] |
|
|
|
public async Task SquareAsync([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)}"); |
|
|
@@ -31,9 +32,12 @@ public class Sample : ModuleBase<SocketCommandContext> |
|
|
|
// ~sample userinfo 96642168176807936 --> Khionu#8708 |
|
|
|
// ~sample whois 96642168176807936 --> Khionu#8708 |
|
|
|
[Command("userinfo")] |
|
|
|
[Summary("Returns info about the current user, or the user parameter, if one passed.")] |
|
|
|
[Summary |
|
|
|
("Returns info about the current user, or the user parameter, if one passed.")] |
|
|
|
[Alias("user", "whois")] |
|
|
|
public async Task UserInfoAsync([Summary("The (optional) user to get info for")] SocketUser 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}"); |
|
|
|