TS and Skype suck, correct roll guesses are now being counted
This commit is contained in:
parent
468802d192
commit
f363f7b4fe
5 changed files with 31 additions and 11 deletions
|
@ -4,6 +4,7 @@
|
|||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Cleverbot" Version="0.9.0" />
|
||||
<PackageReference Include="Discord.Net">
|
||||
<Version>1.0.0-rc</Version>
|
||||
</PackageReference>
|
||||
|
|
|
@ -21,16 +21,14 @@ namespace Geekbot.net.Lib
|
|||
{
|
||||
var guildId = ((SocketGuildChannel) message.Channel).Guild.Id;
|
||||
var key = guildId + "-" + message.Author.Id + "-messages";
|
||||
var messages = (int)redis.StringGet(key);
|
||||
redis.StringSet(key, (messages + 1).ToString());
|
||||
await redis.StringIncrementAsync(key);
|
||||
}
|
||||
|
||||
public async Task UpdateGuildRecordAsync()
|
||||
{
|
||||
var guildId = ((SocketGuildChannel) message.Channel).Guild.Id;
|
||||
var key = guildId + "-messages";
|
||||
var messages = (int)redis.StringGet(key);
|
||||
redis.StringSet(key, (messages + 1).ToString());
|
||||
await redis.StringIncrementAsync(key);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -100,14 +100,19 @@ namespace Geekbot.net
|
|||
await message.Channel.SendMessageAsync("hui!!!");
|
||||
return;
|
||||
}
|
||||
if (message.ToString().ToLower().Contains("teamspeak") || message.ToString().ToLower().Contains("skype"))
|
||||
{
|
||||
await message.Channel.SendMessageAsync("How dare you to use such a filthy word in here http://bit.ly/2poL2IZ");
|
||||
return;
|
||||
}
|
||||
if (!(message.HasCharPrefix('!', ref argPos) || message.HasMentionPrefix(client.CurrentUser, ref argPos))) return;
|
||||
var context = new CommandContext(client, message);
|
||||
commands.ExecuteAsync(context, argPos, map);
|
||||
//var result = await commands.ExecuteAsync(context, argPos, map);
|
||||
//if (!result.IsSuccess)
|
||||
//{
|
||||
// await context.Channel.SendMessageAsync(result.ErrorReason);
|
||||
//}
|
||||
//commands.ExecuteAsync(context, argPos, map);
|
||||
var result = await Task.Run(() => commands.ExecuteAsync(context, argPos, map));
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
await context.Channel.SendMessageAsync(result.ErrorReason);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task HandleMessageReceived(SocketMessage messsageParam)
|
||||
|
|
Loading…
Reference in a new issue