Update Documentation to be compatible with Beta2

this one took a while
This commit is contained in:
Christopher F
2016-10-15 17:28:36 -04:00
parent 8c8ac47887
commit 77342903bb
17 changed files with 205 additions and 146 deletions

View File

@@ -1,29 +1,29 @@
using Discord;
using Discord.Commands;
using Discord.WebSocket;
// Create a module with no prefix
[Module]
public class Info
public class Info : ModuleBase
{
// ~say hello -> hello
[Command("say"), Summary("Echos a message.")]
public async Task Say(IUserMessage msg,
[Unparsed, Summary("The text to echo")] string echo)
public async Task Say([Unparsed, Summary("The text to echo")] string echo)
{
await msg.Channel.SendMessageAsync(echo);
// ReplyAsync is a method on ModuleBase
await ReplyAsync(echo);
}
}
// Create a module with the 'sample' prefix
[Module("sample")]
public class Sample
[Group("sample")]
public class Sample : ModuleBase
{
// ~sample square 20 ->
// ~sample square 20 -> 400
[Command("square"), Summary("Squares a number.")]
public async Task Square(IUserMessage msg,
[Summary("The number to square.")] int num)
public async Task Square([Summary("The number to square.")] int num)
{
await msg.Channel.SendMessageAsync($"{num}^2 = {Math.Pow(num, 2)}");
// We can also access the channel from the Command Context.
await Context.Channel.SendMessageAsync($"{num}^2 = {Math.Pow(num, 2)}");
}
// ~sample userinfo --> foxbot#0282
@@ -34,10 +34,9 @@ public class Sample
// ~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(IUserMessage msg,
[Summary("The (optional) user to get info for")] IUser user = null)
public async Task UserInfo([Summary("The (optional) user to get info for")] IUser user = null)
{
var userInfo = user ?? await Program.Client.GetCurrentUserAsync();
await msg.Channel.SendMessageAsync($"{userInfo.Username}#{userInfo.Discriminator}");
var userInfo = user ?? Context.Client.CurrentUser;
await ReplyAsync($"{userInfo.Username}#{userInfo.Discriminator}");
}
}