forked from EllieBotDevs/elliebot
.savechat no longer owneronly
started implementation of bigwin announcement, but there are problems
This commit is contained in:
parent
082cf79736
commit
988d8c0250
8 changed files with 66 additions and 15 deletions
src/EllieBot
Db
Modules
_common/Services/Currency
|
@ -272,9 +272,6 @@ public abstract class EllieContext : DbContext
|
|||
du.Property(x => x.IsClubAdmin)
|
||||
.HasDefaultValue(false);
|
||||
|
||||
du.Property(x => x.NotifyOnLevelUp)
|
||||
.HasDefaultValue(XpNotificationLocation.None);
|
||||
|
||||
du.Property(x => x.TotalXp)
|
||||
.HasDefaultValue(0);
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
namespace EllieBot.Db.Models;
|
||||
|
||||
|
||||
// FUTURE remove LastLevelUp from here and UserXpStats
|
||||
public class DiscordUser : DbEntity
|
||||
{
|
||||
public const string DEFAULT_USERNAME = "??Unknown";
|
||||
|
@ -15,7 +13,6 @@ public class DiscordUser : DbEntity
|
|||
public bool IsClubAdmin { get; set; }
|
||||
|
||||
public long TotalXp { get; set; }
|
||||
public XpNotificationLocation NotifyOnLevelUp { get; set; }
|
||||
|
||||
public long CurrencyAmount { get; set; }
|
||||
|
||||
|
|
|
@ -21,4 +21,5 @@ public enum NotifyType
|
|||
Protection = 1, Prot = 1,
|
||||
AddRoleReward = 2,
|
||||
RemoveRoleReward = 3,
|
||||
// BigWin = 4,
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
// using System.Globalization;
|
||||
// using EllieBot.Db.Models;
|
||||
// using EllieBot.Modules.Administration;
|
||||
//
|
||||
// namespace EllieBot.Modules.Gambling;
|
||||
//
|
||||
// public readonly record struct BigWinNotifyModel(
|
||||
// string GuildName,
|
||||
// ulong ChannelId,
|
||||
// ulong UserId,
|
||||
// string Amount)
|
||||
// : INotifyModel<BigWinNotifyModel>
|
||||
// {
|
||||
// public const string PH_USER = "user";
|
||||
// public const string PH_GUILD = "server";
|
||||
// public const string PH_AMOUNT = "amount";
|
||||
//
|
||||
// public static string KeyName
|
||||
// => "notify.bigwin";
|
||||
//
|
||||
// public static NotifyType NotifyType
|
||||
// => NotifyType.BigWin;
|
||||
//
|
||||
// public static bool SupportsOriginTarget
|
||||
// => true;
|
||||
//
|
||||
// public static IReadOnlyList<NotifyModelPlaceholderData<BigWinNotifyModel>> GetReplacements()
|
||||
// =>
|
||||
// [
|
||||
// new(PH_USER, static (data, g) => g.GetUser(data.UserId)?.ToString() ?? data.UserId.ToString()),
|
||||
// new(PH_AMOUNT, static (data, g) => data.Amount),
|
||||
// new(PH_GUILD, static (data, g) => data.GuildName)
|
||||
// ];
|
||||
//
|
||||
// public bool TryGetChannelId(out ulong channelId)
|
||||
// {
|
||||
// channelId = ChannelId;
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// public bool TryGetUserId(out ulong userId)
|
||||
// {
|
||||
// userId = UserId;
|
||||
// return true;
|
||||
// }
|
||||
// }
|
|
@ -4,6 +4,7 @@ using EllieBot.Common.ModuleBehaviors;
|
|||
using EllieBot.Db.Models;
|
||||
using EllieBot.Generators;
|
||||
using EllieBot.Modules.Administration.Services;
|
||||
using EllieBot.Modules.Gambling;
|
||||
using EllieBot.Modules.Xp.Services;
|
||||
|
||||
namespace EllieBot.Modules.Administration;
|
||||
|
|
|
@ -15,13 +15,6 @@ using EllieBot.Modules.Gambling.Rps;
|
|||
using EllieBot.Common.TypeReaders;
|
||||
using EllieBot.Modules.Games;
|
||||
using EllieBot.Modules.Patronage;
|
||||
using SixLabors.Fonts;
|
||||
using SixLabors.Fonts.Unicode;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Drawing.Processing;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using Color = SixLabors.ImageSharp.Color;
|
||||
|
||||
namespace EllieBot.Modules.Gambling;
|
||||
|
||||
|
|
|
@ -642,9 +642,13 @@ public partial class Utility : EllieModule
|
|||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Ratelimit(3600)]
|
||||
public async Task SaveChat(int cnt)
|
||||
{
|
||||
if (cnt > 1000)
|
||||
return;
|
||||
|
||||
var msgs = new List<IMessage>(cnt);
|
||||
await ctx.Channel.GetMessagesAsync(cnt).ForEachAsync(dled => msgs.AddRange(dled));
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ using EllieBot.Services.Currency;
|
|||
using EllieBot.Db.Models;
|
||||
using EllieBot.Modules.Gambling;
|
||||
using System.Collections.Concurrent;
|
||||
using EllieBot.Modules.Administration;
|
||||
using EllieBot.Modules.Gambling.Services;
|
||||
|
||||
namespace EllieBot.Services;
|
||||
|
||||
|
@ -20,10 +22,14 @@ public sealed class GamblingTxTracker : ITxTracker, IEService, IReadyExecutor
|
|||
private ConcurrentBag<UserBetStats> userStats = new();
|
||||
|
||||
private readonly DbService _db;
|
||||
private readonly GamblingConfigService _gcs;
|
||||
private readonly INotifySubscriber _notify;
|
||||
|
||||
public GamblingTxTracker(DbService db)
|
||||
public GamblingTxTracker(DbService db, GamblingConfigService gcs, INotifySubscriber notify)
|
||||
{
|
||||
_db = db;
|
||||
_gcs = gcs;
|
||||
_notify = notify;
|
||||
}
|
||||
|
||||
public async Task OnReadyAsync()
|
||||
|
@ -184,6 +190,12 @@ public sealed class GamblingTxTracker : ITxTracker, IEService, IReadyExecutor
|
|||
if (mType is not { } type)
|
||||
return Task.CompletedTask;
|
||||
|
||||
// var bigWin = _gcs.Data.BigWin;
|
||||
// if (bigWin > 0 && amount >= bigWin)
|
||||
// {
|
||||
// _notify.NotifyAsync<BigWinNotifyModel>(new())
|
||||
// }
|
||||
|
||||
if (txData.Type == "lula")
|
||||
{
|
||||
if (txData.Extra == "lose")
|
||||
|
|
Loading…
Add table
Reference in a new issue