Fixed .poll and .pollend

This commit is contained in:
Master Kwoth 2017-10-24 18:50:51 +02:00
parent 08fc1b12f7
commit ffcaa594c9
3 changed files with 11 additions and 8 deletions

View File

@ -39,7 +39,7 @@ namespace NadekoBot.Modules.Games
private async Task InternalStartPoll(string arg) private async Task InternalStartPoll(string arg)
{ {
if(await _service.StartPoll(Context.Channel.Id, Context.Message, arg) == false) if(await _service.StartPoll(Context.Guild.Id, Context.Message, arg) == false)
await ReplyErrorLocalized("poll_already_running").ConfigureAwait(false); await ReplyErrorLocalized("poll_already_running").ConfigureAwait(false);
} }
@ -50,8 +50,8 @@ namespace NadekoBot.Modules.Games
{ {
var channel = (ITextChannel)Context.Channel; var channel = (ITextChannel)Context.Channel;
_service.ActivePolls.TryRemove(channel.Guild.Id, out var poll); if(_service.ActivePolls.TryRemove(channel.Guild.Id, out var poll))
await poll.StopPoll().ConfigureAwait(false); await poll.StopPoll().ConfigureAwait(false);
} }
} }
} }

View File

@ -21,7 +21,7 @@ namespace NadekoBot.Core.Services.Impl
private readonly IBotCredentials _creds; private readonly IBotCredentials _creds;
private readonly DateTime _started; private readonly DateTime _started;
public const string BotVersion = "2.1.2"; public const string BotVersion = "2.1.4";
public string Author => "Kwoth#2560"; public string Author => "Kwoth#2560";
public string Library => "Discord.Net"; public string Library => "Discord.Net";

View File

@ -88,16 +88,19 @@ namespace NadekoBot.Core.Services
{ {
//add it to the list of shards which should be started //add it to the list of shards which should be started
#if DEBUG #if DEBUG
if (i > 0) if (i > 0)
_shardStartQueue.Enqueue(i); _shardStartQueue.Enqueue(i);
else
_shardProcesses[i] = Process.GetCurrentProcess();
#else #else
_shardStartQueue.Enqueue(i); _shardStartQueue.Enqueue(i);
#endif #endif
//set the shard's initial state in redis cache //set the shard's initial state in redis cache
_defaultShardState.ShardId = i; _defaultShardState.ShardId = i;
//this is to avoid the shard coordinator thinking that //this is to avoid the shard coordinator thinking that
//the shard is unresponsive while startup up //the shard is unresponsive while startup up
_defaultShardState.Time = DateTime.UtcNow + TimeSpan.FromSeconds(20 * i); _defaultShardState.Time = DateTime.UtcNow + TimeSpan.FromSeconds(45 * (i + 1));
db.ListRightPush(_key + "_shardstats", db.ListRightPush(_key + "_shardstats",
JsonConvert.SerializeObject(_defaultShardState), JsonConvert.SerializeObject(_defaultShardState),
flags: CommandFlags.FireAndForget); flags: CommandFlags.FireAndForget);
@ -241,7 +244,7 @@ namespace NadekoBot.Core.Services
await tsc.Task.ConfigureAwait(false); await tsc.Task.ConfigureAwait(false);
while (true) while (true)
{ {
await Task.Delay(10000).ConfigureAwait(false); await Task.Delay(15000).ConfigureAwait(false);
try try
{ {
var db = _redis.GetDatabase(); var db = _redis.GetDatabase();