mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 17:58:26 -04:00
- More code cleanup and codestyle updates
- Fixed some possible nullref exceptions - Methods signatures now have up to 3 parameters before breakaing down each parameter in a separate line - Method invocations have the same rule, except the first parameter will be in the same line as the invocation to prevent some ugliness when passing lambas as arguments - Applied many more codestyles - Extensions folder fully reformatted
This commit is contained in:
@@ -10,9 +10,7 @@ public partial class Xp
|
||||
private readonly XpService _xps;
|
||||
|
||||
public Club(XpService xps)
|
||||
{
|
||||
_xps = xps;
|
||||
}
|
||||
=> _xps = xps;
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
public async Task ClubTransfer([Leftover] IUser newOwner)
|
||||
|
@@ -283,12 +283,8 @@ public enum XpTemplateDirection
|
||||
public class XpRgba32Converter : JsonConverter<Rgba32>
|
||||
{
|
||||
public override Rgba32 ReadJson(JsonReader reader, Type objectType, Rgba32 existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
{
|
||||
return SixLabors.ImageSharp.Color.ParseHex(reader.Value?.ToString());
|
||||
}
|
||||
=> SixLabors.ImageSharp.Color.ParseHex(reader.Value?.ToString());
|
||||
|
||||
public override void WriteJson(JsonWriter writer, Rgba32 value, JsonSerializer serializer)
|
||||
{
|
||||
writer.WriteValue(value.ToHex().ToLowerInvariant());
|
||||
}
|
||||
=> writer.WriteValue(value.ToHex().ToLowerInvariant());
|
||||
}
|
@@ -8,12 +8,8 @@ public class UserCacheItem
|
||||
public int XpAmount { get; set; }
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return User.GetHashCode();
|
||||
}
|
||||
=> User.GetHashCode();
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is UserCacheItem uci && uci.User == User;
|
||||
}
|
||||
=> obj is UserCacheItem uci && uci.User == User;
|
||||
}
|
@@ -1,4 +1,3 @@
|
||||
using NadekoBot.Common.Collections;
|
||||
using NadekoBot.Db.Models;
|
||||
using Newtonsoft.Json;
|
||||
using SixLabors.Fonts;
|
||||
@@ -312,9 +311,7 @@ public class XpService : INService
|
||||
}
|
||||
|
||||
public void ReloadXpTemplate()
|
||||
{
|
||||
_pubSub.Pub(_xpTemplateReloadKey, true);
|
||||
}
|
||||
=> _pubSub.Pub(_xpTemplateReloadKey, true);
|
||||
|
||||
public void SetCurrencyReward(ulong guildId, int level, int amount)
|
||||
{
|
||||
@@ -527,14 +524,10 @@ public class XpService : INService
|
||||
}
|
||||
|
||||
private bool ShouldTrackVoiceChannel(SocketVoiceChannel channel)
|
||||
{
|
||||
return channel.Users.Where(UserParticipatingInVoiceChannel).Take(2).Count() >= 2;
|
||||
}
|
||||
=> channel.Users.Where(UserParticipatingInVoiceChannel).Take(2).Count() >= 2;
|
||||
|
||||
private bool UserParticipatingInVoiceChannel(SocketGuildUser user)
|
||||
{
|
||||
return !user.IsDeafened && !user.IsMuted && !user.IsSelfDeafened && !user.IsSelfMuted;
|
||||
}
|
||||
=> !user.IsDeafened && !user.IsMuted && !user.IsSelfDeafened && !user.IsSelfMuted;
|
||||
|
||||
private void UserJoinedVoiceChannel(SocketGuildUser user)
|
||||
{
|
||||
@@ -650,9 +643,7 @@ public class XpService : INService
|
||||
}
|
||||
|
||||
public bool IsServerExcluded(ulong id)
|
||||
{
|
||||
return _excludedServers.Contains(id);
|
||||
}
|
||||
=> _excludedServers.Contains(id);
|
||||
|
||||
public IEnumerable<ulong> GetExcludedRoles(ulong id)
|
||||
{
|
||||
|
@@ -51,7 +51,7 @@ public partial class Xp : NadekoModule<XpService>
|
||||
{
|
||||
page--;
|
||||
|
||||
if (page < 0 || page > 100)
|
||||
if (page is < 0 or > 100)
|
||||
return Task.CompletedTask;
|
||||
|
||||
var allRewards = _service.GetRoleRewards(ctx.Guild.Id)
|
||||
|
Reference in New Issue
Block a user