From 3f4d785bcb6df5092295be8ad32ced3f5c893e0f Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Fri, 4 Mar 2022 15:44:46 +0700 Subject: [PATCH] Maybe the channel doesn't exist --- Bot/InviteTracker.fs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Bot/InviteTracker.fs b/Bot/InviteTracker.fs index 5d336be..3ca7a16 100644 --- a/Bot/InviteTracker.fs +++ b/Bot/InviteTracker.fs @@ -97,8 +97,11 @@ let getInvitedUsers userId = let createGuildInvite (ctx : IDiscordContext) = task { - let channel = ctx.GetGuild().Channels.[GuildEnvironment.channelWelcome] + printfn $"{GuildEnvironment.channelWelcome}" + let ( result , channel ) = ctx.GetGuild().Channels.TryGetValue(GuildEnvironment.channelWelcome) + printfn $"{result} {channel.Name}" let! invite = channel.CreateInviteAsync(max_age = 86400) + printfn $"{invite.Code}" // When a player generates an invite code but it hasn't expired, it generates the same code, creating a duplicate entry // so catch the exception thrown because the code column is unique