TS and Skype suck, correct roll guesses are now being counted

This commit is contained in:
Runebaas 2017-04-22 23:41:15 +02:00
parent 468802d192
commit f363f7b4fe
5 changed files with 31 additions and 11 deletions

View file

@ -1,11 +1,18 @@
using System;
using System.Threading.Tasks;
using Discord.Commands;
using Geekbot.net.Lib;
namespace Geekbot.net.Modules
{
public class Roll : ModuleBase
{
private readonly IRedisClient redis;
public Roll(IRedisClient redisClient)
{
redis = redisClient;
}
[Command("roll"), Summary("Roll a number between 1 and 100.")]
public async Task RollCommand([Remainder, Summary("stuff...")] string stuff = "nothing")
{
@ -19,6 +26,9 @@ namespace Geekbot.net.Modules
if (guess == number)
{
await ReplyAsync($"Congratulations {Context.User.Username}, your guess was correct!");
var key = $"{Context.Guild.Id}-{Context.User.Id}-correctRolls";
var messages = (int)redis.Client.StringGet(key);
redis.Client.StringSet(key, (messages + 1).ToString());
}
}
else

View file

@ -41,7 +41,13 @@ namespace Geekbot.net.Modules
{
eb.AddField("Karma", karma);
}
var correctRolls = redis.Client.StringGet($"{Context.Guild.Id}-{Context.User.Id}-correctRolls");
if (!correctRolls.IsNullOrEmpty)
{
eb.AddField("Guessed Rolls", correctRolls);
}
await ReplyAsync("", false, eb.Build());
}