Skip to content

Commit 0336031

Browse files
committed
update egg hunt code for 2025
1 parent 34cb76c commit 0336031

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

src/TaylorBot.Net/Program.Commands.Discord/src/TaylorBot.Net.Commands.Discord.Program/DiscordCommandsProgram.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,14 @@ public static void ConfigureServices(HostBuilderContext hostBuilderContext, ISer
415415
.AddSlashCommand<LoveReadySlashCommand>()
416416
.AddSlashCommand<LoveSpreadSlashCommand>()
417417
.AddSlashCommand<LoveHistorySlashCommand>()
418+
.AddTransient<IEggRepository, EggPostgresRepository>()
419+
.AddTransient<EggService>()
420+
.AddSlashCommand<EggVerifySlashCommand>()
421+
.AddSlashCommand<EggProfileSlashCommand>()
422+
.AddSlashCommand<EggStatusSlashCommand>()
423+
.AddSlashCommand<EggLeaderboardSlashCommand>()
424+
.AddSlashCommand<EggSetConfigSlashCommand>()
425+
.AddSlashCommand<EggRunSlashCommand>()
418426
;
419427

420428
services.AddHttpClient<ILastFmClient, InflatableLastFmClient>();

src/TaylorBot.Net/Program.Commands.Discord/src/TaylorBot.Net.Commands.Discord.Program/Modules/Events/EggSlashCommands.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class EggPostgresRepository(PostgresConnectionFactory postgresConnectionF
4646
using var connection = postgresConnectionFactory.CreateConnection();
4747

4848
return await connection.QuerySingleOrDefaultAsync<Egg?>(
49-
"SELECT egg_number FROM egghunt2024.eggs WHERE egg_code = @EggId;",
49+
"SELECT egg_number FROM egghunt2025.eggs WHERE egg_code = @EggId;",
5050
new
5151
{
5252
EggId = code,
@@ -61,8 +61,8 @@ public async Task<IList<Egg>> GetEggFindsForUserAsync(string userId)
6161
var eggs = await connection.QueryAsync<Egg>(
6262
"""
6363
SELECT eggs.egg_number
64-
FROM egghunt2024.egg_finds
65-
INNER JOIN egghunt2024.eggs ON egghunt2024.egg_finds.egg_number = egghunt2024.eggs.egg_number
64+
FROM egghunt2025.egg_finds
65+
INNER JOIN egghunt2025.eggs ON egghunt2025.egg_finds.egg_number = egghunt2025.eggs.egg_number
6666
WHERE user_id = @UserId;
6767
""",
6868
new
@@ -80,7 +80,7 @@ public async Task<IEggFindAddResult> AddEggFindAsync(string userId, string usern
8080

8181
var inserted = await connection.QuerySingleOrDefaultAsync<bool>(
8282
"""
83-
INSERT INTO egghunt2024.egg_finds (egg_number, user_id, username)
83+
INSERT INTO egghunt2025.egg_finds (egg_number, user_id, username)
8484
VALUES (@EggNumber, @UserId, @Username) ON CONFLICT DO NOTHING
8585
RETURNING TRUE;
8686
""",
@@ -112,7 +112,7 @@ public async Task SetConfigAsync(string key, string value)
112112

113113
await connection.ExecuteAsync(
114114
"""
115-
INSERT INTO egghunt2024.config (config_key, config_value)
115+
INSERT INTO egghunt2025.config (config_key, config_value)
116116
VALUES (@Key, @Value)
117117
ON CONFLICT (config_key) DO UPDATE SET config_value = @Value;
118118
""",
@@ -129,7 +129,7 @@ INSERT INTO egghunt2024.config (config_key, config_value)
129129
using var connection = postgresConnectionFactory.CreateConnection();
130130

131131
return await connection.QuerySingleOrDefaultAsync<string?>(
132-
"SELECT config_value FROM egghunt2024.config WHERE config_key = @Key;",
132+
"SELECT config_value FROM egghunt2025.config WHERE config_key = @Key;",
133133
new
134134
{
135135
Key = key,
@@ -144,8 +144,8 @@ public async Task<IList<EggRarity>> GetEggRarityAsync()
144144
var eggRarity = await connection.QueryAsync<EggRarity>(
145145
"""
146146
SELECT e.egg_number, COUNT(ef.egg_number) AS found_by
147-
FROM egghunt2024.eggs e
148-
LEFT JOIN egghunt2024.egg_finds ef ON e.egg_number = ef.egg_number
147+
FROM egghunt2025.eggs e
148+
LEFT JOIN egghunt2025.egg_finds ef ON e.egg_number = ef.egg_number
149149
GROUP BY e.egg_number
150150
ORDER BY found_by DESC, egg_number ASC;
151151
"""
@@ -163,8 +163,8 @@ public async Task<IList<EggLeaderboardEntry>> GetLeaderboardAsync()
163163
SELECT leaderboard.user_id, u.username, eggs_found, rank() OVER (ORDER BY eggs_found DESC) AS rank
164164
FROM (
165165
SELECT ef.user_id, COUNT(ef.egg_number) AS eggs_found
166-
FROM egghunt2024.egg_finds ef
167-
JOIN egghunt2024.eggs e ON ef.egg_number = e.egg_number
166+
FROM egghunt2025.egg_finds ef
167+
JOIN egghunt2025.eggs e ON ef.egg_number = e.egg_number
168168
GROUP BY ef.user_id
169169
ORDER BY eggs_found DESC
170170
LIMIT 75

src/slash-commands/disabled/egg.json renamed to src/slash-commands/guilds/115332333745340416/egg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"options": [
1010
{
1111
"name": "code",
12-
"description": "The egg code to verify, for example P1ZR3V3R53M34366",
12+
"description": "The egg code to verify",
1313
"type": 3,
1414
"required": true
1515
}

0 commit comments

Comments
 (0)