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