Dont check invites on button click

This commit is contained in:
Joseph Ferano 2022-06-13 22:09:52 +07:00
parent b08426001a
commit 73ce6c08f1

View File

@ -61,28 +61,7 @@ let grantWhitelistRole isOg (ctx : IDiscordContext) =
let handleButtonEvent _ (event : ComponentInteractionCreateEventArgs) =
let ctx = DiscordEventContext event :> IDiscordContext
match event.Id with
| id when id.StartsWith("GimmeWhitelist") ->
task {
let builder = DiscordInteractionResponseBuilder().AsEphemeral(true).WithContent("Content")
do! ctx.Respond(InteractionResponseType.DeferredChannelMessageWithSource, builder) |> Async.AwaitTask
let! invites = InviteTracker.getInvitedUserCount (ctx.GetDiscordMember().Id)
if invites > 0 then
let! playerResult = DbService.tryFindPlayer (ctx.GetDiscordMember().Id)
match playerResult with
| Some player -> do! Store.buyForPlayer "WHITELIST" player None ctx |> Async.StartAsTask
| None -> do! Messaging.sendFollowUpMessage ctx "You are currently not a hacker, first use the /redpill command to become one"
else
let builder = DiscordFollowupMessageBuilder().AsEphemeral(true)
builder.Content <- $"""
**Degen**, cant you **READ**?!
⚠️ **__Requirements:__** 1x Invited User
To BUY Whitelist you must have **__INVITED__** 1 Degen.
☑️ Go to <#{GuildEnvironment.channelRecruitment}>
☑️ Invite just 1 Degen!
"""
do! ctx.FollowUp(builder)
} :> Task
| id when id.StartsWith("GimmeWhitelist") -> Store.buy "WHITELIST" None ctx
| id when id.StartsWith("Buy") ->
task {
let id = ctx.GetInteractionId()