timely 'password' is now a button
This commit is contained in:
parent
7f9a939285
commit
c330d086b7
2 changed files with 24 additions and 10 deletions
|
@ -14,14 +14,6 @@ using System.Text;
|
||||||
using EllieBot.Modules.Gambling.Rps;
|
using EllieBot.Modules.Gambling.Rps;
|
||||||
using EllieBot.Common.TypeReaders;
|
using EllieBot.Common.TypeReaders;
|
||||||
using EllieBot.Modules.Patronage;
|
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;
|
|
||||||
using Random = System.Random;
|
|
||||||
|
|
||||||
namespace EllieBot.Modules.Gambling;
|
namespace EllieBot.Modules.Gambling;
|
||||||
|
|
||||||
|
@ -152,6 +144,18 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||||
(smc) => RemindTimelyAction(smc, DateTime.UtcNow.Add(TimeSpan.FromMilliseconds(ms)))
|
(smc) => RemindTimelyAction(smc, DateTime.UtcNow.Add(TimeSpan.FromMilliseconds(ms)))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
private EllieInteractionBase CreateTimelyInteraction()
|
||||||
|
=> _inter
|
||||||
|
.Create(ctx.User.Id,
|
||||||
|
new ButtonBuilder(
|
||||||
|
label: "Timely",
|
||||||
|
emote: Emoji.Parse("💰"),
|
||||||
|
customId: "timely:" + _rng.Next(123456, 999999)),
|
||||||
|
async (smc) =>
|
||||||
|
{
|
||||||
|
await ClaimTimely();
|
||||||
|
});
|
||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
public async Task Timely()
|
public async Task Timely()
|
||||||
{
|
{
|
||||||
|
@ -214,10 +218,18 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||||
// _ = captcha.DeleteAsync();
|
// _ = captcha.DeleteAsync();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// await Response()
|
var interaction = CreateTimelyInteraction();
|
||||||
// .Interaction(_inter.Create(ctx.User.Id,new ButtonBuilder("Timely", $"timely:{rng}" Emoji.Parse("⏰")),null))
|
var msg = await Response().Pending(strs.timely_button).Interaction(interaction).SendAsync();
|
||||||
|
await msg.DeleteAsync();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await ClaimTimely();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ClaimTimely()
|
||||||
|
{
|
||||||
|
var period = Config.Timely.Cooldown;
|
||||||
if (await _service.ClaimTimelyAsync(ctx.User.Id, period) is { } remainder)
|
if (await _service.ClaimTimelyAsync(ctx.User.Id, period) is { } remainder)
|
||||||
{
|
{
|
||||||
// Get correct time form remainder
|
// Get correct time form remainder
|
||||||
|
@ -236,6 +248,7 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var val = Config.Timely.Amount;
|
||||||
var patron = await _ps.GetPatronAsync(ctx.User.Id);
|
var patron = await _ps.GetPatronAsync(ctx.User.Id);
|
||||||
|
|
||||||
var percentBonus = (_ps.PercentBonus(patron) / 100f);
|
var percentBonus = (_ps.PercentBonus(patron) / 100f);
|
||||||
|
|
|
@ -622,6 +622,7 @@
|
||||||
"region": "Region",
|
"region": "Region",
|
||||||
"remind2": "I will remind {0} to {1} {2} ({3})",
|
"remind2": "I will remind {0} to {1} {2} ({3})",
|
||||||
"remind_timely": "I will remind you about your timely reward {0}",
|
"remind_timely": "I will remind you about your timely reward {0}",
|
||||||
|
"timely_button": "Click the button to claim your timely reward.",
|
||||||
"remind_invalid": "Not a valid remind format. Remind must have a target, timer and a reason. Check the command list.",
|
"remind_invalid": "Not a valid remind format. Remind must have a target, timer and a reason. Check the command list.",
|
||||||
"remind_too_long": "Remind time has exceeded maximum.",
|
"remind_too_long": "Remind time has exceeded maximum.",
|
||||||
"repeater_redundant_no": "Repeater **#{0}** won't post redundant messages anymore.",
|
"repeater_redundant_no": "Repeater **#{0}** won't post redundant messages anymore.",
|
||||||
|
|
Loading…
Reference in a new issue