Xp system fixes
This commit is contained in:
parent
4c591a69b1
commit
ea0ca1471f
@ -343,9 +343,6 @@ namespace NadekoBot.Modules.Xp.Services
|
|||||||
|
|
||||||
var _ = Task.Run(() =>
|
var _ = Task.Run(() =>
|
||||||
{
|
{
|
||||||
if (!SetUserRewarded(user.Id))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_excludedChannels.TryGetValue(user.Guild.Id, out var chans) &&
|
if (_excludedChannels.TryGetValue(user.Guild.Id, out var chans) &&
|
||||||
chans.Contains(arg.Channel.Id))
|
chans.Contains(arg.Channel.Id))
|
||||||
return;
|
return;
|
||||||
@ -359,6 +356,10 @@ namespace NadekoBot.Modules.Xp.Services
|
|||||||
|
|
||||||
if (!arg.Content.Contains(' ') && arg.Content.Length < 5)
|
if (!arg.Content.Contains(' ') && arg.Content.Length < 5)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!SetUserRewarded(user.Id))
|
||||||
|
return;
|
||||||
|
|
||||||
_addMessageXp.Enqueue(new UserCacheItem { Guild = user.Guild, Channel = arg.Channel, User = user });
|
_addMessageXp.Enqueue(new UserCacheItem { Guild = user.Guild, Channel = arg.Channel, User = user });
|
||||||
});
|
});
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
@ -58,7 +58,9 @@ namespace NadekoBot.Services.Database.Repositories.Impl
|
|||||||
.Where(x => x.GuildId == guildId)
|
.Where(x => x.GuildId == guildId)
|
||||||
.Count(x => x.Xp > (_set
|
.Count(x => x.Xp > (_set
|
||||||
.Where(y => y.UserId == userId && y.GuildId == guildId)
|
.Where(y => y.UserId == userId && y.GuildId == guildId)
|
||||||
.Sum(y => y.Xp))) + 1;
|
.Select(y => y.Xp)
|
||||||
|
.DefaultIfEmpty()
|
||||||
|
.Sum())) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public (ulong UserId, int TotalXp)[] GetUsersFor(int page)
|
public (ulong UserId, int TotalXp)[] GetUsersFor(int page)
|
||||||
|
@ -135,7 +135,7 @@ namespace NadekoBot.Extensions
|
|||||||
public static MemoryStream ToStream(this ImageSharp.Image<Rgba32> img)
|
public static MemoryStream ToStream(this ImageSharp.Image<Rgba32> img)
|
||||||
{
|
{
|
||||||
var imageStream = new MemoryStream();
|
var imageStream = new MemoryStream();
|
||||||
img.SaveAsPng(imageStream);
|
img.SaveAsPng(imageStream, new ImageSharp.Formats.PngEncoder() { CompressionLevel = 9});
|
||||||
imageStream.Position = 0;
|
imageStream.Position = 0;
|
||||||
return imageStream;
|
return imageStream;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user