From 11ab5186b850622c9760e11e68246639e145d7d9 Mon Sep 17 00:00:00 2001 From: Daniel-I-Am Date: Fri, 5 Jun 2020 03:26:54 +0200 Subject: [PATCH] General cleanup of imports, indenting and logging source --- ChaosBot/Attribute/AssemblyController.cs | 2 -- ChaosBot/Attribute/DBEntity.cs | 1 - ChaosBot/Database/Controller.cs | 11 +++++------ ChaosBot/Discord/Modules/AdminCommands.cs | 16 +++++++--------- ChaosBot/Discord/Modules/DiceCommands.cs | 2 +- ChaosBot/Discord/Modules/RaffleSystem.cs | 5 ++--- ChaosBot/Program.cs | 1 - 7 files changed, 15 insertions(+), 23 deletions(-) diff --git a/ChaosBot/Attribute/AssemblyController.cs b/ChaosBot/Attribute/AssemblyController.cs index 89bdefa..8d02727 100644 --- a/ChaosBot/Attribute/AssemblyController.cs +++ b/ChaosBot/Attribute/AssemblyController.cs @@ -3,9 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; -using Antlr4.Runtime; using ChaosBot.Database; -using Microsoft.Data.Sqlite; using NLog; namespace ChaosBot.Attribute diff --git a/ChaosBot/Attribute/DBEntity.cs b/ChaosBot/Attribute/DBEntity.cs index 6ee2b60..da812b2 100644 --- a/ChaosBot/Attribute/DBEntity.cs +++ b/ChaosBot/Attribute/DBEntity.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using Discord; using Microsoft.Data.Sqlite; namespace ChaosBot.Attribute diff --git a/ChaosBot/Database/Controller.cs b/ChaosBot/Database/Controller.cs index e35202b..f506cf4 100644 --- a/ChaosBot/Database/Controller.cs +++ b/ChaosBot/Database/Controller.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Data; -using System.Linq; using System.Text; using Microsoft.Data.Sqlite; using Microsoft.Extensions.Configuration; @@ -48,7 +47,7 @@ namespace ChaosBot.Database throw; } - _logger.Fatal($"Controllers.DBWork.RawQuery: Exception [{ex}] thrown, <[{ex.Message}]>."); + _logger.Fatal($"Database.Controller.RawQuery: Exception [{ex}] thrown, <[{ex.Message}]>."); } return dt; @@ -99,7 +98,7 @@ namespace ChaosBot.Database } catch (Exception ex) { - _logger.Fatal($"Controllers.DBWork.RawQuery: Exception [{ex}] thrown, <[{ex.Message}]>."); + _logger.Fatal($"Database.Controller.InsertQuery: Exception [{ex}] thrown, <[{ex.Message}]>."); } } @@ -149,7 +148,7 @@ namespace ChaosBot.Database } catch (Exception ex) { - _logger.Fatal($"Controllers.DBWork.RawQuery: Exception [{ex}] thrown, <[{ex.Message}]>."); + _logger.Fatal($"Database.Controller.UpdateQuery: Exception [{ex}] thrown, <[{ex.Message}]>."); } } @@ -253,7 +252,7 @@ namespace ChaosBot.Database } catch (Exception ex) { - _logger.Fatal($"Controllers.DBWork.RawQuery: Exception [{ex}] thrown, <[{ex.Message}]>."); + _logger.Fatal($"Database.Controller.SelectQuery: Exception [{ex}] thrown, <[{ex.Message}]>."); } return dt; @@ -305,7 +304,7 @@ namespace ChaosBot.Database } catch (Exception ex) { - _logger.Fatal($"Controllers.DBWork.RawQuery: Exception [{ex}] thrown, <[{ex.Message}]>."); + _logger.Fatal($"Database.Controller.DeleteQuery: Exception [{ex}] thrown, <[{ex.Message}]>."); } } } diff --git a/ChaosBot/Discord/Modules/AdminCommands.cs b/ChaosBot/Discord/Modules/AdminCommands.cs index 82f8fb1..83d3f88 100644 --- a/ChaosBot/Discord/Modules/AdminCommands.cs +++ b/ChaosBot/Discord/Modules/AdminCommands.cs @@ -1,10 +1,8 @@ using System; using Discord; -using System.Text; using Discord.Commands; using System.Threading.Tasks; using System.Collections.Generic; -using Microsoft.Extensions.Configuration; using NLog; @@ -23,16 +21,16 @@ namespace ChaosBot.Discord.Modules { try { - IEnumerable messages = await Context.Channel.GetMessagesAsync(msgtoDelete + 1).FlattenAsync(); - await ((ITextChannel) Context.Channel).DeleteMessagesAsync(messages); - const int delay = 3000; - IUserMessage m = await ReplyAsync($"{msgtoDelete} messages deleted."); - await Task.Delay(delay); - await m.DeleteAsync(); + IEnumerable messages = await Context.Channel.GetMessagesAsync(msgtoDelete + 1).FlattenAsync(); + await ((ITextChannel) Context.Channel).DeleteMessagesAsync(messages); + const int delay = 3000; + IUserMessage m = await ReplyAsync($"{msgtoDelete} messages deleted."); + await Task.Delay(delay); + await m.DeleteAsync(); } catch (Exception ex) { - _logger.Error($"InfoCommands.InfoCommand: Exception [{ex}] thrown, <[{ex.Message}]>."); + _logger.Error($"AdminCommands.ClearCommand: Exception [{ex}] thrown, <[{ex.Message}]>."); } } } diff --git a/ChaosBot/Discord/Modules/DiceCommands.cs b/ChaosBot/Discord/Modules/DiceCommands.cs index 828a2a9..7386aec 100644 --- a/ChaosBot/Discord/Modules/DiceCommands.cs +++ b/ChaosBot/Discord/Modules/DiceCommands.cs @@ -44,7 +44,7 @@ namespace ChaosBot.Discord.Modules } catch (Exception ex) { - _logger.Error($"diceCommands.RollCommand: Exception [{ex}] thrown, <[{ex.Message}]>."); + _logger.Error($"DiceCommands.Roll: Exception [{ex}] thrown, <[{ex.Message}]>."); } } diff --git a/ChaosBot/Discord/Modules/RaffleSystem.cs b/ChaosBot/Discord/Modules/RaffleSystem.cs index 6cc9494..f286bec 100644 --- a/ChaosBot/Discord/Modules/RaffleSystem.cs +++ b/ChaosBot/Discord/Modules/RaffleSystem.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; using ChaosBot.Database.Entity; @@ -52,7 +51,7 @@ namespace ChaosBot.Discord.Modules } catch (Exception ex) { - _logger.Error($"InfoCommands.InfoCommand: Exception [{ex}] thrown, <[{ex.Message}]>."); + _logger.Error($"RaffleSystem.RaffleCommandInfo: Exception [{ex}] thrown, <[{ex.Message}]>."); } } @@ -128,7 +127,7 @@ namespace ChaosBot.Discord.Modules } catch (Exception ex) { - _logger.Error($"InfoCommands.InfoCommand: Exception [{ex}] thrown, <[{ex.Message}]>."); + _logger.Error($"RaffleSystem.RaffleCommandHelper: Exception [{ex}] thrown, <[{ex.Message}]>."); } } diff --git a/ChaosBot/Program.cs b/ChaosBot/Program.cs index e882adb..11d40b7 100644 --- a/ChaosBot/Program.cs +++ b/ChaosBot/Program.cs @@ -1,6 +1,5 @@ using NLog; using System; -using System.Reflection; using ChaosBot.Discord; using System.Threading.Tasks; using ChaosBot.Attribute;