Initial Commit
This commit is contained in:
commit
bb0db1701c
7 changed files with 187 additions and 0 deletions
26
Geekbot.net/Modules/Cat.cs
Normal file
26
Geekbot.net/Modules/Cat.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using RestSharp;
|
||||
|
||||
namespace Geekbot.net.Modules
|
||||
{
|
||||
public class Cat : ModuleBase
|
||||
{
|
||||
[Command("cat"), Summary("Return a random image of a cat.")]
|
||||
public async Task Say()
|
||||
{
|
||||
var client = new RestClient("http://random.cat");
|
||||
|
||||
var request = new RestRequest("meow.php", Method.GET);
|
||||
|
||||
var response = client.Execute<CatObject>(request);
|
||||
await ReplyAsync(response.Data.file);
|
||||
}
|
||||
}
|
||||
|
||||
public class CatObject
|
||||
{
|
||||
public string file {get;set;}
|
||||
}
|
||||
}
|
15
Geekbot.net/Modules/Ping.cs
Normal file
15
Geekbot.net/Modules/Ping.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
|
||||
namespace Geekbot.net.Modules
|
||||
{
|
||||
public class Ping : ModuleBase
|
||||
{
|
||||
[Command("ping"), Summary("Pong.")]
|
||||
public async Task Say()
|
||||
{
|
||||
// ReplyAsync is a method on ModuleBase
|
||||
await ReplyAsync("Pong");
|
||||
}
|
||||
}
|
||||
}
|
23
Geekbot.net/Modules/UserInfo.cs
Normal file
23
Geekbot.net/Modules/UserInfo.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
|
||||
namespace Geekbot.net.Modules
|
||||
{
|
||||
public class UserInfo : ModuleBase
|
||||
{
|
||||
[Alias("stats", "whois")]
|
||||
[Command("user"), Summary("Get information about this user")]
|
||||
public async Task User([Summary("The (optional) user to get info for")] IUser user = null)
|
||||
{
|
||||
var userInfo = user ?? Context.Message.Author;
|
||||
|
||||
var age = Math.Floor((DateTime.Now - userInfo.CreatedAt).TotalDays);
|
||||
|
||||
await ReplyAsync($"{userInfo.Username}#{userInfo.Discriminator}\r\n" +
|
||||
$"Account created at {userInfo.CreatedAt.Day}.{userInfo.CreatedAt.Month}.{userInfo.CreatedAt.Year}, that is {age} days ago\r\n" +
|
||||
$"Currently {userInfo.Status}");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue