Use same recruited embed

This commit is contained in:
Joseph Ferano 2022-04-05 12:52:00 +07:00
parent e645b2fabd
commit 0e77c26b82
2 changed files with 24 additions and 23 deletions

View File

@ -17,7 +17,7 @@ type AdminBot() =
[<SlashCommand("admin-invites", "Get total invites from a specific user")>] [<SlashCommand("admin-invites", "Get total invites from a specific user")>]
member this.GetAttributions (ctx : InteractionContext, [<Option("player", "The player you want to check")>] user : DiscordUser) = member this.GetAttributions (ctx : InteractionContext, [<Option("player", "The player you want to check")>] user : DiscordUser) =
enforceAdmin (DiscordInteractionContext ctx) (InviteTracker.getAttributions user.Id) enforceAdmin (DiscordInteractionContext ctx) (InviteTracker.getInvitedUsersForId)
[<SlashCommand("admin-whitelist-stock", "Set whitelist stock")>] [<SlashCommand("admin-whitelist-stock", "Set whitelist stock")>]
member this.SetStock (ctx : InteractionContext, [<Option("amount", "Set the amount of WL available for purchase")>] amount : int64) = member this.SetStock (ctx : InteractionContext, [<Option("amount", "Set the amount of WL available for purchase")>] amount : int64) =

View File

@ -242,28 +242,29 @@ let getAttributions userId (ctx : IDiscordContext) =
do! ctx.Respond(InteractionResponseType.ChannelMessageWithSource, msg) do! ctx.Respond(InteractionResponseType.ChannelMessageWithSource, msg)
} :> Task } :> Task
let private getInvitedUsersForId (ctx : IDiscordContext) = task { let getInvitedUsersForId (ctx : IDiscordContext) =
let! users = getInvitedUsers (ctx.GetDiscordMember().Id) task {
let! total = getInvitedUserCount (ctx.GetDiscordMember().Id) let! users = getInvitedUsers (ctx.GetDiscordMember().Id)
let sb = StringBuilder() let! total = getInvitedUserCount (ctx.GetDiscordMember().Id)
let mutable count = 0 let sb = StringBuilder()
for user in users do let mutable count = 0
count <- count + 1 for user in users do
sb.AppendLine($"{count}.) <@{user}>") |> ignore count <- count + 1
let msg = sb.AppendLine($"{count}.) <@{user}>") |> ignore
let str = let msg =
if users.Length > 0 then let str =
$"**Total Recruited:** `{total} Degenz`\n**Total Earned:** `{total * InviteRewardAmount} 💰$GBT`\n\n**Last 10 users recruited:**\n{sb}" if users.Length > 0 then
else $"**Total Recruited:** `{total} Degenz`\n**Total Earned:** `{total * InviteRewardAmount} 💰$GBT`\n\n**Last 10 users recruited:**\n{sb}"
$"You haven't recruited anyone yet, use the `/recruit` command to get the recruitment link" else
DiscordInteractionResponseBuilder() $"You haven't recruited anyone yet, use the `/recruit` command to get the recruitment link"
.AsEphemeral(true) DiscordInteractionResponseBuilder()
.WithContent(str) .AsEphemeral(true)
do! ctx.Respond(InteractionResponseType.ChannelMessageWithSource, msg) .WithContent(str)
let user = ctx.GetDiscordMember() do! ctx.Respond(InteractionResponseType.ChannelMessageWithSource, msg)
let channel = ctx.GetChannel() let user = ctx.GetDiscordMember()
do! Analytics.recruitedCommand total user.Id user.Username channel let channel = ctx.GetChannel()
} do! Analytics.recruitedCommand total user.Id user.Username channel
} :> Task
let clearInvites (ctx : IDiscordContext) = task { let clearInvites (ctx : IDiscordContext) = task {
let! invites = ctx.GetGuild().GetInvitesAsync() let! invites = ctx.GetGuild().GetInvitesAsync()