mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
Fixed some aliases and reworked namespaces
This commit is contained in:
@@ -128,7 +128,7 @@ public partial class Gambling
|
||||
embed.AddField(full, cStr);
|
||||
}
|
||||
|
||||
msg = await ctx.Channel.EmbedAsync(embed);
|
||||
msg = await EmbedAsync(embed);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@@ -1,39 +0,0 @@
|
||||
using Nadeko.Bot.Modules.Gambling.Gambling._Common;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling;
|
||||
|
||||
public partial class Gambling
|
||||
{
|
||||
[Group]
|
||||
public class CleanupCommands : CleanupModuleBase
|
||||
{
|
||||
private readonly IGamblingCleanupService _gcs;
|
||||
|
||||
public CleanupCommands(IGamblingCleanupService gcs)
|
||||
{
|
||||
_gcs = gcs;
|
||||
}
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task DeleteWaifus()
|
||||
=> ConfirmActionInternalAsync("Delete Waifus", () => _gcs.DeleteWaifus());
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task DeleteWaifu(IUser user)
|
||||
=> await DeleteWaifu(user.Id);
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task DeleteWaifu(ulong userId)
|
||||
=> ConfirmActionInternalAsync($"Delete Waifu {userId}", () => _gcs.DeleteWaifu(userId));
|
||||
|
||||
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task DeleteCurrency()
|
||||
=> ConfirmActionInternalAsync("Delete Currency", () => _gcs.DeleteCurrency());
|
||||
|
||||
}
|
||||
}
|
@@ -167,7 +167,7 @@ public partial class Gambling
|
||||
|
||||
|
||||
if (msg is null)
|
||||
msg = await ctx.Channel.EmbedAsync(embed);
|
||||
msg = await EmbedAsync(embed);
|
||||
else
|
||||
await msg.ModifyAsync(x => x.Embed = embed.Build());
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using NadekoBot.Common;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling;
|
||||
|
||||
|
@@ -148,7 +148,7 @@ public partial class Gambling
|
||||
.AddField(Format.Bold("Result"),
|
||||
string.Join(" ", rolls.Select(c => Format.Code($"[{c}]"))));
|
||||
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
await EmbedAsync(embed);
|
||||
}
|
||||
else if ((match = _dndRegex.Match(arg)).Length != 0)
|
||||
{
|
||||
@@ -180,7 +180,7 @@ public partial class Gambling
|
||||
=> Format.Code(x.ToString()))))
|
||||
.AddField(Format.Bold("Sum"),
|
||||
sum + " + " + add + " - " + sub + " = " + (sum + add - sub));
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
await EmbedAsync(embed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using NadekoBot.Modules.Gambling.Common.Events;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
using NadekoBot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling;
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using NadekoBot.Modules.Gambling.Common.Events;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
using NadekoBot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling.Services;
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
using Nadeko.Bot.Db.Models;
|
||||
using NadekoBot.Db.Models;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling.Common.Events;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
using Nadeko.Bot.Db.Models;
|
||||
using NadekoBot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling.Common.Events;
|
||||
|
||||
|
@@ -130,7 +130,7 @@ public partial class Gambling
|
||||
str = Format.Bold(GetText(strs.better_luck));
|
||||
}
|
||||
|
||||
await ctx.Channel.EmbedAsync(_eb.Create()
|
||||
await EmbedAsync(_eb.Create()
|
||||
.WithAuthor(ctx.User)
|
||||
.WithDescription(str)
|
||||
.WithOkColor()
|
||||
|
@@ -8,7 +8,6 @@ using NadekoBot.Modules.Gambling.Common;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using NadekoBot.Modules.Utility.Services;
|
||||
using NadekoBot.Services.Currency;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
using System.Collections.Immutable;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
@@ -103,7 +102,7 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
|
||||
eb.WithDescription(str);
|
||||
|
||||
await ctx.Channel.EmbedAsync(eb);
|
||||
await EmbedAsync(eb);
|
||||
}
|
||||
|
||||
[Cmd]
|
||||
@@ -131,7 +130,7 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
.WithOkColor();
|
||||
|
||||
// ec.Cash already contains ec.Bot as it's the total of all values in the CurrencyAmount column of the DiscordUser table
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
await EmbedAsync(embed);
|
||||
}
|
||||
|
||||
private static readonly FeatureLimitKey _timelyKey = new FeatureLimitKey()
|
||||
@@ -332,7 +331,7 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
|
||||
embed.WithDescription(sb.ToString());
|
||||
embed.WithFooter(GetText(strs.page(page + 1)));
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
await EmbedAsync(embed);
|
||||
}
|
||||
|
||||
private static string GetFormattedCurtrDate(CurrencyTransaction ct)
|
||||
@@ -375,7 +374,7 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
|
||||
eb.WithFooter(GetFormattedCurtrDate(tr));
|
||||
|
||||
await ctx.Channel.EmbedAsync(eb);
|
||||
await EmbedAsync(eb);
|
||||
}
|
||||
|
||||
private string GetHumanReadableTransaction(string type, string subType, ulong? maybeUserId)
|
||||
|
@@ -6,7 +6,6 @@ using NadekoBot.Db;
|
||||
using NadekoBot.Db.Models;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using NadekoBot.Modules.Gambling.Common.Connect4;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling.Services;
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using System.Numerics;
|
||||
using NadekoBot.Common;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling.Common;
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Common.ModuleBehaviors;
|
||||
using NadekoBot.Db;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
using NadekoBot.Db.Models;
|
||||
using SixLabors.Fonts;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Drawing.Processing;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
using Nadeko.Bot.Db.Models;
|
||||
using NadekoBot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling.Services;
|
||||
|
||||
|
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Db;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
using NadekoBot.Db.Models;
|
||||
using NadekoBot.Modules.Administration;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling;
|
||||
@@ -246,7 +246,7 @@ public partial class Gambling
|
||||
.WithTitle("Executing shop command")
|
||||
.WithDescription(cmd);
|
||||
|
||||
var msgTask = ctx.Channel.EmbedAsync(eb);
|
||||
var msgTask = EmbedAsync(eb);
|
||||
|
||||
await _cs.AddAsync(entry.AuthorId,
|
||||
GetProfitAmount(entry.Price),
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#nullable disable
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Db;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
using NadekoBot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling.Services;
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using NadekoBot.Modules.Gambling.Common.Waifu;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
using NadekoBot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling;
|
||||
|
||||
@@ -217,7 +217,7 @@ public partial class Gambling
|
||||
embed.AddField("#" + ((page * 9) + j + 1) + " - " + N(w.Price), GetLbString(w));
|
||||
}
|
||||
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
await EmbedAsync(embed);
|
||||
}
|
||||
|
||||
private string GetLbString(WaifuLbResult w)
|
||||
|
@@ -7,7 +7,6 @@ using NadekoBot.Db;
|
||||
using NadekoBot.Db.Models;
|
||||
using NadekoBot.Modules.Gambling.Common;
|
||||
using NadekoBot.Modules.Gambling.Common.Waifu;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Modules.Gambling.Services;
|
||||
|
||||
|
@@ -1,7 +1,5 @@
|
||||
#nullable disable
|
||||
using NadekoBot.Db.Models;
|
||||
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
namespace NadekoBot.Db.Models;
|
||||
|
||||
public class WaifuInfo : DbEntity
|
||||
{
|
||||
|
@@ -4,8 +4,6 @@ using LinqToDB.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Db.Models;
|
||||
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Db;
|
||||
|
||||
public static class WaifuExtensions
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
namespace NadekoBot.Db.Models;
|
||||
|
||||
public class WaifuItem : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
namespace NadekoBot.Db.Models;
|
||||
|
||||
public class WaifuLbResult
|
||||
{
|
||||
|
@@ -1,7 +1,5 @@
|
||||
#nullable disable
|
||||
using NadekoBot.Db.Models;
|
||||
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
namespace NadekoBot.Db.Models;
|
||||
|
||||
public class WaifuUpdate : DbEntity
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
namespace Nadeko.Bot.Db.Models;
|
||||
namespace NadekoBot.Db.Models;
|
||||
|
||||
public enum WaifuUpdateType
|
||||
{
|
||||
|
@@ -1,8 +1,8 @@
|
||||
using LinqToDB;
|
||||
using LinqToDB.EntityFrameworkCore;
|
||||
using NadekoBot.Db.Models;
|
||||
using Nadeko.Bot.Db.Models;
|
||||
|
||||
namespace Nadeko.Bot.Modules.Gambling.Gambling._Common;
|
||||
namespace NadekoBot.Modules.Gambling;
|
||||
|
||||
public class GamblingCleanupService : IGamblingCleanupService, INService
|
||||
{
|
||||
@@ -16,45 +16,41 @@ public class GamblingCleanupService : IGamblingCleanupService, INService
|
||||
public async Task DeleteWaifus()
|
||||
{
|
||||
await using var ctx = _db.GetDbContext();
|
||||
await ctx.Set<WaifuInfo>().DeleteAsync();
|
||||
await ctx.Set<WaifuItem>().DeleteAsync();
|
||||
await ctx.Set<WaifuUpdate>().DeleteAsync();
|
||||
await ctx.SaveChangesAsync();
|
||||
await ctx.GetTable<WaifuInfo>().DeleteAsync();
|
||||
await ctx.GetTable<WaifuItem>().DeleteAsync();
|
||||
await ctx.GetTable<WaifuUpdate>().DeleteAsync();
|
||||
}
|
||||
|
||||
public async Task DeleteWaifu(ulong userId)
|
||||
{
|
||||
await using var ctx = _db.GetDbContext();
|
||||
await ctx.Set<WaifuUpdate>()
|
||||
await ctx.GetTable<WaifuUpdate>()
|
||||
.Where(x => x.User.UserId == userId)
|
||||
.DeleteAsync();
|
||||
await ctx.Set<WaifuItem>()
|
||||
await ctx.GetTable<WaifuItem>()
|
||||
.Where(x => x.WaifuInfo.Waifu.UserId == userId)
|
||||
.DeleteAsync();
|
||||
await ctx.Set<WaifuInfo>()
|
||||
await ctx.GetTable<WaifuInfo>()
|
||||
.Where(x => x.Claimer.UserId == userId)
|
||||
.UpdateAsync(old => new WaifuInfo()
|
||||
{
|
||||
ClaimerId = null,
|
||||
});
|
||||
await ctx.Set<WaifuInfo>()
|
||||
await ctx.GetTable<WaifuInfo>()
|
||||
.Where(x => x.Waifu.UserId == userId)
|
||||
.DeleteAsync();
|
||||
await ctx.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task DeleteCurrency()
|
||||
{
|
||||
await using var uow = _db.GetDbContext();
|
||||
await uow.Set<DiscordUser>().UpdateAsync(_ => new DiscordUser()
|
||||
await using var ctx = _db.GetDbContext();
|
||||
await ctx.GetTable<DiscordUser>().UpdateAsync(_ => new DiscordUser()
|
||||
{
|
||||
CurrencyAmount = 0
|
||||
});
|
||||
|
||||
await uow.Set<CurrencyTransaction>().DeleteAsync();
|
||||
await uow.Set<PlantedCurrency>().DeleteAsync();
|
||||
await uow.Set<BankUser>().DeleteAsync();
|
||||
await uow.SaveChangesAsync();
|
||||
await ctx.GetTable<CurrencyTransaction>().DeleteAsync();
|
||||
await ctx.GetTable<PlantedCurrency>().DeleteAsync();
|
||||
await ctx.GetTable<BankUser>().DeleteAsync();
|
||||
}
|
||||
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
namespace Nadeko.Bot.Modules.Gambling.Gambling._Common;
|
||||
namespace NadekoBot.Modules.Gambling;
|
||||
|
||||
public interface IGamblingCleanupService
|
||||
{
|
||||
|
Reference in New Issue
Block a user