Try catch around initial message

This commit is contained in:
Joseph Ferano 2022-02-24 15:07:33 +07:00
parent eb4e42ad11
commit 31864ed025

View File

@ -28,19 +28,22 @@ let TrainerEvents = [|
let sendInitialEmbed (client : DiscordClient) = let sendInitialEmbed (client : DiscordClient) =
async { async {
let! channel = client.GetChannelAsync(GuildEnvironment.channelTraining) |> Async.AwaitTask try
let builder = DiscordMessageBuilder() let! channel = client.GetChannelAsync(GuildEnvironment.channelTraining) |> Async.AwaitTask
let embed = DiscordEmbedBuilder() let builder = DiscordMessageBuilder()
embed.ImageUrl <- "https://s10.gifyu.com/images/MasterTraining_Degenz.gif" let embed = DiscordEmbedBuilder()
builder.AddEmbed embed |> ignore embed.ImageUrl <- "https://s10.gifyu.com/images/MasterTraining_Degenz.gif"
builder.Content <- "Welcome Degen… To the Hacker Training Program.\n" builder.AddEmbed embed |> ignore
+ "Here you will learn how to defend yourself, and hack other Degenz to take their 💰$GBT.\n" builder.Content <- "Welcome Degen… To the Hacker Training Program.\n"
+ "Are you ready?" + "Here you will learn how to defend yourself, and hack other Degenz to take their 💰$GBT.\n"
let button = DiscordButtonComponent(ButtonStyle.Success, $"Trainer-1", $"LFG") :> DiscordComponent + "Are you ready?"
builder.AddComponents [| button |] |> ignore let button = DiscordButtonComponent(ButtonStyle.Success, $"Trainer-1", $"LFG") :> DiscordComponent
do! channel.SendMessageAsync(builder) builder.AddComponents [| button |] |> ignore
|> Async.AwaitTask do! channel.SendMessageAsync(builder)
|> Async.Ignore |> Async.AwaitTask
|> Async.Ignore
with e ->
printfn $"Error trying to get channel {GuildEnvironment.channelTraining}\n\n{e.Message}"
} |> Async.RunSynchronously } |> Async.RunSynchronously
let handleTrainerStep1 (ctx : IDiscordContext) = let handleTrainerStep1 (ctx : IDiscordContext) =