mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
DiscordUser repository removed
This commit is contained in:
@@ -51,7 +51,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
{
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
return n(uow.DiscordUsers.GetUserCurrency(id));
|
||||
return n(uow._context.DiscordUser.GetUserCurrency(id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -522,7 +522,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
cleanRichest = uow.DiscordUsers.GetTopRichest(_client.CurrentUser.Id, 10_000);
|
||||
cleanRichest = uow._context.DiscordUser.GetTopRichest(_client.CurrentUser.Id, 10_000);
|
||||
}
|
||||
|
||||
await Context.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
||||
@@ -536,7 +536,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
{
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
cleanRichest = uow.DiscordUsers.GetTopRichest(_client.CurrentUser.Id, 9, page).ToList();
|
||||
cleanRichest = uow._context.DiscordUser.GetTopRichest(_client.CurrentUser.Id, 9, page).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -551,7 +551,7 @@ namespace NadekoBot.Modules.Gambling
|
||||
{
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
toSend = uow.DiscordUsers.GetTopRichest(_client.CurrentUser.Id, 9, curPage);
|
||||
toSend = uow._context.DiscordUser.GetTopRichest(_client.CurrentUser.Id, 9, curPage);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@@ -10,6 +10,7 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Common;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using Serilog;
|
||||
|
||||
@@ -135,11 +136,11 @@ WHERE CurrencyAmount > {config.Decay.MinThreshold} AND UserId!={_client.CurrentU
|
||||
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
cash = uow.DiscordUsers.GetTotalCurrency();
|
||||
onePercent = uow.DiscordUsers.GetTopOnePercentCurrency(_client.CurrentUser.Id);
|
||||
cash = uow._context.DiscordUser.GetTotalCurrency();
|
||||
onePercent = uow._context.DiscordUser.GetTopOnePercentCurrency(_client.CurrentUser.Id);
|
||||
planted = uow._context.PlantedCurrency.AsQueryable().Sum(x => x.Amount);
|
||||
waifus = uow._context.WaifuInfo.GetTotalValue();
|
||||
bot = uow.DiscordUsers.GetUserCurrency(_client.CurrentUser.Id);
|
||||
bot = uow._context.DiscordUser.GetUserCurrency(_client.CurrentUser.Id);
|
||||
}
|
||||
|
||||
var result = new EconomyResult
|
||||
|
@@ -47,7 +47,7 @@ namespace NadekoBot.Modules.Gambling.Services
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var waifu = uow._context.WaifuInfo.ByWaifuUserId(waifuId);
|
||||
var ownerUser = uow.DiscordUsers.GetOrCreate(owner);
|
||||
var ownerUser = uow._context.GetOrCreateUser(owner);
|
||||
|
||||
// owner has to be the owner of the waifu
|
||||
if (waifu == null || waifu.ClaimerId != ownerUser.Id)
|
||||
@@ -82,7 +82,7 @@ namespace NadekoBot.Modules.Gambling.Services
|
||||
}
|
||||
|
||||
//new claimerId is the id of the new owner
|
||||
var newOwnerUser = uow.DiscordUsers.GetOrCreate(newOwner);
|
||||
var newOwnerUser = uow._context.GetOrCreateUser(newOwner);
|
||||
waifu.ClaimerId = newOwnerUser.Id;
|
||||
|
||||
await uow.SaveChangesAsync();
|
||||
@@ -171,8 +171,8 @@ namespace NadekoBot.Modules.Gambling.Services
|
||||
isAffinity = (w?.Affinity?.UserId == user.Id);
|
||||
if (w == null)
|
||||
{
|
||||
var claimer = uow.DiscordUsers.GetOrCreate(user);
|
||||
var waifu = uow.DiscordUsers.GetOrCreate(target);
|
||||
var claimer = uow._context.GetOrCreateUser(user);
|
||||
var waifu = uow._context.GetOrCreateUser(target);
|
||||
if (!await _cs.RemoveAsync(user.Id, "Claimed Waifu", amount, gamble: true))
|
||||
{
|
||||
result = WaifuClaimResult.NotEnoughFunds;
|
||||
@@ -205,7 +205,7 @@ namespace NadekoBot.Modules.Gambling.Services
|
||||
else
|
||||
{
|
||||
var oldClaimer = w.Claimer;
|
||||
w.Claimer = uow.DiscordUsers.GetOrCreate(user);
|
||||
w.Claimer = uow._context.GetOrCreateUser(user);
|
||||
w.Price = amount + (amount / 4);
|
||||
result = WaifuClaimResult.Success;
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace NadekoBot.Modules.Gambling.Services
|
||||
else
|
||||
{
|
||||
var oldClaimer = w.Claimer;
|
||||
w.Claimer = uow.DiscordUsers.GetOrCreate(user);
|
||||
w.Claimer = uow._context.GetOrCreateUser(user);
|
||||
w.Price = amount;
|
||||
result = WaifuClaimResult.Success;
|
||||
|
||||
@@ -258,7 +258,7 @@ namespace NadekoBot.Modules.Gambling.Services
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var w = uow._context.WaifuInfo.ByWaifuUserId(user.Id);
|
||||
var newAff = target == null ? null : uow.DiscordUsers.GetOrCreate(target);
|
||||
var newAff = target == null ? null : uow._context.GetOrCreateUser(target);
|
||||
if (w?.Affinity?.UserId == target?.Id)
|
||||
{
|
||||
}
|
||||
@@ -267,7 +267,7 @@ namespace NadekoBot.Modules.Gambling.Services
|
||||
}
|
||||
else if (w == null)
|
||||
{
|
||||
var thisUser = uow.DiscordUsers.GetOrCreate(user);
|
||||
var thisUser = uow._context.GetOrCreateUser(user);
|
||||
uow._context.WaifuInfo.Add(new WaifuInfo()
|
||||
{
|
||||
Affinity = newAff,
|
||||
@@ -391,7 +391,7 @@ namespace NadekoBot.Modules.Gambling.Services
|
||||
Affinity = null,
|
||||
Claimer = null,
|
||||
Price = 1,
|
||||
Waifu = uow.DiscordUsers.GetOrCreate(giftedWaifu),
|
||||
Waifu = uow._context.GetOrCreateUser(giftedWaifu),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ namespace NadekoBot.Modules.Gambling.Services
|
||||
{
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var du = uow.DiscordUsers.GetOrCreate(target);
|
||||
var du = uow._context.GetOrCreateUser(target);
|
||||
|
||||
return GetFullWaifuInfoAsync(target.Id);
|
||||
}
|
||||
|
@@ -110,7 +110,7 @@ namespace NadekoBot.Modules.Permissions.Services
|
||||
}));
|
||||
|
||||
//clear their currencies
|
||||
uow.DiscordUsers.RemoveFromMany(toBlacklist);
|
||||
uow._context.DiscordUser.RemoveFromMany(toBlacklist);
|
||||
uow.SaveChanges();
|
||||
}
|
||||
|
||||
|
@@ -29,7 +29,7 @@ namespace NadekoBot.Modules.Xp.Services
|
||||
|
||||
club = null;
|
||||
using var uow = _db.GetDbContext();
|
||||
var du = uow.DiscordUsers.GetOrCreate(user);
|
||||
var du = uow._context.GetOrCreateUser(user);
|
||||
uow._context.SaveChanges();
|
||||
var xp = new LevelStats(du.TotalXp);
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace NadekoBot.Modules.Xp.Services
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
club = uow._context.Clubs.GetByOwner(from.Id);
|
||||
var newOwnerUser = uow.DiscordUsers.GetOrCreate(newOwner);
|
||||
var newOwnerUser = uow._context.GetOrCreateUser(newOwner);
|
||||
|
||||
if (club == null ||
|
||||
club.Owner.UserId != from.Id ||
|
||||
@@ -85,7 +85,7 @@ namespace NadekoBot.Modules.Xp.Services
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var club = uow._context.Clubs.GetByOwner(owner.Id);
|
||||
var adminUser = uow.DiscordUsers.GetOrCreate(toAdmin);
|
||||
var adminUser = uow._context.GetOrCreateUser(toAdmin);
|
||||
|
||||
if (club == null || club.Owner.UserId != owner.Id ||
|
||||
!club.Users.Contains(adminUser))
|
||||
@@ -160,7 +160,7 @@ namespace NadekoBot.Modules.Xp.Services
|
||||
{
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var du = uow.DiscordUsers.GetOrCreate(user);
|
||||
var du = uow._context.GetOrCreateUser(user);
|
||||
uow._context.SaveChanges();
|
||||
|
||||
if (du.Club != null
|
||||
@@ -227,7 +227,7 @@ namespace NadekoBot.Modules.Xp.Services
|
||||
{
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var du = uow.DiscordUsers.GetOrCreate(user);
|
||||
var du = uow._context.GetOrCreateUser(user);
|
||||
if (du.Club == null || du.Club.OwnerId == du.Id)
|
||||
return false;
|
||||
|
||||
|
@@ -168,7 +168,7 @@ namespace NadekoBot.Modules.Xp.Services
|
||||
// amounts for every user (in order to give rewards)
|
||||
|
||||
var usr = uow._context.GetOrCreateUserXpStats(item.Key.GuildId, item.Key.User.Id);
|
||||
var du = uow.DiscordUsers.GetOrCreate(item.Key.User);
|
||||
var du = uow._context.GetOrCreateUser(item.Key.User);
|
||||
|
||||
var globalXp = du.TotalXp;
|
||||
var oldGlobalLevelData = new LevelStats(globalXp);
|
||||
@@ -425,7 +425,7 @@ namespace NadekoBot.Modules.Xp.Services
|
||||
{
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
return uow.DiscordUsers.GetUsersXpLeaderboardFor(page);
|
||||
return uow._context.DiscordUser.GetUsersXpLeaderboardFor(page);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ namespace NadekoBot.Modules.Xp.Services
|
||||
{
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
return uow.DiscordUsers.GetOrCreate(user).NotifyOnLevelUp;
|
||||
return uow._context.GetOrCreateUser(user).NotifyOnLevelUp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ namespace NadekoBot.Modules.Xp.Services
|
||||
{
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var du = uow.DiscordUsers.GetOrCreate(user);
|
||||
var du = uow._context.GetOrCreateUser(user);
|
||||
du.NotifyOnLevelUp = type;
|
||||
await uow.SaveChangesAsync();
|
||||
}
|
||||
@@ -706,9 +706,9 @@ namespace NadekoBot.Modules.Xp.Services
|
||||
int guildRank;
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
du = uow.DiscordUsers.GetOrCreate(user);
|
||||
du = uow._context.GetOrCreateUser(user);
|
||||
totalXp = du.TotalXp;
|
||||
globalRank = uow.DiscordUsers.GetUserGlobalRank(user.Id);
|
||||
globalRank = uow._context.DiscordUser.GetUserGlobalRank(user.Id);
|
||||
guildRank = uow._context.UserXpStats.GetUserGuildRanking(user.Id, user.GuildId);
|
||||
stats = uow._context.GetOrCreateUserXpStats(user.GuildId, user.Id);
|
||||
await uow.SaveChangesAsync();
|
||||
|
Reference in New Issue
Block a user