Embeds, Cleanup and Improvements to Roll, Userinfo the init process
This commit is contained in:
parent
6d5c6f2ea8
commit
735a4a81d4
5 changed files with 65 additions and 33 deletions
21
Geekbot.net/Modules/Info.cs
Normal file
21
Geekbot.net/Modules/Info.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Discord;
|
||||
|
||||
namespace Geekbot.net.Modules
|
||||
{
|
||||
public class Info : ModuleBase
|
||||
{
|
||||
[Command("info"), Summary("Show some info about the bot.")]
|
||||
public async Task getInfo()
|
||||
{
|
||||
var eb = new EmbedBuilder();
|
||||
eb.WithAuthor(new EmbedAuthorBuilder()
|
||||
.WithIconUrl(Context.User.GetAvatarUrl())
|
||||
.WithName(Context.User.Username));
|
||||
eb.AddField("Test", "Some testing stuff here...");
|
||||
await ReplyAsync("", false, eb.Build());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,11 +7,24 @@ namespace Geekbot.net.Modules
|
|||
public class Roll : ModuleBase
|
||||
{
|
||||
[Command("roll"), Summary("Roll a number between 1 and 100.")]
|
||||
public async Task RollCommand()
|
||||
public async Task RollCommand([Remainder, Summary("stuff...")] string stuff = "nothing")
|
||||
{
|
||||
var rnd = new Random();
|
||||
var number = rnd.Next(1, 100);
|
||||
await ReplyAsync(Context.Message.Author.Mention + ", you rolled " + number);
|
||||
var guess = 1000;
|
||||
int.TryParse(stuff, out guess);
|
||||
if (guess <= 100 && guess > 0)
|
||||
{
|
||||
await ReplyAsync($"{Context.Message.Author.Mention} you rolled {number}, your guess was {guess}");
|
||||
if (guess == number)
|
||||
{
|
||||
await ReplyAsync($"Congratulations {Context.User.Username}, your guess was correct!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await ReplyAsync(Context.Message.Author.Mention + ", you rolled " + number);
|
||||
}
|
||||
}
|
||||
|
||||
[Command("dice"), Summary("Roll a dice")]
|
||||
|
|
|
@ -21,34 +21,25 @@ namespace Geekbot.net.Modules
|
|||
var messages = (int)redis.StringGet(key + "-messages");
|
||||
var level = GetLevelAtExperience(messages);
|
||||
|
||||
var reply = "";
|
||||
|
||||
if (Context.Message.Author.Id == userInfo.Id)
|
||||
{
|
||||
reply = reply + $"here are your stats {userInfo.Mention}\r\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
reply = reply + $"here are {userInfo.Mention}'s stats\r\n";
|
||||
}
|
||||
|
||||
reply = reply + $"```\r\n";
|
||||
reply = reply + $"Discordian Since: {userInfo.CreatedAt.Day}/{userInfo.CreatedAt.Month}/{userInfo.CreatedAt.Year} ({age} days)\r\n";
|
||||
reply = reply + $"Level: {level}\r\n";
|
||||
reply = reply + $"Messages Sent: {messages}\r\n";
|
||||
var eb = new EmbedBuilder();
|
||||
eb.WithAuthor(new EmbedAuthorBuilder()
|
||||
.WithIconUrl(userInfo.GetAvatarUrl())
|
||||
.WithName(userInfo.Username));
|
||||
|
||||
var jokeKarma = redis.StringGet(key + "-karma");
|
||||
if (!jokeKarma.IsNullOrEmpty)
|
||||
eb.AddField("Discordian Since", $"{userInfo.CreatedAt.Day}/{userInfo.CreatedAt.Month}/{userInfo.CreatedAt.Year} ({age} days)");
|
||||
eb.AddField("Level", level);
|
||||
eb.AddField("Messages Sent", messages);
|
||||
|
||||
var karma = redis.StringGet(key + "-karma");
|
||||
if (!karma.IsNullOrEmpty)
|
||||
{
|
||||
reply = reply + $"Karma: {jokeKarma}\r\n";
|
||||
eb.AddField("Karma", karma);
|
||||
}
|
||||
|
||||
reply = reply + $"```";
|
||||
|
||||
await ReplyAsync(reply);
|
||||
|
||||
await ReplyAsync("", false, eb.Build());
|
||||
}
|
||||
|
||||
public async Task GetLevel([Summary("The (optional) user to get info for")] string xp)
|
||||
public async Task GetLevel(string xp)
|
||||
{
|
||||
var level = GetLevelAtExperience(int.Parse(xp));
|
||||
await ReplyAsync(level.ToString());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue