Fixes to currency stuff

This commit is contained in:
Kwoth 2016-09-09 00:21:53 +02:00
parent 61390e8530
commit 77373a4a4a
5 changed files with 22 additions and 23 deletions

View File

@ -7,7 +7,6 @@ using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace NadekoBot.Modules.Administration.Commands
{
@ -53,7 +52,7 @@ namespace NadekoBot.Modules.Administration.Commands
catch { }
};
};
#if !NADEKO_RELEASE
// start the userpresence queue
NadekoBot.OnReady += () =>
@ -86,6 +85,7 @@ namespace NadekoBot.Modules.Administration.Commands
}
});
};
#endif
}
private async void ChannelUpdated(object sender, ChannelUpdatedEventArgs e)

View File

@ -1,9 +1,7 @@
using Discord.Commands;
using NadekoBot.Classes;
using NadekoBot.Modules.Games.Commands.Trivia;
using System;
using System.Collections.Concurrent;
using System.Linq;
namespace NadekoBot.Modules.Games.Commands
{
@ -24,25 +22,26 @@ namespace NadekoBot.Modules.Games.Commands
.Parameter("args", ParameterType.Multiple)
.Do(async e =>
{
TriviaGame trivia;
if (!RunningTrivias.TryGetValue(e.Server.Id, out trivia))
{
var showHints = !e.Args.Contains("nohint");
var number = e.Args.Select(s =>
{
int num;
return new Tuple<bool, int>(int.TryParse(s, out num), num);
}).Where(t => t.Item1).Select(t => t.Item2).FirstOrDefault();
if (number < 0)
return;
var triviaGame = new TriviaGame(e, showHints, number == 0 ? 10 : number);
if (RunningTrivias.TryAdd(e.Server.Id, triviaGame))
await e.Channel.SendMessage($"**Trivia game started! {triviaGame.WinRequirement} points needed to win.**").ConfigureAwait(false);
else
await triviaGame.StopGame().ConfigureAwait(false);
}
else
await e.Channel.SendMessage("Trivia game is already running on this server.\n" + trivia.CurrentQuestion).ConfigureAwait(false);
//TriviaGame trivia;
//if (!RunningTrivias.TryGetValue(e.Server.Id, out trivia))
//{
// var showHints = !e.Args.Contains("nohint");
// var number = e.Args.Select(s =>
// {
// int num;
// return new Tuple<bool, int>(int.TryParse(s, out num), num);
// }).Where(t => t.Item1).Select(t => t.Item2).FirstOrDefault();
// if (number < 0)
// return;
// var triviaGame = new TriviaGame(e, showHints, number == 0 ? 10 : number);
// if (RunningTrivias.TryAdd(e.Server.Id, triviaGame))
// await e.Channel.SendMessage($"**Trivia game started! {triviaGame.WinRequirement} points needed to win.**").ConfigureAwait(false);
// else
// await triviaGame.StopGame().ConfigureAwait(false);
//}
//else
// await e.Channel.SendMessage("Trivia game is already running on this server.\n" + trivia.CurrentQuestion).ConfigureAwait(false);
await e.Channel.SendMessage("`Trivia game is temporarily disabled.`").ConfigureAwait(false);
});
cgb.CreateCommand(Module.Prefix + "tl")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB