Fix IDE warnings

This commit is contained in:
Daniel_I_Am 2020-08-30 15:29:44 +02:00
parent bc20751037
commit 78038f8991
No known key found for this signature in database
GPG Key ID: 80C428FCC9743E84
6 changed files with 14 additions and 18 deletions

View File

@ -48,7 +48,7 @@ namespace ChaosBot.Discord
private static Task ReadyAsync() private static Task ReadyAsync()
{ {
LoggingFacade.Info($"Connected as -> [{_client.CurrentUser}] :)"); LoggingFacade.Info($"Connected as -> [{_client.CurrentUser}] :)");
return Task.CompletedTask; return Task.CompletedTask;
} }

View File

@ -2,15 +2,13 @@
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using ChaosBot.Discord.Modules.User;
using ChaosBot.Models; using ChaosBot.Models;
using ChaosBot.Repositories; using ChaosBot.Repositories;
using Microsoft.Extensions.DependencyInjection;
using Discord; using Discord;
using Discord.Commands; using Discord.Commands;
using Discord.WebSocket; using Discord.WebSocket;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using NLog; using Microsoft.Extensions.DependencyInjection;
namespace ChaosBot.Discord.Services namespace ChaosBot.Discord.Services
{ {
@ -65,7 +63,7 @@ namespace ChaosBot.Discord.Services
int argPos = 0; int argPos = 0;
string prefix = ConfigurationRepository.GetValue<string>("Discord:Prefix", context.Guild.Id, "!"); string prefix = ConfigurationRepository.GetValue("Discord:Prefix", context.Guild.Id, "!");
if (!(message.HasMentionPrefix(_client.CurrentUser, ref argPos) || if (!(message.HasMentionPrefix(_client.CurrentUser, ref argPos) ||
message.HasStringPrefix(prefix, ref argPos))) message.HasStringPrefix(prefix, ref argPos)))
{ {
@ -73,7 +71,7 @@ namespace ChaosBot.Discord.Services
return; return;
} }
if(Convert.ToBoolean(ConfigurationRepository.GetValue<string>("Experience:Commands", context.Guild.Id, "false"))) if(Convert.ToBoolean(ConfigurationRepository.GetValue("Experience:Commands", context.Guild.Id, "false")))
ExperienceHandler.AddXp(context); ExperienceHandler.AddXp(context);
bool customCommandExecuted = await CustomCommandHandler.CheckCommand(context, argPos); bool customCommandExecuted = await CustomCommandHandler.CheckCommand(context, argPos);
@ -139,8 +137,8 @@ namespace ChaosBot.Discord.Services
await dbContext.SaveChangesAsync(); await dbContext.SaveChangesAsync();
} }
IQueryable<LodestoneCharacter> ctxUserLS = dbContext.LodestoneCharacter; IQueryable<LodestoneCharacter> ctxUserLs = dbContext.LodestoneCharacter;
IQueryable<LodestoneCharacter> userChar = ctxUserLS IQueryable<LodestoneCharacter> userChar = ctxUserLs
.Where(p => p.DiscordGuildId.Equals(user.Guild.Id)) .Where(p => p.DiscordGuildId.Equals(user.Guild.Id))
.Where(p => p.DiscordUserId.Equals(user.Id)); .Where(p => p.DiscordUserId.Equals(user.Id));

View File

@ -18,7 +18,7 @@ namespace ChaosBot.Discord.Services
IQueryable<CustomCommand> customCommandQuery = dbContext.CustomCommands; IQueryable<CustomCommand> customCommandQuery = dbContext.CustomCommands;
CustomCommand customCommand = customCommandQuery CustomCommand customCommand = customCommandQuery
.Where(cc => cc.DiscordGuildId == context.Guild.Id) .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; if (customCommand == null) return false;

View File

@ -66,10 +66,10 @@ namespace ChaosBot.Discord.Services
{ {
// The user has leveled up, we can send a message // The user has leveled up, we can send a message
string channelToSendIn = string channelToSendIn =
ConfigurationRepository.GetValue<string>("LevelUp:Channel", context.Guild.Id, "false"); ConfigurationRepository.GetValue("LevelUp:Channel", context.Guild.Id, "false");
string mentionString = $"<@{context.User.Id}>"; string mentionString = $"<@{context.User.Id}>";
if (!Convert.ToBoolean(ConfigurationRepository.GetValue<string>("LevelUp:MentionUser", context.Guild.Id, "true"))) if (!Convert.ToBoolean(ConfigurationRepository.GetValue("LevelUp:MentionUser", context.Guild.Id, "true")))
{ {
mentionString = context.User.Username; mentionString = context.User.Username;
if (context.User is IGuildUser guildUser) if (context.User is IGuildUser guildUser)
@ -103,10 +103,10 @@ namespace ChaosBot.Discord.Services
private static ulong CheckLevel(Experience usrExperience) private static ulong CheckLevel(Experience usrExperience)
{ {
ulong curLevel = usrExperience.Level; ulong curLevel = usrExperience.Level;
ulong curXP = usrExperience.Amount; ulong curXp = usrExperience.Amount;
ulong nextLevelXP = 5 * curLevel * curLevel * curLevel + 95 * curLevel; ulong nextLevelXp = 5 * curLevel * curLevel * curLevel + 95 * curLevel;
if (curXP > nextLevelXP) if (curXp > nextLevelXp)
return curLevel + 1; return curLevel + 1;
return curLevel; return curLevel;
} }

View File

@ -19,7 +19,7 @@ namespace ChaosBot.Discord.Services
foreach (IConfigurationSection serverConfig in Program.AppSettingsHandler.GetSection("Servers").GetChildren()) foreach (IConfigurationSection serverConfig in Program.AppSettingsHandler.GetSection("Servers").GetChildren())
{ {
long? lodestoneChannelSloganDescriptionId = serverConfig.GetValue<long?>("Lodestone:SloganDescription:Channel", null); long? lodestoneChannelSloganDescriptionId = serverConfig.GetValue<long?>("Lodestone:SloganDescription:Channel", null);
int refreshMinutes = serverConfig.GetValue<int>("Lodestone:SloganDescription:RefreshMinutes", 60); int refreshMinutes = serverConfig.GetValue("Lodestone:SloganDescription:RefreshMinutes", 60);
if (lodestoneChannelSloganDescriptionId == null) continue; if (lodestoneChannelSloganDescriptionId == null) continue;

View File

@ -1,13 +1,11 @@
using System; using System;
using System.Diagnostics;
using System.Reflection;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using NLog; using NLog;
using NLog.Extensions.Logging; using NLog.Extensions.Logging;
namespace ChaosBot namespace ChaosBot
{ {
public class Logging public static class Logging
{ {
public static Logger GenLog(IConfiguration appSettingsHandler) public static Logger GenLog(IConfiguration appSettingsHandler)
{ {