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