Migration stuff, fixes

This commit is contained in:
Kwoth 2016-10-11 09:39:51 +02:00
parent c0e20eb079
commit 1f7c19b306
4 changed files with 9 additions and 8 deletions

View File

@ -116,6 +116,8 @@ namespace NadekoBot.Modules.Administration
guildConfig.GenerateCurrencyChannelIds = new HashSet<GCChannelId>(data.GenerateCurrencyChannels.Select(gc => new GCChannelId() { ChannelId = gc.Key }));
uow.SelfAssignedRoles.AddRange(data.ListOfSelfAssignableRoles.Select(r => new SelfAssignedRole() { GuildId = guildId, RoleId = r }).ToArray());
var logSetting = guildConfig.LogSetting;
guildConfig.LogSetting.IsLogging = data.LogChannel != null;
guildConfig.LogSetting.ChannelId = data.LogChannel ?? 0;
guildConfig.LogSetting.IgnoredChannels = new HashSet<IgnoredLogChannel>(data.LogserverIgnoreChannels.Select(id => new IgnoredLogChannel() { ChannelId = id }));
guildConfig.FollowedStreams = new HashSet<FollowedStream>(data.ObservingStreams.Select(x =>
{
@ -151,7 +153,8 @@ namespace NadekoBot.Modules.Administration
private void MigratePermissions0_9(IUnitOfWork uow)
{
var PermissionsDict = new ConcurrentDictionary<ulong, ServerPermissions0_9>();
Directory.CreateDirectory("data/permissions");
if (!Directory.Exists("data/permissions/"))
throw new MigrationException();
foreach (var file in Directory.EnumerateFiles("data/permissions/"))
{
try
@ -212,7 +215,7 @@ namespace NadekoBot.Modules.Administration
private void MigrateConfig0_9(BotConfig botConfig)
{
Config0_9 oldConfig;
const string configPath = "./data/config.json";
const string configPath = "data/config.json";
try
{
oldConfig = JsonConvert.DeserializeObject<Config0_9>(File.ReadAllText(configPath));
@ -229,7 +232,6 @@ namespace NadekoBot.Modules.Administration
}
//Basic
botConfig.DontJoinServers = oldConfig.DontJoinServers;
botConfig.ForwardMessages = oldConfig.ForwardMessages;
botConfig.ForwardToAllOwners = oldConfig.ForwardToAllOwners;
botConfig.BufferSize = (ulong)oldConfig.BufferSize;

View File

@ -165,10 +165,10 @@ namespace NadekoBot.Modules.Administration.Commands.Migration
internal class ServerSpecificConfig
{
public bool VoicePlusTextEnabled { get; set; }
private bool SendPrivateMessageOnMention { get; set; }
private ulong? LogChannel { get; set; } = null;
public bool SendPrivateMessageOnMention { get; set; }
public ulong? LogChannel { get; set; } = null;
public ulong? LogPresenceChannel = null;
public HashSet<ulong> LogserverIgnoreChannels { get; set; }
private ulong? LogPresenceChannel = null;
public ConcurrentDictionary<ulong, ulong> VoiceChannelLog { get; set; }
public HashSet<ulong> ListOfSelfAssignableRoles { get; set; }
public ulong AutoAssignedRole { get; set; }

View File

@ -136,7 +136,7 @@ namespace NadekoBot.Modules.Help
helpstr.AppendLine("----------------|--------------|-------");
lastModule = com.Module.Name;
}
helpstr.AppendLine($"`{com.Text}` {string.Join(" ", com.Aliases.Skip(1).Select(a=>"`"+a+"`"))} | {com.Summary} | {com.Remarks} {GetCommandRequirements(com)}");
helpstr.AppendLine($"`{com.Text}` {string.Join(" ", com.Aliases.Skip(1).Select(a=>"`"+a+"`"))} | {com.Summary} | {com.Remarks.Replace("|","\\|")} {GetCommandRequirements(com)}");
}
helpstr = helpstr.Replace(NadekoBot.Client.GetCurrentUser().Username , "@BotName");
#if DEBUG

View File

@ -13,7 +13,6 @@ namespace NadekoBot.Services.Database.Models
{
public HashSet<BlacklistItem> Blacklist { get; set; }
public ulong BufferSize { get; set; } = 4000000;
public bool DontJoinServers { get; set; } = false;
public bool ForwardMessages { get; set; } = true;
public bool ForwardToAllOwners { get; set; } = true;