Change the messaging if it's for whitelist
This commit is contained in:
parent
6f88df1953
commit
45de35bd39
@ -120,7 +120,7 @@ let getInvitedUsers userId =
|
||||
|> Sql.executeAsync (fun read -> read.string "discord_id" |> uint64)
|
||||
|> Async.AwaitTask
|
||||
|
||||
let createGuildInvite (ctx : IDiscordContext) =
|
||||
let createGuildInvite (ctx : IDiscordContext) showWhitelistReward =
|
||||
task {
|
||||
let builder = DiscordInteractionResponseBuilder().AsEphemeral(true)
|
||||
do! ctx.Respond(InteractionResponseType.DeferredChannelMessageWithSource, builder)
|
||||
@ -137,10 +137,17 @@ let createGuildInvite (ctx : IDiscordContext) =
|
||||
printfn "%A" ex.Message
|
||||
()
|
||||
|
||||
let invitesRequired = 5
|
||||
let rewardMsg =
|
||||
if showWhitelistReward then
|
||||
$"**⏀ | Your Mission:**\nRecruit {invitesRequired} Degenz into Beautopia©.\n\n" +
|
||||
$"**⌼ | Your Reward:**\nGet awarded **Whitelist**."
|
||||
else
|
||||
$"**⏀ | Your Mission:**\nCopy the link & share it with Degenz you want to `/recruit`.\n\n" +
|
||||
$"**⌼ | Your Reward:**\n`Earn {InviteRewardAmount} $GBT` 💰 for every Degen you've `/recruited`."
|
||||
let header =
|
||||
DiscordEmbedBuilder()
|
||||
.WithDescription($"**⏀ | Your Mission:**\nCopy the link & share it with Degenz you want to `/recruit`.\n\n" +
|
||||
$"**⌼ | Your Reward:**\n`Earn {InviteRewardAmount} $GBT` 💰 for every Degen you've `/recruited`.")
|
||||
.WithDescription(rewardMsg)
|
||||
.WithImageUrl("https://pbs.twimg.com/profile_banners/1449270642340089856/1640071520/1500x500")
|
||||
.WithTitle("Recruitment")
|
||||
|
||||
@ -157,7 +164,7 @@ let createGuildInvite (ctx : IDiscordContext) =
|
||||
.AsEphemeral(true)
|
||||
|
||||
do! ctx.FollowUp(msg)
|
||||
}
|
||||
} :> Task
|
||||
|
||||
let listServerInvites (ctx : IDiscordContext) = task {
|
||||
let! invites = ctx.GetGuild().GetInvitesAsync()
|
||||
@ -256,7 +263,7 @@ let sendInitialEmbed (client : DiscordClient) =
|
||||
embed.ImageUrl <- "https://securitygladiators.com/wp-content/uploads/2020/09/Whitelist-Website-Featured-Image.jpg"
|
||||
builder.AddEmbed embed |> ignore
|
||||
builder.Content <- "Click on the button to get whitelist!"
|
||||
let button = DiscordButtonComponent(ButtonStyle.Success, $"Trainer-1", $"Gimme") :> DiscordComponent
|
||||
let button = DiscordButtonComponent(ButtonStyle.Success, $"GimmeWhitelist", $"Gimme") :> DiscordComponent
|
||||
builder.AddComponents [| button |] |> ignore
|
||||
do! channel.SendMessageAsync(builder)
|
||||
|> Async.AwaitTask
|
||||
@ -291,8 +298,12 @@ let handleWhitelist (_ : DiscordClient) (event : ComponentInteractionCreateEvent
|
||||
match! tryGrantWhitelist ctx with
|
||||
| AlreadyWhitelisted ->
|
||||
builder.Content <- "You are already whitelisted"
|
||||
do! ctx.Respond(InteractionResponseType.ChannelMessageWithSource, builder)
|
||||
| NotEnoughInvites total ->
|
||||
builder.Content <- $"You need to invite more people into the server. Please invite {WhitelistInviteRequirement - total} more people to get Whitelist"
|
||||
do! createGuildInvite ctx true
|
||||
// builder.Content <- "Testing"
|
||||
// do! ctx.Respond(InteractionResponseType.ChannelMessageWithSource, builder)
|
||||
// do! async.Zero()
|
||||
| Granted role ->
|
||||
do! ctx.GetDiscordMember().GrantRoleAsync(role)
|
||||
builder.Content <- "You have been granted whitelist"
|
||||
@ -304,7 +315,7 @@ type Inviter() =
|
||||
|
||||
[<SlashCommand("recruit", "Recruit another user to this discord and earn rewards")>]
|
||||
member this.CreateInvite (ctx : InteractionContext) =
|
||||
createGuildInvite (DiscordInteractionContext ctx)
|
||||
createGuildInvite (DiscordInteractionContext ctx) false
|
||||
|
||||
[<SlashCommand("recruited", "Get total invites from a specific user")>]
|
||||
member this.ListInvitedPeople (ctx : InteractionContext) =
|
||||
|
Loading…
x
Reference in New Issue
Block a user