diff --git a/Geekbot.net/Lib/Constants.cs b/Geekbot.net/Lib/Constants.cs index 70506a8..db5c875 100644 --- a/Geekbot.net/Lib/Constants.cs +++ b/Geekbot.net/Lib/Constants.cs @@ -3,7 +3,7 @@ public class Constants { public const string Name = "Geekbot"; - public const double BotVersion = 3.4; + public const double BotVersion = 3.5; public const double ApiVersion = 1; } } \ No newline at end of file diff --git a/Geekbot.net/Lib/DbMigration.cs b/Geekbot.net/Lib/DbMigration.cs deleted file mode 100644 index 63b652c..0000000 --- a/Geekbot.net/Lib/DbMigration.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections.Generic; -using System.Threading.Tasks; -using Serilog; -using StackExchange.Redis; - -namespace Geekbot.net.Lib -{ - public class DbMigration - { - public static Task MigrateDatabaseToHash(IDatabase redis, ILogger logger) - { - foreach (var key in redis.Multiplexer.GetServer("127.0.0.1", 6379).Keys(6)) - { - var keyParts = key.ToString().Split("-"); - if (keyParts.Length == 2 || keyParts.Length == 3) - { - logger.Verbose($"Migrating key {key}"); - var stuff = new List(); - stuff.Add("messages"); - stuff.Add("karma"); - stuff.Add("welcomeMsg"); - stuff.Add("correctRolls"); - if(stuff.Contains(keyParts[keyParts.Length - 1])) - { - var val = redis.StringGet(key); - ulong.TryParse(keyParts[0], out ulong guildId); - ulong.TryParse(keyParts[1], out ulong userId); - - switch (keyParts[keyParts.Length - 1]) - { - case "messages": - redis.HashSet($"{guildId}:Messages", new HashEntry[] { new HashEntry(userId.ToString(), val) }); - break; - case "karma": - redis.HashSet($"{guildId}:Karma", new HashEntry[] { new HashEntry(userId.ToString(), val) }); - break; - case "correctRolls": - redis.HashSet($"{guildId}:Rolls", new HashEntry[] { new HashEntry(userId.ToString(), val) }); - break; - case "welcomeMsg": - redis.HashSet($"{guildId}:Settings", new HashEntry[] { new HashEntry("WelcomeMsg", val) }); - break; - } - } - redis.KeyDelete(key); - } - } - return Task.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Geekbot.net/Program.cs b/Geekbot.net/Program.cs index cde241f..0f66838 100755 --- a/Geekbot.net/Program.cs +++ b/Geekbot.net/Program.cs @@ -79,24 +79,6 @@ namespace Geekbot.net logger.Fatal(e, "[Redis] Redis Connection Failed"); Environment.Exit(102); } - - if (args.Contains("--migrate")) - { - Console.WriteLine("\nYou are about to migrate the database, this will overwrite an already migrated database?"); - Console.Write("Are you sure [y:N]: "); - var migrateDbConfirm = Console.ReadKey(); - Console.WriteLine(); - if (migrateDbConfirm.Key == ConsoleKey.Y) - { - logger.Warning("[Geekbot] Starting Migration"); - await DbMigration.MigrateDatabaseToHash(redis, logger); - logger.Warning("[Geekbot] Finished Migration"); - } - else - { - logger.Information("[Geekbot] Not Migrating db"); - } - } token = redis.StringGet("discordToken"); if (token.IsNullOrEmpty)