Add unique flag

This commit is contained in:
Joseph Ferano 2022-03-04 16:57:07 +07:00
parent 4ef8243e22
commit 3e7cb47438

View File

@ -98,7 +98,7 @@ let getInvitedUsers userId =
let createGuildInvite (ctx : IDiscordContext) = let createGuildInvite (ctx : IDiscordContext) =
task { task {
let channel = ctx.GetGuild().Channels.[GuildEnvironment.channelWelcome] let channel = ctx.GetGuild().Channels.[GuildEnvironment.channelWelcome]
let! invite = channel.CreateInviteAsync(max_age = 86400) let! invite = channel.CreateInviteAsync(max_age = 86400, unique = true)
// When a player generates an invite code but it hasn't expired, it generates the same code, creating a duplicate entry // 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 // so catch the exception thrown because the code column is unique