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>
|
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Cleverbot" Version="0.9.0" />
|
||||||
<PackageReference Include="Discord.Net">
|
<PackageReference Include="Discord.Net">
|
||||||
<Version>1.0.0-rc</Version>
|
<Version>1.0.0-rc</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|
|
@ -21,16 +21,14 @@ namespace Geekbot.net.Lib
|
||||||
{
|
{
|
||||||
var guildId = ((SocketGuildChannel) message.Channel).Guild.Id;
|
var guildId = ((SocketGuildChannel) message.Channel).Guild.Id;
|
||||||
var key = guildId + "-" + message.Author.Id + "-messages";
|
var key = guildId + "-" + message.Author.Id + "-messages";
|
||||||
var messages = (int)redis.StringGet(key);
|
await redis.StringIncrementAsync(key);
|
||||||
redis.StringSet(key, (messages + 1).ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateGuildRecordAsync()
|
public async Task UpdateGuildRecordAsync()
|
||||||
{
|
{
|
||||||
var guildId = ((SocketGuildChannel) message.Channel).Guild.Id;
|
var guildId = ((SocketGuildChannel) message.Channel).Guild.Id;
|
||||||
var key = guildId + "-messages";
|
var key = guildId + "-messages";
|
||||||
var messages = (int)redis.StringGet(key);
|
await redis.StringIncrementAsync(key);
|
||||||
redis.StringSet(key, (messages + 1).ToString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,11 +1,18 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
|
using Geekbot.net.Lib;
|
||||||
|
|
||||||
namespace Geekbot.net.Modules
|
namespace Geekbot.net.Modules
|
||||||
{
|
{
|
||||||
public class Roll : ModuleBase
|
public class Roll : ModuleBase
|
||||||
{
|
{
|
||||||
|
private readonly IRedisClient redis;
|
||||||
|
public Roll(IRedisClient redisClient)
|
||||||
|
{
|
||||||
|
redis = redisClient;
|
||||||
|
}
|
||||||
|
|
||||||
[Command("roll"), Summary("Roll a number between 1 and 100.")]
|
[Command("roll"), Summary("Roll a number between 1 and 100.")]
|
||||||
public async Task RollCommand([Remainder, Summary("stuff...")] string stuff = "nothing")
|
public async Task RollCommand([Remainder, Summary("stuff...")] string stuff = "nothing")
|
||||||
{
|
{
|
||||||
|
@ -19,6 +26,9 @@ namespace Geekbot.net.Modules
|
||||||
if (guess == number)
|
if (guess == number)
|
||||||
{
|
{
|
||||||
await ReplyAsync($"Congratulations {Context.User.Username}, your guess was correct!");
|
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
|
else
|
||||||
|
|
|
@ -41,7 +41,13 @@ namespace Geekbot.net.Modules
|
||||||
{
|
{
|
||||||
eb.AddField("Karma", karma);
|
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());
|
await ReplyAsync("", false, eb.Build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,14 +100,19 @@ namespace Geekbot.net
|
||||||
await message.Channel.SendMessageAsync("hui!!!");
|
await message.Channel.SendMessageAsync("hui!!!");
|
||||||
return;
|
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;
|
if (!(message.HasCharPrefix('!', ref argPos) || message.HasMentionPrefix(client.CurrentUser, ref argPos))) return;
|
||||||
var context = new CommandContext(client, message);
|
var context = new CommandContext(client, message);
|
||||||
commands.ExecuteAsync(context, argPos, map);
|
//commands.ExecuteAsync(context, argPos, map);
|
||||||
//var result = await commands.ExecuteAsync(context, argPos, map);
|
var result = await Task.Run(() => commands.ExecuteAsync(context, argPos, map));
|
||||||
//if (!result.IsSuccess)
|
if (!result.IsSuccess)
|
||||||
//{
|
{
|
||||||
// await context.Channel.SendMessageAsync(result.ErrorReason);
|
await context.Channel.SendMessageAsync(result.ErrorReason);
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task HandleMessageReceived(SocketMessage messsageParam)
|
public async Task HandleMessageReceived(SocketMessage messsageParam)
|
||||||
|
|
Loading…
Reference in a new issue