This commit is contained in:
Joseph Ferano 2022-04-11 10:56:43 +07:00
parent f068dfdd95
commit 0b0f54f028

View File

@ -538,26 +538,36 @@ let handleCreateInvite (ctx : IDiscordContext) =
let! code =
task {
printfn "1"
let! invites = getInvitesFromUser user.Id
printfn "2"
match invites |> Map.toList with
| [] ->
printfn "3"
let channel = ctx.GetGuild().Channels.[GuildEnvironment.channelWelcome]
printfn "4"
let! invite = channel.CreateInviteAsync(max_age = 0, unique = true)
printfn "5"
try do! createInvite (ctx.GetDiscordMember().Id) invite.Code |> Async.Ignore
with ex -> printfn "%A" ex.Message
printfn "6"
return invite.Code
| invite::_ ->
printfn "-1"
return invite |> fst
}
printfn "7"
let msg =
DiscordFollowupMessageBuilder()
.WithContent($"https://discord.gg/{code}")
.AsEphemeral(true)
printfn "8"
do! ctx.FollowUp(msg)
printfn "9"
do! Analytics.recruitLinkButton code user.Id user.Username (ctx.GetChannel())
} :> Task