Removed redundant parenthesis

This commit is contained in:
Kwoth
2021-12-20 03:54:30 +01:00
parent edd60ae656
commit 9223d78849
58 changed files with 147 additions and 147 deletions

View File

@@ -226,7 +226,7 @@ public sealed class Bot
clientReady.TrySetResult(true);
try
{
foreach (var chan in (await Client.GetDMChannelsAsync().ConfigureAwait(false)))
foreach (var chan in await Client.GetDMChannelsAsync().ConfigureAwait(false))
{
await chan.CloseAsync().ConfigureAwait(false);
}
@@ -281,7 +281,7 @@ public sealed class Bot
GuildConfig gc;
await using (var uow = _db.GetDbContext())
{
gc = uow.GuildConfigsForId(arg.Id);
gc = uow.GuildConfigsForId(arg.Id, null);
}
await JoinedGuild.Invoke(gc).ConfigureAwait(false);
});

View File

@@ -13,6 +13,6 @@ public sealed class OwnerOnlyAttribute : PreconditionAttribute
{
var creds = services.GetRequiredService<IBotCredsProvider>().GetCreds();
return Task.FromResult((creds.IsOwner(context.User) || context.Client.CurrentUser.Id == context.User.Id ? PreconditionResult.FromSuccess() : PreconditionResult.FromError("Not owner")));
return Task.FromResult(creds.IsOwner(context.User) || context.Client.CurrentUser.Id == context.User.Id ? PreconditionResult.FromSuccess() : PreconditionResult.FromError("Not owner"));
}
}

View File

@@ -345,7 +345,7 @@ public sealed class ConcurrentHashSet<T> : IReadOnlyCollection<T>, ICollection<T
Node previous = null;
for (var current = tables.Buckets[bucketNo]; current != null; current = current.Next)
{
Debug.Assert((previous is null && current == tables.Buckets[bucketNo]) || previous.Next == current);
Debug.Assert(previous is null && current == tables.Buckets[bucketNo] || previous.Next == current);
if (hashcode == current.Hashcode && _comparer.Equals(current.Item, item))
{
@@ -471,7 +471,7 @@ public sealed class ConcurrentHashSet<T> : IReadOnlyCollection<T>, ICollection<T
Node previous = null;
for (var current = tables.Buckets[bucketNo]; current != null; current = current.Next)
{
Debug.Assert((previous is null && current == tables.Buckets[bucketNo]) || previous.Next == current);
Debug.Assert(previous is null && current == tables.Buckets[bucketNo] || previous.Next == current);
if (hashcode == current.Hashcode && _comparer.Equals(current.Item, item))
{
return false;

View File

@@ -27,7 +27,7 @@ public class DownloadTracker : INService
var added = LastDownloads.AddOrUpdate(
guild.Id,
now,
(key, old) => (now - old) > TimeSpan.FromHours(1) ? now : old);
(key, old) => now - old > TimeSpan.FromHours(1) ? now : old);
// means that this entry was just added - download the users
if (added == now)

View File

@@ -99,7 +99,7 @@ public abstract class NadekoModule : ModuleBase
{
dsc.MessageReceived += MessageReceived;
if ((await Task.WhenAny(userInputTask.Task, Task.Delay(10000)).ConfigureAwait(false)) != userInputTask.Task)
if (await Task.WhenAny(userInputTask.Task, Task.Delay(10000)).ConfigureAwait(false) != userInputTask.Task)
{
return null;
}

View File

@@ -36,7 +36,7 @@ public class NadekoRandom : Random
var bytes = new byte[sizeof(int)];
_rng.GetBytes(bytes);
var sign = Math.Sign(BitConverter.ToInt32(bytes, 0));
return (sign * BitConverter.ToInt32(bytes, 0)) % (maxValue - minValue) + minValue;
return sign * BitConverter.ToInt32(bytes, 0) % (maxValue - minValue) + minValue;
}
public long NextLong(long minValue, long maxValue)
@@ -48,7 +48,7 @@ public class NadekoRandom : Random
var bytes = new byte[sizeof(long)];
_rng.GetBytes(bytes);
var sign = Math.Sign(BitConverter.ToInt64(bytes, 0));
return (sign * BitConverter.ToInt64(bytes, 0)) % (maxValue - minValue) + minValue;
return sign * BitConverter.ToInt64(bytes, 0) % (maxValue - minValue) + minValue;
}
public override void NextBytes(byte[] buffer)

View File

@@ -10,7 +10,7 @@ public static class PlatformHelper
public static int ProcessorCount {
get {
var now = Environment.TickCount;
if (_processorCount == 0 || (now - _lastProcessorCountRefreshTicks) >= ProcessorCountRefreshIntervalMs)
if (_processorCount == 0 || now - _lastProcessorCountRefreshTicks >= ProcessorCountRefreshIntervalMs)
{
_processorCount = Environment.ProcessorCount;
_lastProcessorCountRefreshTicks = now;

View File

@@ -24,7 +24,7 @@ public sealed record SmartEmbedText : SmartText
!string.IsNullOrWhiteSpace(Url) ||
!string.IsNullOrWhiteSpace(Thumbnail) ||
!string.IsNullOrWhiteSpace(Image) ||
(Footer != null && (!string.IsNullOrWhiteSpace(Footer.Text) || !string.IsNullOrWhiteSpace(Footer.IconUrl))) ||
Footer != null && (!string.IsNullOrWhiteSpace(Footer.Text) || !string.IsNullOrWhiteSpace(Footer.IconUrl)) ||
Fields is { Length: > 0 };
public static SmartEmbedText FromEmbed(IEmbed eb, string plainText = null)

View File

@@ -37,7 +37,7 @@ public sealed class ShmartNumberTypeReader : NadekoTypeReader<ShmartNumber>
{
var expr = new NCalc.Expression(i, NCalc.EvaluateOptions.IgnoreCase);
expr.EvaluateParameter += (str, ev) => EvaluateParam(str, ev, context);
var lon = (long)(decimal.Parse(expr.Evaluate().ToString()));
var lon = (long)decimal.Parse(expr.Evaluate().ToString());
return TypeReaderResult.FromSuccess(new ShmartNumber(lon, input));
}
catch (Exception)

View File

@@ -48,11 +48,11 @@ public static class DiscordUserExtensions
public static int GetUserGlobalRank(this DbSet<DiscordUser> users, ulong id)
{
return users.AsQueryable()
.Where(x => x.TotalXp > (users
.Where(x => x.TotalXp > users
.AsQueryable()
.Where(y => y.UserId == id)
.Select(y => y.TotalXp)
.FirstOrDefault()))
.FirstOrDefault())
.Count() + 1;
}

View File

@@ -69,10 +69,11 @@ public static class GuildConfigExtensions
/// <summary>
/// Gets and creates if it doesn't exist a config for a guild.
/// </summary>
/// <param name="guildId">For which guild</param>
/// <param name="includes">Use to manipulate the set however you want</param>
/// <param name="ctx">Context</param>
/// <param name="guildId">Id of the guide</param>
/// <param name="includes">Use to manipulate the set however you want. Pass null to include everything</param>
/// <returns>Config for the guild</returns>
public static GuildConfig GuildConfigsForId(this NadekoContext ctx, ulong guildId, Func<DbSet<GuildConfig>, IQueryable<GuildConfig>> includes = null)
public static GuildConfig GuildConfigsForId(this NadekoContext ctx, ulong guildId, Func<DbSet<GuildConfig>, IQueryable<GuildConfig>> includes)
{
GuildConfig config;
@@ -91,13 +92,13 @@ public static class GuildConfigExtensions
if (config is null)
{
ctx.GuildConfigs.Add((config = new()
ctx.GuildConfigs.Add(config = new()
{
GuildId = guildId,
Permissions = Permissionv2.GetDefaultPermlist,
WarningsInitialized = true,
WarnPunishments = DefaultWarnPunishments,
}));
});
ctx.SaveChanges();
}
@@ -150,11 +151,11 @@ public static class GuildConfigExtensions
if (config is null) // if there is no guildconfig, create new one
{
ctx.GuildConfigs.Add((config = new()
ctx.GuildConfigs.Add(config = new()
{
GuildId = guildId,
Permissions = Permissionv2.GetDefaultPermlist
}));
});
ctx.SaveChanges();
}
else if (config.Permissions is null || !config.Permissions.Any()) // if no perms, add default ones

View File

@@ -60,12 +60,11 @@ public static class UserXpExtensions
return xps
.AsQueryable()
.AsNoTracking()
.Where(x => x.GuildId == guildId && ((x.Xp + x.AwardedXp) >
(xps.AsQueryable()
.Where(x => x.GuildId == guildId && x.Xp + x.AwardedXp >
xps.AsQueryable()
.Where(y => y.UserId == userId && y.GuildId == guildId)
.Select(y => y.Xp + y.AwardedXp)
.FirstOrDefault())
))
.Count() + 1;
}

View File

@@ -25,7 +25,7 @@ public sealed class UserSpamStats : IDisposable
lock (applyLock)
{
var upperMsg = message.Content.ToUpperInvariant();
if (upperMsg != LastMessage || (string.IsNullOrWhiteSpace(upperMsg) && message.Attachments.Any()))
if (upperMsg != LastMessage || string.IsNullOrWhiteSpace(upperMsg) && message.Attachments.Any())
{
LastMessage = upperMsg;
while (timers.TryDequeue(out var old))

View File

@@ -154,7 +154,7 @@ public partial class Administration
}
else
{
var g = ((SocketGuild)ctx.Guild);
var g = (SocketGuild)ctx.Guild;
foreach (var rr in rrs)
{
var ch = g.GetTextChannel(rr.ChannelId);
@@ -164,7 +164,7 @@ public partial class Administration
msg = await ch.GetMessageAsync(rr.MessageId).ConfigureAwait(false) as IUserMessage;
}
var content = msg?.Content.TrimTo(30) ?? "DELETED!";
embed.AddField($"**{rr.Index + 1}.** {(ch?.Name ?? "DELETED!")}",
embed.AddField($"**{rr.Index + 1}.** {ch?.Name ?? "DELETED!"}",
GetText(strs.reaction_roles_message(rr.ReactionRoles?.Count ?? 0, content)));
}
}
@@ -197,7 +197,7 @@ public partial class Administration
{
var runnerUser = (IGuildUser)ctx.User;
var runnerMaxRolePosition = runnerUser.GetRoles().Max(x => x.Position);
if ((ctx.User.Id != ctx.Guild.OwnerId) && runnerMaxRolePosition <= roleToAdd.Position)
if (ctx.User.Id != ctx.Guild.OwnerId && runnerMaxRolePosition <= roleToAdd.Position)
return;
try
{
@@ -271,7 +271,7 @@ public partial class Administration
.Where(x => !x.IsManaged && x != x.Guild.EveryoneRole)
.ToList();
if (user.Id == ctx.Guild.OwnerId || (ctx.User.Id != ctx.Guild.OwnerId && guser.GetRoles().Max(x => x.Position) <= userRoles.Max(x => x.Position)))
if (user.Id == ctx.Guild.OwnerId || ctx.User.Id != ctx.Guild.OwnerId && guser.GetRoles().Max(x => x.Position) <= userRoles.Max(x => x.Position))
return;
try
{

View File

@@ -81,8 +81,8 @@ public sealed class ImageOnlyChannelService : IEarlyBehavior
var newState = false;
using var uow = _db.GetDbContext();
if (forceDisable
|| (_enabledOn.TryGetValue(guildId, out var channels)
&& channels.TryRemove(channelId)))
|| _enabledOn.TryGetValue(guildId, out var channels)
&& channels.TryRemove(channelId))
{
uow.ImageOnlyChannels.Delete(x => x.ChannelId == channelId);
}

View File

@@ -225,7 +225,7 @@ public sealed class LogCommandService : ILogCommandService
logSetting.LogVoicePresenceId =
logSetting.UserMutedId =
logSetting.LogVoicePresenceTTSId =
(value ? channelId : (ulong?) null);
value ? channelId : (ulong?) null;
;
await uow.SaveChangesAsync();
GuildLogSettings.AddOrUpdate(guildId, id => logSetting, (id, old) => logSetting);
@@ -244,7 +244,7 @@ public sealed class LogCommandService : ILogCommandService
var g = after.Guild;
if (!GuildLogSettings.TryGetValue(g.Id, out var logSetting)
|| (logSetting.UserUpdatedId is null))
|| logSetting.UserUpdatedId is null)
return;
ITextChannel logChannel;
@@ -303,54 +303,54 @@ public sealed class LogCommandService : ILogCommandService
switch (type)
{
case LogType.Other:
channelId = logSetting.LogOtherId = (logSetting.LogOtherId is null ? cid : default);
channelId = logSetting.LogOtherId = logSetting.LogOtherId is null ? cid : default;
break;
case LogType.MessageUpdated:
channelId = logSetting.MessageUpdatedId = (logSetting.MessageUpdatedId is null ? cid : default);
channelId = logSetting.MessageUpdatedId = logSetting.MessageUpdatedId is null ? cid : default;
break;
case LogType.MessageDeleted:
channelId = logSetting.MessageDeletedId = (logSetting.MessageDeletedId is null ? cid : default);
channelId = logSetting.MessageDeletedId = logSetting.MessageDeletedId is null ? cid : default;
//logSetting.DontLogBotMessageDeleted = (options == "nobot");
break;
case LogType.UserJoined:
channelId = logSetting.UserJoinedId = (logSetting.UserJoinedId is null ? cid : default);
channelId = logSetting.UserJoinedId = logSetting.UserJoinedId is null ? cid : default;
break;
case LogType.UserLeft:
channelId = logSetting.UserLeftId = (logSetting.UserLeftId is null ? cid : default);
channelId = logSetting.UserLeftId = logSetting.UserLeftId is null ? cid : default;
break;
case LogType.UserBanned:
channelId = logSetting.UserBannedId = (logSetting.UserBannedId is null ? cid : default);
channelId = logSetting.UserBannedId = logSetting.UserBannedId is null ? cid : default;
break;
case LogType.UserUnbanned:
channelId = logSetting.UserUnbannedId = (logSetting.UserUnbannedId is null ? cid : default);
channelId = logSetting.UserUnbannedId = logSetting.UserUnbannedId is null ? cid : default;
break;
case LogType.UserUpdated:
channelId = logSetting.UserUpdatedId = (logSetting.UserUpdatedId is null ? cid : default);
channelId = logSetting.UserUpdatedId = logSetting.UserUpdatedId is null ? cid : default;
break;
case LogType.UserMuted:
channelId = logSetting.UserMutedId = (logSetting.UserMutedId is null ? cid : default);
channelId = logSetting.UserMutedId = logSetting.UserMutedId is null ? cid : default;
break;
case LogType.ChannelCreated:
channelId = logSetting.ChannelCreatedId = (logSetting.ChannelCreatedId is null ? cid : default);
channelId = logSetting.ChannelCreatedId = logSetting.ChannelCreatedId is null ? cid : default;
break;
case LogType.ChannelDestroyed:
channelId = logSetting.ChannelDestroyedId =
(logSetting.ChannelDestroyedId is null ? cid : default);
logSetting.ChannelDestroyedId is null ? cid : default;
break;
case LogType.ChannelUpdated:
channelId = logSetting.ChannelUpdatedId = (logSetting.ChannelUpdatedId is null ? cid : default);
channelId = logSetting.ChannelUpdatedId = logSetting.ChannelUpdatedId is null ? cid : default;
break;
case LogType.UserPresence:
channelId = logSetting.LogUserPresenceId =
(logSetting.LogUserPresenceId is null ? cid : default);
logSetting.LogUserPresenceId is null ? cid : default;
break;
case LogType.VoicePresence:
channelId = logSetting.LogVoicePresenceId =
(logSetting.LogVoicePresenceId is null ? cid : default);
logSetting.LogVoicePresenceId is null ? cid : default;
break;
case LogType.VoicePresenceTTS:
channelId = logSetting.LogVoicePresenceTTSId =
(logSetting.LogVoicePresenceTTSId is null ? cid : default);
logSetting.LogVoicePresenceTTSId is null ? cid : default;
break;
}
@@ -376,7 +376,7 @@ public sealed class LogCommandService : ILogCommandService
return;
if (!GuildLogSettings.TryGetValue(usr.Guild.Id, out var logSetting)
|| (logSetting.LogVoicePresenceTTSId is null))
|| logSetting.LogVoicePresenceTTSId is null)
return;
ITextChannel logChannel;
@@ -416,7 +416,7 @@ public sealed class LogCommandService : ILogCommandService
try
{
if (!GuildLogSettings.TryGetValue(usr.Guild.Id, out var logSetting)
|| (logSetting.UserMutedId is null))
|| logSetting.UserMutedId is null)
return;
ITextChannel logChannel;
@@ -460,7 +460,7 @@ public sealed class LogCommandService : ILogCommandService
try
{
if (!GuildLogSettings.TryGetValue(usr.Guild.Id, out var logSetting)
|| (logSetting.UserMutedId is null))
|| logSetting.UserMutedId is null)
return;
ITextChannel logChannel;
@@ -512,7 +512,7 @@ public sealed class LogCommandService : ILogCommandService
return;
if (!GuildLogSettings.TryGetValue(users.First().Guild.Id, out var logSetting)
|| (logSetting.LogOtherId is null))
|| logSetting.LogOtherId is null)
return;
ITextChannel logChannel;
if ((logChannel = await TryGetLogChannel(users.First().Guild, logSetting, LogType.Other)
@@ -681,7 +681,7 @@ public sealed class LogCommandService : ILogCommandService
var after = (IGuildChannel) cafter;
if (!GuildLogSettings.TryGetValue(before.Guild.Id, out var logSetting)
|| (logSetting.ChannelUpdatedId is null)
|| logSetting.ChannelUpdatedId is null
|| logSetting.LogIgnores.Any(ilc => ilc.LogItemId == after.Id && ilc.ItemType == IgnoredItemType.Channel))
return;
@@ -732,7 +732,7 @@ public sealed class LogCommandService : ILogCommandService
return;
if (!GuildLogSettings.TryGetValue(ch.Guild.Id, out var logSetting)
|| (logSetting.ChannelDestroyedId is null)
|| logSetting.ChannelDestroyedId is null
|| logSetting.LogIgnores.Any(ilc => ilc.LogItemId == ch.Id && ilc.ItemType == IgnoredItemType.Channel))
return;
@@ -817,7 +817,7 @@ public sealed class LogCommandService : ILogCommandService
return;
if (!GuildLogSettings.TryGetValue(usr.Guild.Id, out var logSetting)
|| (logSetting.LogVoicePresenceId is null)
|| logSetting.LogVoicePresenceId is null
|| logSetting.LogIgnores.Any(ilc => ilc.LogItemId == iusr.Id && ilc.ItemType == IgnoredItemType.User))
return;
@@ -870,7 +870,7 @@ public sealed class LogCommandService : ILogCommandService
try
{
if (!GuildLogSettings.TryGetValue(usr.Guild.Id, out var logSetting)
|| (logSetting.UserLeftId is null)
|| logSetting.UserLeftId is null
|| logSetting.LogIgnores.Any(ilc => ilc.LogItemId == usr.Id && ilc.ItemType == IgnoredItemType.User))
return;
@@ -905,7 +905,7 @@ public sealed class LogCommandService : ILogCommandService
try
{
if (!GuildLogSettings.TryGetValue(usr.Guild.Id, out var logSetting)
|| (logSetting.UserJoinedId is null))
|| logSetting.UserJoinedId is null)
return;
ITextChannel logChannel;
@@ -946,7 +946,7 @@ public sealed class LogCommandService : ILogCommandService
try
{
if (!GuildLogSettings.TryGetValue(guild.Id, out var logSetting)
|| (logSetting.UserUnbannedId is null)
|| logSetting.UserUnbannedId is null
|| logSetting.LogIgnores.Any(ilc => ilc.LogItemId == usr.Id && ilc.ItemType == IgnoredItemType.User))
return;
@@ -981,7 +981,7 @@ public sealed class LogCommandService : ILogCommandService
try
{
if (!GuildLogSettings.TryGetValue(guild.Id, out var logSetting)
|| (logSetting.UserBannedId is null)
|| logSetting.UserBannedId is null
|| logSetting.LogIgnores.Any(ilc => ilc.LogItemId == usr.Id && ilc.ItemType == IgnoredItemType.User))
return;
@@ -1029,7 +1029,7 @@ public sealed class LogCommandService : ILogCommandService
return;
if (!GuildLogSettings.TryGetValue(channel.Guild.Id, out var logSetting)
|| (logSetting.MessageDeletedId is null)
|| logSetting.MessageDeletedId is null
|| logSetting.LogIgnores.Any(ilc => ilc.LogItemId == channel.Id && ilc.ItemType == IgnoredItemType.Channel))
return;
@@ -1087,7 +1087,7 @@ public sealed class LogCommandService : ILogCommandService
return;
if (!GuildLogSettings.TryGetValue(channel.Guild.Id, out var logSetting)
|| (logSetting.MessageUpdatedId is null)
|| logSetting.MessageUpdatedId is null
|| logSetting.LogIgnores.Any(ilc => ilc.LogItemId == channel.Id && ilc.ItemType == IgnoredItemType.Channel))
return;

View File

@@ -299,7 +299,7 @@ public class MuteService : INService
}
}
foreach (var toOverwrite in (await guild.GetTextChannelsAsync().ConfigureAwait(false)))
foreach (var toOverwrite in await guild.GetTextChannelsAsync().ConfigureAwait(false))
{
try
{

View File

@@ -190,7 +190,7 @@ public class RoleCommandsService : INService
{
var toAdd = user.Guild.GetRole(dbRero.RoleId);
return (toAdd != null && !user.Roles.Contains(toAdd))
return toAdd != null && !user.Roles.Contains(toAdd)
? user.AddRoleAsync(toAdd)
: Task.CompletedTask;
}

View File

@@ -320,7 +320,7 @@ WHERE GuildId={guildId}
// these 3 don't make sense with time
if ((punish == PunishmentAction.Softban || punish == PunishmentAction.Kick || punish == PunishmentAction.RemoveRoles) && time != null)
return false;
if (number <= 0 || (time != null && time.Time > TimeSpan.FromDays(49)))
if (number <= 0 || time != null && time.Time > TimeSpan.FromDays(49))
return false;
using (var uow = _db.GetDbContext())
@@ -334,7 +334,7 @@ WHERE GuildId={guildId}
{
Count = number,
Punishment = punish,
Time = (int?)(time?.Time.TotalMinutes) ?? 0,
Time = (int?)time?.Time.TotalMinutes ?? 0,
RoleId = punish == PunishmentAction.AddRole ? role.Id : default(ulong?),
});
uow.SaveChanges();

View File

@@ -37,7 +37,7 @@ public partial class Administration
// bot can't punish a user who is higher in the hierarchy. Discord will return 403
// moderator can be owner, in which case role hierarchy doesn't matter
// otherwise, moderator has to have a higher role
if ((botMaxRole <= targetMaxRole || (ctx.User.Id != ownerId && targetMaxRole >= modMaxRole)) || target.Id == ownerId)
if (botMaxRole <= targetMaxRole || ctx.User.Id != ownerId && targetMaxRole >= modMaxRole || target.Id == ownerId)
{
await ReplyErrorLocalizedAsync(strs.hierarchy);
return false;

View File

@@ -20,8 +20,8 @@ public class CustomReactions : NadekoModule<CustomReactionsService>
_clientFactory = clientFactory;
}
private bool AdminInGuildOrOwnerInDm() => (ctx.Guild is null && _creds.IsOwner(ctx.User))
|| (ctx.Guild != null && ((IGuildUser)ctx.User).GuildPermissions.Administrator);
private bool AdminInGuildOrOwnerInDm() => ctx.Guild is null && _creds.IsOwner(ctx.User)
|| ctx.Guild != null && ((IGuildUser)ctx.User).GuildPermissions.Administrator;
[NadekoCommand, Aliases]
public async Task AddCustReact(string key, [Leftover] string message)
@@ -53,7 +53,7 @@ public class CustomReactions : NadekoModule<CustomReactionsService>
if (string.IsNullOrWhiteSpace(message) || id < 0)
return;
if ((channel is null && !_creds.IsOwner(ctx.User)) || (channel != null && !((IGuildUser)ctx.User).GuildPermissions.Administrator))
if (channel is null && !_creds.IsOwner(ctx.User) || channel != null && !((IGuildUser)ctx.User).GuildPermissions.Administrator)
{
await ReplyErrorLocalizedAsync(strs.insuff_perms).ConfigureAwait(false);
return;

View File

@@ -60,7 +60,7 @@ public static class CustomReactionExtensions
if (word.Length < str.Length && str.isValidWordDivider(word.Length))
return WordPosition.Start;
}
else if ((wordIndex + word.Length) == str.Length)
else if (wordIndex + word.Length == str.Length)
{
if (str.isValidWordDivider(wordIndex - 1))
return WordPosition.End;

View File

@@ -264,7 +264,7 @@ public sealed class CustomReactionsService : IEarlyBehavior, IReadyExecutor
if (toDelete is null)
return null;
if ((toDelete.IsGlobal() && guildId is null) || (guildId == toDelete.GuildId))
if (toDelete.IsGlobal() && guildId is null || guildId == toDelete.GuildId)
{
uow.CustomReactions.Remove(toDelete);
await uow.SaveChangesAsync();

View File

@@ -78,7 +78,7 @@ public partial class Gambling
GetText(strs.animal_race_won_money(
Format.Bold(winner.Username),
winner.Animal.Icon,
(race.FinishedUsers[0].Bet * (race.Users.Count - 1)) + CurrencySign)));
race.FinishedUsers[0].Bet * (race.Users.Count - 1) + CurrencySign)));
}
else
{
@@ -111,7 +111,7 @@ public partial class Gambling
{String.Join("\n", race.Users.Select(p =>
{
var index = race.FinishedUsers.IndexOf(p);
var extra = (index == -1 ? "" : $"#{index + 1} {(index == 0 ? "🏆" : "")}");
var extra = index == -1 ? "" : $"#{index + 1} {(index == 0 ? "🏆" : "")}";
return $"{(int)(p.Progress / 60f * 100),-2}%|{new string('‣', p.Progress) + p.Animal.Icon + extra}";
}))}
|🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🔚|";

View File

@@ -179,7 +179,7 @@ public class Blackjack
{
var hw = Dealer.GetHandValue();
while (hw < 17
|| (hw == 17 && Dealer.Cards.Count(x => x.Number == 1) > (Dealer.GetRawHandValue() - 17) / 10))// hit on soft 17
|| hw == 17 && Dealer.Cards.Count(x => x.Number == 1) > (Dealer.GetRawHandValue() - 17) / 10)// hit on soft 17
{
/* Dealer has
A 6

View File

@@ -252,13 +252,13 @@ public class Deck
{
if (cards.GroupBy(card => card.Number).Count() != cards.Count())
return false;
var toReturn = (cards.Max(card => (int)card.Number)
- cards.Min(card => (int)card.Number) == 4);
var toReturn = cards.Max(card => (int)card.Number)
- cards.Min(card => (int)card.Number) == 4;
if (toReturn || cards.All(c => c.Number != 1)) return toReturn;
var newCards = cards.Select(c => c.Number == 1 ? new(c.Suit, 14) : c);
return (newCards.Max(card => (int)card.Number)
- newCards.Min(card => (int)card.Number) == 4);
return newCards.Max(card => (int)card.Number)
- newCards.Min(card => (int)card.Number) == 4;
}
bool hasThreeOfKind(List<Card> cards) => cards.GroupBy(card => card.Number)

View File

@@ -167,8 +167,8 @@ public class ReactionEvent : ICurrencyEvent
|| msg.Id != _msg.Id // same message
|| gu.IsBot // no bots
|| (DateTime.UtcNow - gu.CreatedAt).TotalDays <= 5 // no recently created accounts
|| (_noRecentlyJoinedServer && // if specified, no users who joined the server in the last 24h
(gu.JoinedAt is null || (DateTime.UtcNow - gu.JoinedAt.Value).TotalDays < 1))) // and no users for who we don't know when they joined
|| _noRecentlyJoinedServer && // if specified, no users who joined the server in the last 24h
(gu.JoinedAt is null || (DateTime.UtcNow - gu.JoinedAt.Value).TotalDays < 1)) // and no users for who we don't know when they joined
{
return;
}

View File

@@ -158,8 +158,8 @@ public sealed class Connect4Game : IDisposable
if (CurrentPhase == Phase.Ended || CurrentPhase == Phase.Joining)
return false;
if (!((_players[0].Value.UserId == userId && CurrentPhase == Phase.P1Move)
|| (_players[1].Value.UserId == userId && CurrentPhase == Phase.P2Move)))
if (!(_players[0].Value.UserId == userId && CurrentPhase == Phase.P1Move
|| _players[1].Value.UserId == userId && CurrentPhase == Phase.P2Move))
return false;
if (inputCol < 0 || inputCol > NumberOfColumns) //invalid input

View File

@@ -185,7 +185,7 @@ public partial class Gambling
{
for (var j = 0; j < Connect4Game.NumberOfColumns; j++)
{
var cur = game.GameState[i + (j * Connect4Game.NumberOfRows) - 1];
var cur = game.GameState[i + j * Connect4Game.NumberOfRows - 1];
if (cur == Connect4Game.Field.Empty)
sb.Append("⚫"); //black circle

View File

@@ -65,8 +65,8 @@ public partial class Gambling : GamblingModule<GamblingService>
.WithTitle(GetText(strs.economy_state))
.AddField(GetText(strs.currency_owned), ((BigInteger)(ec.Cash - ec.Bot)).ToString("N", _enUsCulture) + CurrencySign)
.AddField(GetText(strs.currency_one_percent), (onePercent * 100).ToString("F2") + "%")
.AddField(GetText(strs.currency_planted), ((BigInteger)ec.Planted) + CurrencySign)
.AddField(GetText(strs.owned_waifus_total), ((BigInteger)ec.Waifus) + CurrencySign)
.AddField(GetText(strs.currency_planted), (BigInteger)ec.Planted + CurrencySign)
.AddField(GetText(strs.owned_waifus_total), (BigInteger)ec.Waifus + CurrencySign)
.AddField(GetText(strs.bot_currency), ec.Bot.ToString("N", _enUsCulture) + CurrencySign)
.AddField(GetText(strs.total), ((BigInteger)(ec.Cash + ec.Planted + ec.Waifus)).ToString("N", _enUsCulture) + CurrencySign)
.WithOkColor();
@@ -146,7 +146,7 @@ public partial class Gambling : GamblingModule<GamblingService>
{
role = role ?? ctx.Guild.EveryoneRole;
var members = (await role.GetMembersAsync().ConfigureAwait(false));
var members = await role.GetMembersAsync().ConfigureAwait(false);
var membersArray = members as IUser[] ?? members.ToArray();
if (membersArray.Length == 0)
{
@@ -271,9 +271,9 @@ public partial class Gambling : GamblingModule<GamblingService>
}
await _cs.AddAsync(usr,
$"Awarded by bot owner. ({ctx.User.Username}/{ctx.User.Id}) {(msg ?? "")}",
$"Awarded by bot owner. ({ctx.User.Username}/{ctx.User.Id}) {msg ?? ""}",
amount,
gamble: (ctx.Client.CurrentUser.Id != usrId)).ConfigureAwait(false);
gamble: ctx.Client.CurrentUser.Id != usrId).ConfigureAwait(false);
await ReplyConfirmLocalizedAsync(strs.awarded(n(amount) + CurrencySign, $"<@{usrId}>"));
}
@@ -329,7 +329,7 @@ public partial class Gambling : GamblingModule<GamblingService>
return;
if (await _cs.RemoveAsync(user, $"Taken by bot owner.({ctx.User.Username}/{ctx.User.Id})", amount,
gamble: (ctx.Client.CurrentUser.Id != user.Id)).ConfigureAwait(false))
gamble: ctx.Client.CurrentUser.Id != user.Id).ConfigureAwait(false))
await ReplyConfirmLocalizedAsync(strs.take(n(amount) + CurrencySign, Format.Bold(user.ToString()))).ConfigureAwait(false);
else
await ReplyErrorLocalizedAsync(strs.take_fail(n(amount) + CurrencySign, Format.Bold(user.ToString()), CurrencySign));
@@ -344,7 +344,7 @@ public partial class Gambling : GamblingModule<GamblingService>
return;
if (await _cs.RemoveAsync(usrId, $"Taken by bot owner.({ctx.User.Username}/{ctx.User.Id})", amount,
gamble: (ctx.Client.CurrentUser.Id != usrId)).ConfigureAwait(false))
gamble: ctx.Client.CurrentUser.Id != usrId).ConfigureAwait(false))
await ReplyConfirmLocalizedAsync(strs.take(amount + CurrencySign, $"<@{usrId}>"));
else
await ReplyErrorLocalizedAsync(strs.take_fail(amount + CurrencySign, Format.Code(usrId.ToString()), CurrencySign));
@@ -440,7 +440,7 @@ public partial class Gambling : GamblingModule<GamblingService>
var winner = rdGame.Winner == rdGame.P1
? ctx.User
: u;
description += $"\n**{winner}** Won {n(((long)(rdGame.Amount * 2 * 0.98))) + CurrencySign}";
description += $"\n**{winner}** Won {n((long)(rdGame.Amount * 2 * 0.98)) + CurrencySign}";
embed = embed.WithDescription(description);
@@ -609,7 +609,7 @@ public partial class Gambling : GamblingModule<GamblingService>
public async Task Rps(RpsPick pick, ShmartNumber amount = default)
{
long oldAmount = amount;
if (!await CheckBetOptional(amount).ConfigureAwait(false) || (amount == 1))
if (!await CheckBetOptional(amount).ConfigureAwait(false) || amount == 1)
return;
string getRpsPick(RpsPick p)
@@ -646,9 +646,9 @@ public partial class Gambling : GamblingModule<GamblingService>
embed.WithOkColor();
msg = GetText(strs.rps_draw(getRpsPick(pick)));
}
else if ((pick == RpsPick.Paper && nadekoPick == RpsPick.Rock) ||
(pick == RpsPick.Rock && nadekoPick == RpsPick.Scissors) ||
(pick == RpsPick.Scissors && nadekoPick == RpsPick.Paper))
else if (pick == RpsPick.Paper && nadekoPick == RpsPick.Rock ||
pick == RpsPick.Rock && nadekoPick == RpsPick.Scissors ||
pick == RpsPick.Scissors && nadekoPick == RpsPick.Paper)
{
amount = (long)(amount * base._config.BetFlip.Multiplier);
await _cs.AddAsync(ctx.User.Id,

View File

@@ -110,7 +110,7 @@ public class WaifuService : INService
.Count();
return (int) Math.Ceiling(waifu.Price * 1.25f) +
((divorces + affs + 2) * settings.Waifu.Multipliers.WaifuReset);
(divorces + affs + 2) * settings.Waifu.Multipliers.WaifuReset;
}
}
@@ -164,7 +164,7 @@ public class WaifuService : INService
await using (var uow = _db.GetDbContext())
{
w = uow.WaifuInfo.ByWaifuUserId(target.Id);
isAffinity = (w?.Affinity?.UserId == user.Id);
isAffinity = w?.Affinity?.UserId == user.Id;
if (w is null)
{
var claimer = uow.GetOrCreateUser(user);
@@ -202,7 +202,7 @@ public class WaifuService : INService
{
var oldClaimer = w.Claimer;
w.Claimer = uow.GetOrCreateUser(user);
w.Price = amount + (amount / 4);
w.Price = amount + amount / 4;
result = WaifuClaimResult.Success;
uow.WaifuUpdates.Add(new()

View File

@@ -212,7 +212,7 @@ public partial class Gambling
}
private static long GetProfitAmount(int price) =>
(int)(Math.Ceiling(0.90 * price));
(int)Math.Ceiling(0.90 * price);
[NadekoCommand, Aliases]
[RequireContext(ContextType.Guild)]
@@ -300,7 +300,7 @@ public partial class Gambling
set => set.Include(x => x.ShopEntries)
.ThenInclude(x => x.Items)).ShopEntries);
entry = entries.ElementAtOrDefault(index);
if (entry != null && (rightType = (entry.Type == ShopEntryType.List)))
if (entry != null && (rightType = entry.Type == ShopEntryType.List))
{
if (added = entry.Items.Add(item))
{

View File

@@ -227,7 +227,7 @@ public partial class Gambling
foreach (var w in waifus)
{
var j = i++;
embed.AddField("#" + ((page * 9) + j + 1) + " - " + w.Price + CurrencySign, w.ToString(), false);
embed.AddField("#" + (page * 9 + j + 1) + " - " + w.Price + CurrencySign, w.ToString(), false);
}
await ctx.Channel.EmbedAsync(embed);

View File

@@ -198,7 +198,7 @@ public class Help : NadekoModule<HelpService>
{
succ = new((await Task.WhenAll(cmds.Select(async x =>
{
var pre = (await x.CheckPreconditionsAsync(Context, _services).ConfigureAwait(false));
var pre = await x.CheckPreconditionsAsync(Context, _services).ConfigureAwait(false);
return (Cmd: x, Succ: pre.IsSuccess);
})).ConfigureAwait(false))
.Where(x => x.Succ)

View File

@@ -145,7 +145,7 @@ public sealed class YtdlYoutubeResolver : IYoutubeResolver
var match = expiryRegex.Match(streamUrl);
if (match.Success && double.TryParse(match.Groups["timestamp"].ToString(), out var timestamp))
{
var realExpiry = (timestamp.ToUnixTimestamp() - DateTime.UtcNow);
var realExpiry = timestamp.ToUnixTimestamp() - DateTime.UtcNow;
if (realExpiry > TimeSpan.FromMinutes(60))
return realExpiry.Subtract(TimeSpan.FromMinutes(30));

View File

@@ -326,7 +326,7 @@ public sealed partial class Music : NadekoModule<IMusicService>
desc = add + "\n" + desc;
var embed = _eb.Create()
.WithAuthor(GetText(strs.player_queue(curPage + 1, (tracks.Count / LQ_ITEMS_PER_PAGE) + 1)),
.WithAuthor(GetText(strs.player_queue(curPage + 1, tracks.Count / LQ_ITEMS_PER_PAGE + 1)),
MusicIconUrl)
.WithDescription(desc)
.WithFooter($" {mp.PrettyVolume()} | 🎶 {tracks.Count} | ⌛ {mp.PrettyTotalTime()} ")
@@ -428,7 +428,7 @@ public sealed partial class Music : NadekoModule<IMusicService>
}
var embed = _eb.Create()
.WithAuthor(GetText(strs.removed_song) + " #" + (index), MusicIconUrl)
.WithAuthor(GetText(strs.removed_song) + " #" + index, MusicIconUrl)
.WithDescription(song.PrettyName())
.WithFooter(song.PrettyInfo())
.WithErrorColor();

View File

@@ -33,10 +33,10 @@ public static class PermissionExtensions
//false = applicable, not allowed
public static bool? CheckPermission(this Permissionv2 perm, IUserMessage message, string commandName, string moduleName)
{
if (!((perm.SecondaryTarget == SecondaryPermissionType.Command &&
perm.SecondaryTargetName.ToLowerInvariant() == commandName.ToLowerInvariant()) ||
(perm.SecondaryTarget == SecondaryPermissionType.Module &&
perm.SecondaryTargetName.ToLowerInvariant() == moduleName.ToLowerInvariant()) ||
if (!(perm.SecondaryTarget == SecondaryPermissionType.Command &&
perm.SecondaryTargetName.ToLowerInvariant() == commandName.ToLowerInvariant() ||
perm.SecondaryTarget == SecondaryPermissionType.Module &&
perm.SecondaryTargetName.ToLowerInvariant() == moduleName.ToLowerInvariant() ||
perm.SecondaryTarget == SecondaryPermissionType.AllModules))
return null;

View File

@@ -102,7 +102,7 @@ public partial class Searches
var i = 0;
var fs = string.Join("\n", feeds.Skip(cur * 10)
.Take(10)
.Select(x => $"`{(cur * 10) + (++i)}.` <#{x.ChannelId}> {x.Url}"));
.Select(x => $"`{cur * 10 + ++i}.` <#{x.ChannelId}> {x.Url}"));
return embed.WithDescription(fs);

View File

@@ -89,7 +89,7 @@ public partial class Searches
{
var character = tempList[i];
sb.AppendLine($"#{i + 1 + (curPage * 9),-4}{character.Name,-23}{ShortLeagueName(character.League),-10}{character.Class,-13}{character.Level,-3}");
sb.AppendLine($"#{i + 1 + curPage * 9,-4}{character.Name,-23}{ShortLeagueName(character.League),-10}{character.Class,-13}{character.Level,-3}");
}
sb.AppendLine("```");

View File

@@ -241,7 +241,7 @@ public partial class Searches : NadekoModule<SearchesService>
if (!elems.Any())
return;
var img = (elems.ElementAtOrDefault(new NadekoRandom().Next(0, elems.Count))?.Children?.FirstOrDefault() as IHtmlImageElement);
var img = elems.ElementAtOrDefault(new NadekoRandom().Next(0, elems.Count))?.Children?.FirstOrDefault() as IHtmlImageElement;
if (img?.Source is null)
return;

View File

@@ -125,7 +125,7 @@ public partial class Searches
{
var elem = elements[index];
eb.AddField(
$"**#{(index + 1) + (12 * cur)}** {elem.Username.ToLower()}",
$"**#{index + 1 + 12 * cur}** {elem.Username.ToLower()}",
$"【{elem.Type}】\n<#{elem.ChannelId}>\n{elem.Message?.TrimTo(50)}",
true);
}

View File

@@ -60,7 +60,7 @@ public partial class Utility
var embed = _eb.Create().WithOkColor();
foreach (var inv in invites)
{
var expiryString = (inv.MaxAge is null || inv.MaxAge == 0 || inv.CreatedAt is null)
var expiryString = inv.MaxAge is null || inv.MaxAge == 0 || inv.CreatedAt is null
? "∞"
: (inv.CreatedAt.Value.AddSeconds(inv.MaxAge.Value).UtcDateTime - DateTime.UtcNow)
.ToString(@"d\.hh\:mm\:ss");

View File

@@ -36,7 +36,7 @@ public partial class Utility
return;
}
var rem = (_service.Interval - (DateTime.UtcNow - _service.LastUpdate));
var rem = _service.Interval - (DateTime.UtcNow - _service.LastUpdate);
var helpcmd = Format.Code(Prefix + "donate");
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
.WithDescription(GetText(strs.clpa_obsolete))

View File

@@ -213,7 +213,7 @@ public partial class Utility
{
var q = uow.Quotes.GetById(id);
if ((q?.GuildId != ctx.Guild.Id) || (!hasManageMessages && q.AuthorId != ctx.Message.Author.Id))
if (q?.GuildId != ctx.Guild.Id || !hasManageMessages && q.AuthorId != ctx.Message.Author.Id)
{
response = GetText(strs.quotes_remove_none);
}

View File

@@ -131,7 +131,7 @@ public partial class Utility
var when = rem.When;
var diff = when - DateTime.UtcNow;
embed.AddField(
$"#{++i + (page * 10)} {rem.When:HH:mm yyyy-MM-dd} UTC (in {(int) diff.TotalHours}h {(int) diff.Minutes}m)",
$"#{++i + page * 10} {rem.When:HH:mm yyyy-MM-dd} UTC (in {(int) diff.TotalHours}h {(int) diff.Minutes}m)",
$@"`Target:` {(rem.IsPrivate ? "DM" : "Channel")}
`TargetId:` {rem.ChannelId}
`Message:` {rem.Message?.TrimTo(50)}", false);

View File

@@ -116,8 +116,8 @@ public partial class Utility
: TimeSpan.FromDays(1));
if (string.IsNullOrWhiteSpace(message)
|| (interval != null &&
(interval.Time > TimeSpan.FromMinutes(25000) || interval.Time < TimeSpan.FromMinutes(1))))
|| interval != null &&
(interval.Time > TimeSpan.FromMinutes(25000) || interval.Time < TimeSpan.FromMinutes(1)))
{
return;
}

View File

@@ -89,7 +89,7 @@ public sealed class RunningRepeater
// interval (2.4h) * 0.834 is 2.0016 and that is the initial interval
var initialIntervalMultiplier = 1 - (triggerCount - Math.Truncate(triggerCount));
return DateTime.UtcNow + (Repeater.Interval * initialIntervalMultiplier);
return DateTime.UtcNow + Repeater.Interval * initialIntervalMultiplier;
}
public override bool Equals(object obj)

View File

@@ -79,10 +79,10 @@ public partial class Utility
{
if (originUnit.UnitType == "currency")
{
res = (value * targetUnit.Modifier) / originUnit.Modifier;
res = value * targetUnit.Modifier / originUnit.Modifier;
}
else
res = (value * originUnit.Modifier) / targetUnit.Modifier;
res = value * originUnit.Modifier / targetUnit.Modifier;
}
res = Math.Round(res, 4);

View File

@@ -87,7 +87,7 @@ public partial class Utility : NadekoModule
await ReplyErrorLocalizedAsync(strs.nobody_playing_game).ConfigureAwait(false);
else
{
await SendConfirmAsync("```css\n" + string.Join("\n", arr.GroupBy(item => (i++) / 2)
await SendConfirmAsync("```css\n" + string.Join("\n", arr.GroupBy(item => i++ / 2)
.Select(ig => string.Concat(ig.Select(el => $"• {el,-27}")))) + "\n```")
.ConfigureAwait(false);
}
@@ -348,7 +348,7 @@ public partial class Utility : NadekoModule
if (page < 0)
return;
var guilds = await Task.Run(() => _client.Guilds.OrderBy(g => g.Name).Skip((page) * 15).Take(15)).ConfigureAwait(false);
var guilds = await Task.Run(() => _client.Guilds.OrderBy(g => g.Name).Skip(page * 15).Take(15)).ConfigureAwait(false);
if (!guilds.Any())
{

View File

@@ -74,7 +74,7 @@ public partial class Xp
[NadekoCommand, Aliases]
public async Task ClubIcon([Leftover] string url = null)
{
if ((!Uri.IsWellFormedUriString(url, UriKind.Absolute) && url != null)
if (!Uri.IsWellFormedUriString(url, UriKind.Absolute) && url != null
|| !await _service.SetClubIcon(ctx.User.Id, url is null ? null : new Uri(url)))
{
await ReplyErrorLocalizedAsync(strs.club_icon_error).ConfigureAwait(false);

View File

@@ -294,7 +294,7 @@ public class ClubService : INService
if (usr is null)
return false;
if (club.OwnerId == usr.Id || (usr.IsClubAdmin && club.Owner.UserId != bannerId)) // can't ban the owner kek, whew
if (club.OwnerId == usr.Id || usr.IsClubAdmin && club.Owner.UserId != bannerId) // can't ban the owner kek, whew
return false;
club.Bans.Add(new()
@@ -345,7 +345,7 @@ public class ClubService : INService
if (usr is null)
return false;
if (club.OwnerId == usr.Id || (usr.IsClubAdmin && club.Owner.UserId != kickerId))
if (club.OwnerId == usr.Id || usr.IsClubAdmin && club.Owner.UserId != kickerId)
return false;
club.Users.Remove(usr);

View File

@@ -940,9 +940,9 @@ public class XpService : INService
//xp bar
if (_template.User.Xp.Bar.Show)
{
var xpPercent = (global.LevelXp / (float) global.RequiredXp);
var xpPercent = global.LevelXp / (float) global.RequiredXp;
DrawXpBar(xpPercent, _template.User.Xp.Bar.Global, img);
xpPercent = (guild.LevelXp / (float) guild.RequiredXp);
xpPercent = guild.LevelXp / (float) guild.RequiredXp;
DrawXpBar(xpPercent, _template.User.Xp.Bar.Guild, img);
}
@@ -970,7 +970,7 @@ public class XpService : INService
? "+ "
: "";
var awX = _template.User.Xp.Awarded.Pos.X -
(Math.Max(0, (stats.FullGuildStats.AwardedXp.ToString().Length - 2)) * 5);
Math.Max(0, stats.FullGuildStats.AwardedXp.ToString().Length - 2) * 5;
var awY = _template.User.Xp.Awarded.Pos.Y;
img.Mutate(x => x.DrawText($"({sign}{stats.FullGuildStats.AwardedXp})",
_fonts.NotoSans.CreateFont(_template.User.Xp.Awarded.FontSize, FontStyle.Bold),

View File

@@ -338,7 +338,7 @@ public partial class Xp : NadekoModule<XpService>
await ctx.Channel.TriggerTypingAsync();
var socketGuild = ((SocketGuild)ctx.Guild);
var socketGuild = (SocketGuild)ctx.Guild;
var allUsers = new List<UserXpStats>();
if (opts.Clean)
{
@@ -384,7 +384,7 @@ public partial class Xp : NadekoModule<XpService>
awardStr = $"({userXpData.AwardedXp})";
embed.AddField(
$"#{(i + 1 + curPage * 9)} {(user?.ToString() ?? users[i].UserId.ToString())}",
$"#{i + 1 + curPage * 9} {user?.ToString() ?? users[i].UserId.ToString()}",
$"{GetText(strs.level_x(levelStats.Level))} - {levelStats.TotalXp}xp {awardStr}");
}
return embed;
@@ -412,7 +412,7 @@ public partial class Xp : NadekoModule<XpService>
{
var user = users[i];
embed.AddField(
$"#{i + 1 + page * 9} {(user.ToString())}",
$"#{i + 1 + page * 9} {user.ToString()}",
$"{GetText(strs.level_x(new LevelStats(users[i].TotalXp).Level))} - {users[i].TotalXp}xp");
}
}

View File

@@ -146,8 +146,8 @@ public class CommandHandler : INService
"Channel: {2}\n\t" +
"Message: {3}",
usrMsg.Author + " [" + usrMsg.Author.Id + "]", // {0}
(channel is null ? "PRIVATE" : channel.Guild.Name + " [" + channel.Guild.Id + "]"), // {1}
(channel is null ? "PRIVATE" : channel.Name + " [" + channel.Id + "]"), // {2}
channel is null ? "PRIVATE" : channel.Guild.Name + " [" + channel.Guild.Id + "]", // {1}
channel is null ? "PRIVATE" : channel.Name + " [" + channel.Id + "]", // {2}
usrMsg.Content // {3}
);
}

View File

@@ -50,10 +50,10 @@ public class GreetSettingsService : INService
{
// if user is a new booster
// or boosted again the same server
if ((oldUser is { PremiumSince: null } && newUser is { PremiumSince: not null })
|| (oldUser?.PremiumSince is { } oldDate
if (oldUser is { PremiumSince: null } && newUser is { PremiumSince: not null }
|| oldUser?.PremiumSince is { } oldDate
&& newUser?.PremiumSince is { } newDate
&& newDate > oldDate))
&& newDate > oldDate)
{
var conf = GetOrAddSettingsForGuild(newUser.Guild.Id);
if (!conf.SendBoostMessage) return Task.CompletedTask;

View File

@@ -375,7 +375,7 @@ public class GoogleApiService : IGoogleApiService, INService
text = await http.GetStringAsync(url).ConfigureAwait(false);
}
return (string.Concat(JArray.Parse(text)[0].Select(x => x[0])));
return string.Concat(JArray.Parse(text)[0].Select(x => x[0]));
}
private string ConvertToLanguageCode(string language)

View File

@@ -39,15 +39,15 @@ public static class IEnumerableExtensions
var n = list.Count;
while (n > 1)
{
var box = new byte[(n / Byte.MaxValue) + 1];
var box = new byte[n / Byte.MaxValue + 1];
int boxSum;
do
{
provider.GetBytes(box);
boxSum = box.Sum(b => b);
} while (!(boxSum < n * ((Byte.MaxValue * box.Length) / n)));
} while (!(boxSum < n * (Byte.MaxValue * box.Length / n)));
var k = (boxSum % n);
var k = boxSum % n;
n--;
var value = list[k];
list[k] = list[n];

View File

@@ -115,7 +115,7 @@ public static class StringExtensions
for (var j = 1; j <= m; j++)
{
// Step 5
var cost = (t[j - 1] == s[i - 1]) ? 0 : 1;
var cost = t[j - 1] == s[i - 1] ? 0 : 1;
// Step 6
d[i, j] = Math.Min(