diff --git a/Bot/Games/HackerBattle.fs b/Bot/Games/HackerBattle.fs index 302861a..56784b0 100644 --- a/Bot/Games/HackerBattle.fs +++ b/Bot/Games/HackerBattle.fs @@ -251,7 +251,8 @@ let createInvite (ctx : IDiscordContext) = let embed = DiscordEmbedBuilder() - .WithDescription($"Send this invite to your friend, when they join, they can type the `/enter-code` slash command") + .WithDescription($"Send this invite to your friend, when they join, they can type the `/enter-code` slash command\n\n + ```https://discord.gg/{invite.Code}```") .WithImageUrl("https://pbs.twimg.com/profile_banners/1449270642340089856/1640071520/1500x500") .WithTitle("Invite Code") diff --git a/Bot/InviteTracker.fs b/Bot/InviteTracker.fs index 7eb8795..2f219a0 100644 --- a/Bot/InviteTracker.fs +++ b/Bot/InviteTracker.fs @@ -41,16 +41,19 @@ let createInvite inviter code = |> Async.AwaitTask let addInvitedUser did code = - connStr - |> Sql.connect - |> Sql.executeTransactionAsync [ - """ - WITH invite AS (SELECT id FROM invite WHERE code = @code) - INSERT INTO invited_user (discord_id, invite_id) SELECT @discord_id, invite.id FROM invite; - """ , [ [ "@discord_id" , Sql.string (string did) ] ; [ "@code" , Sql.string code ] ] - "UPDATE invite SET count = count + 1 WHERE code = @code" , [ [ "@code" , Sql.string code ] ] - ] - |> Async.AwaitTask + try + connStr + |> Sql.connect + |> Sql.executeTransactionAsync [ + """ + WITH invite AS (SELECT id FROM invite WHERE code = @code) + INSERT INTO invited_user (discord_id, invite_id) SELECT @discord_id, invite.id FROM invite; + """ , [ [ "@discord_id" , Sql.string (string did) ] ; [ "@code" , Sql.string code ] ] + "UPDATE invite SET count = count + 1 WHERE code = @code" , [ [ "@code" , Sql.string code ] ] + ] + |> Async.AwaitTask + |> Async.Ignore + with _ -> async.Zero () let getInviteAttributions userId = connStr