.gc and stream follows should properly persist restarts

This commit is contained in:
Master Kwoth 2017-06-25 02:35:37 +02:00
parent f11429b714
commit e1baa3942a
6 changed files with 15 additions and 19 deletions

View File

@ -14,6 +14,7 @@ using NadekoBot.Services.Database.Models;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using NadekoBot.Services.Administration; using NadekoBot.Services.Administration;
using System.Diagnostics; using System.Diagnostics;
using NadekoBot.DataStructures;
namespace NadekoBot.Modules.Administration namespace NadekoBot.Modules.Administration
{ {
@ -207,12 +208,11 @@ namespace NadekoBot.Modules.Administration
//todo 2 shard commands //todo 2 shard commands
//[NadekoCommand, Usage, Description, Aliases] //[NadekoCommand, Usage, Description, Aliases]
//[Shard0Precondition]
//[OwnerOnly] //[OwnerOnly]
//public async Task ConnectShard(int shardid) //public async Task RestartShard(int shardid)
//{ //{
// var shard = _client.GetShard(shardid); // if (shardid == 0 || shardid > b)
// if (shard == null)
// { // {
// await ReplyErrorLocalized("no_shard_id").ConfigureAwait(false); // await ReplyErrorLocalized("no_shard_id").ConfigureAwait(false);
// return; // return;

View File

@ -116,7 +116,7 @@ namespace NadekoBot.Modules.Games
bool enabled; bool enabled;
using (var uow = _db.UnitOfWork) using (var uow = _db.UnitOfWork)
{ {
var guildConfig = uow.GuildConfigs.For(channel.Id, set => set.Include(gc => gc.GenerateCurrencyChannelIds)); var guildConfig = uow.GuildConfigs.For(channel.Guild.Id, set => set.Include(gc => gc.GenerateCurrencyChannelIds));
var toAdd = new GCChannelId() { ChannelId = channel.Id }; var toAdd = new GCChannelId() { ChannelId = channel.Id };
if (!guildConfig.GenerateCurrencyChannelIds.Contains(toAdd)) if (!guildConfig.GenerateCurrencyChannelIds.Contains(toAdd))

View File

@ -299,8 +299,6 @@ namespace NadekoBot.Modules.Utility
Format.Bold(x.ConnectionState.ToString()), Format.Bold(x.Guilds.ToString()))) Format.Bold(x.ConnectionState.ToString()), Format.Bold(x.Guilds.ToString())))
.ToArray(); .ToArray();
await Context.Channel.SendPaginatedConfirmAsync(_client, page, (curPage) => await Context.Channel.SendPaginatedConfirmAsync(_client, page, (curPage) =>
{ {

View File

@ -4,8 +4,6 @@ using Discord.WebSocket;
using NadekoBot.Services; using NadekoBot.Services;
using NadekoBot.Services.Impl; using NadekoBot.Services.Impl;
using NLog; using NLog;
using NLog.Config;
using NLog.Targets;
using System; using System;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -28,8 +26,6 @@ using NadekoBot.Services.Help;
using System.IO; using System.IO;
using NadekoBot.Services.Pokemon; using NadekoBot.Services.Pokemon;
using NadekoBot.DataStructures.ShardCom; using NadekoBot.DataStructures.ShardCom;
using NadekoBot.DataStructures;
using NadekoBot.Extensions;
namespace NadekoBot namespace NadekoBot
{ {
@ -295,9 +291,10 @@ namespace NadekoBot
clientReady.TrySetResult(true); clientReady.TrySetResult(true);
try try
{ {
await Task.WhenAll((await Client.GetDMChannelsAsync()) foreach (var chan in (await Client.GetDMChannelsAsync()))
.Select(x => x.CloseAsync())) {
.ConfigureAwait(false); await chan.CloseAsync().ConfigureAwait(false);
}
} }
catch catch
{ {

View File

@ -3096,14 +3096,14 @@
<data name="shardstats_usage" xml:space="preserve"> <data name="shardstats_usage" xml:space="preserve">
<value>`{0}shardstats` or `{0}shardstats 2`</value> <value>`{0}shardstats` or `{0}shardstats 2`</value>
</data> </data>
<data name="connectshard_cmd" xml:space="preserve"> <data name="restartshard_cmd" xml:space="preserve">
<value>connectshard</value> <value>restartshard</value>
</data> </data>
<data name="connectshard_desc" xml:space="preserve"> <data name="restartshard_desc" xml:space="preserve">
<value>Try (re)connecting a shard with a certain shardid when it dies. No one knows will it work. Keep an eye on the console for errors.</value> <value>Try (re)connecting a shard with a certain shardid when it dies. No one knows will it work. Keep an eye on the console for errors.</value>
</data> </data>
<data name="connectshard_usage" xml:space="preserve"> <data name="restartshard_usage" xml:space="preserve">
<value>`{0}connectshard 2`</value> <value>`{0}restartshard 2`</value>
</data> </data>
<data name="shardid_cmd" xml:space="preserve"> <data name="shardid_cmd" xml:space="preserve">
<value>shardid</value> <value>shardid</value>

View File

@ -44,6 +44,7 @@ namespace NadekoBot.Services.Database.Repositories.Impl
.Include(gc => gc.SlowmodeIgnoredUsers) .Include(gc => gc.SlowmodeIgnoredUsers)
.Include(gc => gc.AntiSpamSetting) .Include(gc => gc.AntiSpamSetting)
.ThenInclude(x => x.IgnoredChannels) .ThenInclude(x => x.IgnoredChannels)
.Include(gc => gc.FollowedStreams)
.ToList(); .ToList();
/// <summary> /// <summary>