feat: premium ID changes
Some checks failed
Build and push Docker image / .net docker build (push) Has been cancelled
.net checks / run .net tests (push) Has been cancelled
.net checks / dotnet-format (push) Has been cancelled
Build and push Rust service Docker images / rust docker build (push) Has been cancelled
rust checks / cargo fmt (push) Has been cancelled

This commit is contained in:
Iris System 2025-12-28 00:06:51 +13:00
parent 84e98450e0
commit def9285250
19 changed files with 364 additions and 5 deletions

View file

@ -54,7 +54,58 @@ public class Misc
}
}
await ctx.Reply(message + $"\n\nManage your subscription at <{_botConfig.PremiumDashboardUrl}>");
List<MessageComponent> components = [
new MessageComponent()
{
Type = ComponentType.Text,
Content = message,
},
];
if (ctx.Premium)
{
var allowance = await ctx.Repository.GetPremiumAllowance(ctx.System.Id)!;
var hidChangesLeftToday = Limits.PremiumDailyHidChanges - await ctx.Repository.GetHidChangelogCountForDate(ctx.System.Id, SystemClock.Instance.GetCurrentInstant().InUtc().Date);
var limitMessage = $"You have **{allowance.IdChangesRemaining}** ID changes available, of which you can use **{hidChangesLeftToday}** today.";
components.Add(new()
{
Type = ComponentType.Separator,
});
components.Add(new()
{
Type = ComponentType.Text,
Content = limitMessage,
});
}
await ctx.Reply(components: [
new()
{
Type = ComponentType.Container,
Components = [
new()
{
Type = ComponentType.Text,
Content = $"## {(_botConfig.PremiumSubscriberEmoji != null ? $"<:premium_subscriber:{_botConfig.PremiumSubscriberEmoji}>" : "\u2729")} PluralKit Premium",
},
..components,
],
},
new()
{
Type = ComponentType.ActionRow,
Components = [
new()
{
Type = ComponentType.Button,
Style = ButtonStyle.Link,
Label = "Manage your subscription",
Url = _botConfig.PremiumDashboardUrl,
},
],
},
]);
}
public async Task Invite(Context ctx)