Fix IDE warnings
This commit is contained in:
parent
bc20751037
commit
78038f8991
@ -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<string>("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<string>("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<LodestoneCharacter> ctxUserLS = dbContext.LodestoneCharacter;
|
||||
IQueryable<LodestoneCharacter> userChar = ctxUserLS
|
||||
IQueryable<LodestoneCharacter> ctxUserLs = dbContext.LodestoneCharacter;
|
||||
IQueryable<LodestoneCharacter> userChar = ctxUserLs
|
||||
.Where(p => p.DiscordGuildId.Equals(user.Guild.Id))
|
||||
.Where(p => p.DiscordUserId.Equals(user.Id));
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ namespace ChaosBot.Discord.Services
|
||||
IQueryable<CustomCommand> 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;
|
||||
|
||||
|
||||
@ -66,10 +66,10 @@ namespace ChaosBot.Discord.Services
|
||||
{
|
||||
// The user has leveled up, we can send a message
|
||||
string channelToSendIn =
|
||||
ConfigurationRepository.GetValue<string>("LevelUp:Channel", context.Guild.Id, "false");
|
||||
ConfigurationRepository.GetValue("LevelUp:Channel", context.Guild.Id, "false");
|
||||
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ namespace ChaosBot.Discord.Services
|
||||
foreach (IConfigurationSection serverConfig in Program.AppSettingsHandler.GetSection("Servers").GetChildren())
|
||||
{
|
||||
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;
|
||||
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user