Skip to content

Commit

Permalink
update stripe command
Browse files Browse the repository at this point in the history
  • Loading branch information
th0mk committed Oct 18, 2024
1 parent a527c86 commit 59dd26b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/FMBot.Bot/Resources/InteractionConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public static class SupporterLinks
{
public const string GetPurchaseLink = "supporter-purchase-link";
public const string GetManageLink = "supporter-manage-link";
public const string ViewPerks = "supporter-view-perks";
}

public const string BotScrobblingEnable = "user-setting-botscrobbling-enable";
Expand Down
11 changes: 11 additions & 0 deletions src/FMBot.Bot/SlashCommands/StaticSlashCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ public async Task SupportersAsync()
this.Context.LogCommandUsed(response.CommandResponse);
}

[ComponentInteraction(InteractionConstants.SupporterLinks.ViewPerks)]
[UserSessionRequired]
public async Task SupporterPerks()
{
var contextUser = await this._userService.GetUserSettingsAsync(this.Context.User);
var response = await this._staticBuilders.DonateAsync(new ContextModel(this.Context, contextUser));

await this.Context.SendResponse(this.Interactivity, response, true);
this.Context.LogCommandUsed(response.CommandResponse);
}

[ComponentInteraction($"{InteractionConstants.SupporterLinks.GetPurchaseLink}-*")]
[UserSessionRequired]
public async Task GetSupporterLink(string type)
Expand Down
24 changes: 19 additions & 5 deletions src/FMBot.Bot/TextCommands/AdminCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@ await ReplyAsync("Enter an username to check\n" +
{
isBannedSomewhere = true;
}

if (bottedUser != null)
{
this._embed.AddField("Reason / additional notes", bottedUser.Notes ?? "*No reason/notes*");
Expand Down Expand Up @@ -1943,6 +1944,7 @@ public async Task UpdateSingleDiscordSupporters([Remainder] string user)
this.Context.LogCommandUsed(CommandResponse.NoPermission);
}
}

[Command("updatemultidiscordsupporters")]
[Summary("Updates multiple discord supporter")]
public async Task UpdateMultipleDiscordSupporters([Remainder] string user)
Expand Down Expand Up @@ -2352,11 +2354,20 @@ public async Task GetSupporterTestLink([Remainder] string user = null)
{
if (await this._adminService.HasCommandAccessAsync(this.Context.User, UserType.Admin))
{
var components = new ComponentBuilder().WithButton("Generate link",
customId: InteractionConstants.SupporterLinks.GetPurchaseLink);
var components = new ComponentBuilder()
.WithButton("Get monthly", customId: $"{InteractionConstants.SupporterLinks.GetPurchaseLink}-monthly")
.WithButton("Get yearly", customId: $"{InteractionConstants.SupporterLinks.GetPurchaseLink}-yearly")
.WithButton("View perks", customId: InteractionConstants.SupporterLinks.ViewPerks);

await ReplyAsync($"Use the button below to get your unique purchase link",
allowedMentions: AllowedMentions.None, components: components.Build());
var embed = new EmbedBuilder();
embed.WithDescription("⭐ Support .fmbot with .fmbot supporter and unlock extra perks");
embed.AddField("Monthly - $3.99",
"-# $3.99 per month", true);
embed.AddField("Yearly - $29.99",
"-# $2.49 per month", true);
embed.WithColor(DiscordConstants.InformationColorBlue);

await ReplyAsync(embed: embed.Build(), components: components.Build());
this.Context.LogCommandUsed();
}
else
Expand Down Expand Up @@ -2749,7 +2760,10 @@ public async Task LastfmIssue(string _ = null)
await ReplyAsync(null, embed: embed.Build(), allowedMentions: AllowedMentions.None,
components: components.Build());

if (this.Context.Channel is SocketThreadChannel { ParentChannel: SocketForumChannel forumChannel } threadChannel &&
if (this.Context.Channel is SocketThreadChannel
{
ParentChannel: SocketForumChannel forumChannel
} threadChannel &&
forumChannel.Tags.Any())
{
var tagToApply = forumChannel.Tags.FirstOrDefault(f => f.Name == "Last.fm issue");
Expand Down

0 comments on commit 59dd26b

Please sign in to comment.