Change to a single embed

This commit is contained in:
Joseph Ferano 2022-03-28 17:53:04 +07:00
parent 176ad5d976
commit 85ad842251

View File

@ -316,6 +316,7 @@ let sendInitialEmbed (client : DiscordClient) =
let embed = DiscordEmbedBuilder() let embed = DiscordEmbedBuilder()
embed.ImageUrl <- "https://s1.gifyu.com/images/whitelist-image-2.gif" embed.ImageUrl <- "https://s1.gifyu.com/images/whitelist-image-2.gif"
embed.Title <- "Degenz Game" embed.Title <- "Degenz Game"
embed.Color <- DiscordColor.White
embed.Description <- """ embed.Description <- """
Mint Date: **April 2022** Mint Date: **April 2022**
Supply: **3,333** Supply: **3,333**
@ -362,83 +363,88 @@ let tryGrantWhitelist (ctx : IDiscordContext) =
| None -> return NotInGame | None -> return NotInGame
} }
let notAHackerMsg = $"""
Woah slow down buddy… Youre not even a hacker yet! To get Whitelisted you need to buy it with **$GBT** by playing the game.
Go to <#{GuildEnvironment.channelTraining}> NOW to finish training and become a **HACKER**!**
"""
let notInGameMsg = $"""
Woah slow down buddy… Youre not even in the game yet! To get Whitelisted you need to buy it with **$GBT** by playing the game.
Go to <#{GuildEnvironment.channelShelters}> NOW to get assigned a bunk, and **JOIN THE GAME!**
"""
let alreadyWhitelistedMsg = $"""
Youre **ALREADY** Whitelisted! Save some for other Degenz… **REMEMBER**, you can earn `{InviteRewardAmount} $GBT` 💰 for every Degen you `/recruit` into the game!
**Commands:**
`/recruit` - Invite Degenz into the server.
`/recruited` - Check how many Degenz youve invited.
"""
let notEnoughMoneyMsg total = $"""
Oh no! You don't have enough **$GBT** to buy a WHITELIST spot! Come back when you have `{WhitelistPrice - total}` more $GBT.
The quickest way to earn $GBT is to `/recruit`. You'll earn `{InviteRewardAmount} 💰 $GBT` for every Degen you `/recruit`!
"""
let canBuyWhitelistMsg = $"""
Look at you Degen, you played Big Brothers games and made it out alive! Now you can use your $GBT to pay for one of our coveted Whitelist spots.
Click buy now below and the role will be auto assigned to you.
"""
let handleGimmeWhitelist (ctx : IDiscordContext) = let handleGimmeWhitelist (ctx : IDiscordContext) =
task { task {
let builder = DiscordInteractionResponseBuilder().AsEphemeral(true) let builder = DiscordInteractionResponseBuilder().AsEphemeral(true)
do! ctx.Respond(InteractionResponseType.DeferredChannelMessageWithSource, builder) do! ctx.Respond(InteractionResponseType.DeferredChannelMessageWithSource, builder)
let whitelistEmbed = DiscordEmbedBuilder() let whitelistEmbed = DiscordEmbedBuilder()
let thumb = DiscordEmbedBuilder.EmbedThumbnail() whitelistEmbed.ImageUrl <- "https://s7.gifyu.com/images/whitelist-item-mock-banner18.png"
thumb.Url <- "https://s7.gifyu.com/images/Card-5x-rotate.png"
whitelistEmbed.Thumbnail <- thumb
whitelistEmbed.Title <- "1x Degenz Game Whitelist " whitelistEmbed.Title <- "1x Degenz Game Whitelist "
whitelistEmbed.AddField("Mint Date", "April 2022", true) |> ignore whitelistEmbed.AddField("Item", "1x Whitelist", true) |> ignore
whitelistEmbed.AddField("Available", "750", true) |> ignore
whitelistEmbed.AddField("Price 💰", $"{WhitelistPrice} $GBT", true) |> ignore whitelistEmbed.AddField("Price 💰", $"{WhitelistPrice} $GBT", true) |> ignore
whitelistEmbed.AddField("Where?", "Join us on the Moon", true) |> ignore whitelistEmbed.Color <- DiscordColor.Red
let buyBtn = DiscordButtonComponent(ButtonStyle.Success, $"BuyWhitelist", $"Buy Now", true) :> DiscordComponent
let buyActiveBtn = DiscordButtonComponent(ButtonStyle.Success, $"BuyWhitelist", $"Buy Now") :> DiscordComponent
let recruitBtn = DiscordButtonComponent(ButtonStyle.Danger, $"ShowRecruitmentEmbed", $"Recruit Now") :> DiscordComponent
let builder = DiscordFollowupMessageBuilder().AsEphemeral(true) let builder = DiscordFollowupMessageBuilder().AsEphemeral(true)
match! tryGrantWhitelist ctx with match! tryGrantWhitelist ctx with
| NotAHacker -> | NotAHacker -> whitelistEmbed.Description <- notAHackerMsg
builder.Content <- $""" | NotInGame -> whitelistEmbed.Description <- notInGameMsg
Woah slow down buddy… Youre not even a hacker yet!
To get Whitelisted you need to buy it with **$GBT** by playing the game.
Go to <#{GuildEnvironment.channelTraining}> NOW to finish training and become a **HACKER**!**
"""
| NotInGame ->
builder.Content <- $"""
Woah slow down buddy… Youre not even in the game yet!
To get Whitelisted you need to buy it with **$GBT** by playing the game.
Go to <#{GuildEnvironment.channelShelters}> NOW to get assigned a private bunk, and **JOIN THE GAME!**
"""
| AlreadyWhitelisted -> | AlreadyWhitelisted ->
let buyBtn = DiscordButtonComponent(ButtonStyle.Success, $"BuyWhitelist", $"Buy Now", true) :> DiscordComponent builder.AddComponents([ recruitBtn ]) |> ignore
let recruitBtn = DiscordButtonComponent(ButtonStyle.Danger, $"ShowRecruitmentEmbed", $"Recruit Now") :> DiscordComponent whitelistEmbed.Color <- DiscordColor.Green
whitelistEmbed.Color <- DiscordColor.Green
whitelistEmbed.Description <- alreadyWhitelistedMsg
| NotEnoughGBT total ->
builder.AddComponents([ buyBtn ; recruitBtn ]) |> ignore builder.AddComponents([ buyBtn ; recruitBtn ]) |> ignore
builder.Content <- $""" whitelistEmbed.Description <- notEnoughMoneyMsg total
Youre **ALREADY** Whitelisted! Save some for other Degenz | Granted _ ->
whitelistEmbed.Color <- DiscordColor.Green
whitelistEmbed.Color <- DiscordColor.Green
builder.AddComponents([ buyActiveBtn ]) |> ignore
whitelistEmbed.Description <- canBuyWhitelistMsg
builder.AddEmbed(whitelistEmbed) |> ignore
do! ctx.FollowUp(builder)
} :> Task
let buyWhitelistMsg = $"""
🎉 Congratulations youve been **WHITELISTED**!
Now type `/recruit` and share **YOUR UNIQUE LINK** with any Degenz
you want to invite into the game, and let them earn whitelist too!
**Remember:** **Remember:**
Earn `{InviteRewardAmount} $GBT` 💰 for every Degen you `/recruit` into the game! Earn `100 $GBT` 💰 for every Degen you `/recruit` into the game!
**Commands:** **Commands:**
`/recruit` - Invite Degenz into the server. `/recruit` - Invite Degenz into the server.
`/recruited` - Check how many Degenz youve invited. `/recruited` - Check how many Degenz youve invited.
""" """
| NotEnoughGBT total ->
whitelistEmbed.Color <- DiscordColor.Red
let buyBtn = DiscordButtonComponent(ButtonStyle.Success, $"BuyWhitelist", $"Buy Now", true) :> DiscordComponent
let recruitBtn = DiscordButtonComponent(ButtonStyle.Danger, $"ShowRecruitmentEmbed", $"Recruit Now") :> DiscordComponent
let msgEmbed = DiscordEmbedBuilder()
msgEmbed.Color <- DiscordColor.Red
msgEmbed.Description <- $"""
Oh no! You don't have enough **$GBT** to buy a WHITELIST spot!
Come back when you have `{WhitelistPrice - total}` more $GBT.
The quickest way to earn $GBT is to `/recruit`. You'll earn `{InviteRewardAmount} 💰 $GBT` for every Degen you `/recruit`!
"""
builder.AddComponents([ buyBtn ; recruitBtn ]) |> ignore
builder.AddEmbed(msgEmbed) |> ignore
builder.AddEmbed(whitelistEmbed) |> ignore
| Granted _ ->
whitelistEmbed.Color <- DiscordColor.Green
builder.AddComponents([ DiscordButtonComponent(ButtonStyle.Success, $"BuyWhitelist", $"Buy Now") :> DiscordComponent ]) |> ignore
let msgEmbed = DiscordEmbedBuilder()
msgEmbed.Title <- "Buy Whitelist"
msgEmbed.Color <- DiscordColor.Green
msgEmbed.Description <- $"""
Look at you Degen, you played Big Brothers games and made it out alive! Now you can use your $GBT to pay for one of our coveted Whitelist spots.
Click buy now below and the role will be auto assigned to you.
"""
builder.AddEmbed(msgEmbed) |> ignore
builder.AddEmbed(whitelistEmbed) |> ignore
do! ctx.FollowUp(builder)
} :> Task
let handleBuyWhitelist (ctx : IDiscordContext) = let handleBuyWhitelist (ctx : IDiscordContext) =
task { task {
@ -460,18 +466,7 @@ Come hang with all the other VIP Degenz in the <#{GuildEnvironment.channelElite}
let role = ctx.GetGuild().GetRole(GuildEnvironment.roleWhitelist) let role = ctx.GetGuild().GetRole(GuildEnvironment.roleWhitelist)
do! ctx.GetDiscordMember().GrantRoleAsync(role) do! ctx.GetDiscordMember().GrantRoleAsync(role)
let! _ = DbService.updatePlayerCurrency -WhitelistPrice player let! _ = DbService.updatePlayerCurrency -WhitelistPrice player
builder.Content <- $""" builder.Content <- buyWhitelistMsg
🎉 Congratulations youve been **WHITELISTED**!
Now type `/recruit` and share **YOUR UNIQUE LINK** with any Degenz
you want to invite into the game, and let them earn whitelist too!
**Remember:**
Earn `100 $GBT` 💰 for every Degen you `/recruit` into the game!
**Commands:**
`/recruit` - Invite Degenz into the server.
`/recruited` - Check how many Degenz youve invited.
"""
do! ctx.FollowUp(builder) do! ctx.FollowUp(builder)
} :> Task } :> Task