diff --git a/ChaosBot/Discord/DiscordConnect.cs b/ChaosBot/Discord/DiscordConnect.cs index a670739..c94424e 100644 --- a/ChaosBot/Discord/DiscordConnect.cs +++ b/ChaosBot/Discord/DiscordConnect.cs @@ -48,7 +48,7 @@ namespace ChaosBot.Discord private static Task ReadyAsync() { - LoggingFacade.Info($"Connected as -> [{_client.CurrentUser}] :)"); + LoggingFacade.Info($"Connected as -> [{_client.CurrentUser}] :)"); return Task.CompletedTask; } diff --git a/ChaosBot/Discord/Services/CommandHandler.cs b/ChaosBot/Discord/Services/CommandHandler.cs index 4086434..e9dae59 100644 --- a/ChaosBot/Discord/Services/CommandHandler.cs +++ b/ChaosBot/Discord/Services/CommandHandler.cs @@ -2,15 +2,13 @@ using System.Linq; using System.Reflection; using System.Threading.Tasks; -using ChaosBot.Discord.Modules.User; using ChaosBot.Models; using ChaosBot.Repositories; -using Microsoft.Extensions.DependencyInjection; using Discord; using Discord.Commands; using Discord.WebSocket; using Microsoft.EntityFrameworkCore; -using NLog; +using Microsoft.Extensions.DependencyInjection; namespace ChaosBot.Discord.Services { @@ -65,7 +63,7 @@ namespace ChaosBot.Discord.Services int argPos = 0; - string prefix = ConfigurationRepository.GetValue("Discord:Prefix", context.Guild.Id, "!"); + string prefix = ConfigurationRepository.GetValue("Discord:Prefix", context.Guild.Id, "!"); if (!(message.HasMentionPrefix(_client.CurrentUser, ref argPos) || message.HasStringPrefix(prefix, ref argPos))) { @@ -73,7 +71,7 @@ namespace ChaosBot.Discord.Services return; } - if(Convert.ToBoolean(ConfigurationRepository.GetValue("Experience:Commands", context.Guild.Id, "false"))) + if(Convert.ToBoolean(ConfigurationRepository.GetValue("Experience:Commands", context.Guild.Id, "false"))) ExperienceHandler.AddXp(context); bool customCommandExecuted = await CustomCommandHandler.CheckCommand(context, argPos); @@ -139,8 +137,8 @@ namespace ChaosBot.Discord.Services await dbContext.SaveChangesAsync(); } - IQueryable ctxUserLS = dbContext.LodestoneCharacter; - IQueryable userChar = ctxUserLS + IQueryable ctxUserLs = dbContext.LodestoneCharacter; + IQueryable userChar = ctxUserLs .Where(p => p.DiscordGuildId.Equals(user.Guild.Id)) .Where(p => p.DiscordUserId.Equals(user.Id)); diff --git a/ChaosBot/Discord/Services/CustomCommandHandler.cs b/ChaosBot/Discord/Services/CustomCommandHandler.cs index 55c0f8b..9cf7b56 100644 --- a/ChaosBot/Discord/Services/CustomCommandHandler.cs +++ b/ChaosBot/Discord/Services/CustomCommandHandler.cs @@ -18,7 +18,7 @@ namespace ChaosBot.Discord.Services IQueryable customCommandQuery = dbContext.CustomCommands; CustomCommand customCommand = customCommandQuery .Where(cc => cc.DiscordGuildId == context.Guild.Id) - .FirstOrDefault(cc => command.StartsWith((string) cc.Command)); + .FirstOrDefault(cc => command.StartsWith(cc.Command)); if (customCommand == null) return false; diff --git a/ChaosBot/Discord/Services/ExperienceHandler.cs b/ChaosBot/Discord/Services/ExperienceHandler.cs index 6030dc5..8880bba 100644 --- a/ChaosBot/Discord/Services/ExperienceHandler.cs +++ b/ChaosBot/Discord/Services/ExperienceHandler.cs @@ -66,10 +66,10 @@ namespace ChaosBot.Discord.Services { // The user has leveled up, we can send a message string channelToSendIn = - ConfigurationRepository.GetValue("LevelUp:Channel", context.Guild.Id, "false"); + ConfigurationRepository.GetValue("LevelUp:Channel", context.Guild.Id, "false"); string mentionString = $"<@{context.User.Id}>"; - if (!Convert.ToBoolean(ConfigurationRepository.GetValue("LevelUp:MentionUser", context.Guild.Id, "true"))) + if (!Convert.ToBoolean(ConfigurationRepository.GetValue("LevelUp:MentionUser", context.Guild.Id, "true"))) { mentionString = context.User.Username; if (context.User is IGuildUser guildUser) @@ -103,10 +103,10 @@ namespace ChaosBot.Discord.Services private static ulong CheckLevel(Experience usrExperience) { ulong curLevel = usrExperience.Level; - ulong curXP = usrExperience.Amount; - ulong nextLevelXP = 5 * curLevel * curLevel * curLevel + 95 * curLevel; + ulong curXp = usrExperience.Amount; + ulong nextLevelXp = 5 * curLevel * curLevel * curLevel + 95 * curLevel; - if (curXP > nextLevelXP) + if (curXp > nextLevelXp) return curLevel + 1; return curLevel; } diff --git a/ChaosBot/Discord/Services/TimerHandler.cs b/ChaosBot/Discord/Services/TimerHandler.cs index bf462cb..fe5850b 100644 --- a/ChaosBot/Discord/Services/TimerHandler.cs +++ b/ChaosBot/Discord/Services/TimerHandler.cs @@ -19,7 +19,7 @@ namespace ChaosBot.Discord.Services foreach (IConfigurationSection serverConfig in Program.AppSettingsHandler.GetSection("Servers").GetChildren()) { long? lodestoneChannelSloganDescriptionId = serverConfig.GetValue("Lodestone:SloganDescription:Channel", null); - int refreshMinutes = serverConfig.GetValue("Lodestone:SloganDescription:RefreshMinutes", 60); + int refreshMinutes = serverConfig.GetValue("Lodestone:SloganDescription:RefreshMinutes", 60); if (lodestoneChannelSloganDescriptionId == null) continue; diff --git a/ChaosBot/Logging.cs b/ChaosBot/Logging.cs index 0bf2450..212a8e1 100644 --- a/ChaosBot/Logging.cs +++ b/ChaosBot/Logging.cs @@ -1,13 +1,11 @@ using System; -using System.Diagnostics; -using System.Reflection; using Microsoft.Extensions.Configuration; using NLog; using NLog.Extensions.Logging; namespace ChaosBot { - public class Logging + public static class Logging { public static Logger GenLog(IConfiguration appSettingsHandler) {