diff --git a/Geekbot.net/Geekbot.net.csproj b/Geekbot.net/Geekbot.net.csproj index cc93438..f943a96 100755 --- a/Geekbot.net/Geekbot.net.csproj +++ b/Geekbot.net/Geekbot.net.csproj @@ -4,6 +4,7 @@ netcoreapp1.1 + 1.0.0-rc diff --git a/Geekbot.net/Lib/StatsRecorder.cs b/Geekbot.net/Lib/StatsRecorder.cs index 74a2db9..3a38f73 100644 --- a/Geekbot.net/Lib/StatsRecorder.cs +++ b/Geekbot.net/Lib/StatsRecorder.cs @@ -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); } } } \ No newline at end of file diff --git a/Geekbot.net/Modules/Roll.cs b/Geekbot.net/Modules/Roll.cs index b7e4636..b0d162e 100644 --- a/Geekbot.net/Modules/Roll.cs +++ b/Geekbot.net/Modules/Roll.cs @@ -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 diff --git a/Geekbot.net/Modules/UserInfo.cs b/Geekbot.net/Modules/UserInfo.cs index 55aaba1..12cde6e 100644 --- a/Geekbot.net/Modules/UserInfo.cs +++ b/Geekbot.net/Modules/UserInfo.cs @@ -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()); } diff --git a/Geekbot.net/Program.cs b/Geekbot.net/Program.cs index 48d136d..61b80a5 100755 --- a/Geekbot.net/Program.cs +++ b/Geekbot.net/Program.cs @@ -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)