File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,6 +161,7 @@ Recover missed codes from Discord message history. Scans the entire message hist
161161- ** Example:** ` /backfill ` or ` /backfill channel:#code-drops `
162162
163163** Automatic Startup Backfill:**
164+
164165- Runs automatically when the bot starts if ` DISCORD_CHANNEL_ID ` is configured
165166- Only runs if the last backfill was more than 6 hours ago
166167- Helps catch codes that appeared while the bot was offline
Original file line number Diff line number Diff line change @@ -104,7 +104,9 @@ client.on(Events.ClientReady, async () => {
104104 }
105105 } else if ( ! shouldBackfill ) {
106106 const lastBackfill = await backfillManager . getLastBackfill ( ) ;
107- logger . info ( `Skipping startup backfill - last run was less than 6 hours ago at ${ lastBackfill ?. completed_at } ` ) ;
107+ logger . info (
108+ `Skipping startup backfill - last run was less than 6 hours ago at ${ lastBackfill ?. completed_at } `
109+ ) ;
108110 } else {
109111 logger . info ( 'Skipping startup backfill - DISCORD_CHANNEL_ID not configured' ) ;
110112 }
Original file line number Diff line number Diff line change @@ -41,9 +41,7 @@ export async function execute(interaction: ChatInputCommandInteraction) {
4141 const embed = new EmbedBuilder ( )
4242 . setColor ( 0xffaa00 )
4343 . setTitle ( '⚠️ Backfill In Progress' )
44- . setDescription (
45- 'A backfill operation is already running. Please wait for it to complete.'
46- ) ;
44+ . setDescription ( 'A backfill operation is already running. Please wait for it to complete.' ) ;
4745
4846 await interaction . reply ( { embeds : [ embed ] , flags : MessageFlags . Ephemeral } ) ;
4947 return ;
@@ -55,9 +53,7 @@ export async function execute(interaction: ChatInputCommandInteraction) {
5553 const embed = new EmbedBuilder ( )
5654 . setColor ( 0xffaa00 )
5755 . setTitle ( '⏱️ Rate Limited' )
58- . setDescription (
59- 'You can only initiate a backfill once per hour. Please try again later.'
60- ) ;
56+ . setDescription ( 'You can only initiate a backfill once per hour. Please try again later.' ) ;
6157
6258 await interaction . reply ( { embeds : [ embed ] , flags : MessageFlags . Ephemeral } ) ;
6359 return ;
@@ -84,7 +80,9 @@ export async function execute(interaction: ChatInputCommandInteraction) {
8480
8581 // Start the backfill operation
8682 const operationId = await backfillManager . startBackfill ( interaction . user . id ) ;
87- logger . info ( `[BACKFILL CMD] Operation ${ operationId } started for channel ${ targetChannel . name } ` ) ;
83+ logger . info (
84+ `[BACKFILL CMD] Operation ${ operationId } started for channel ${ targetChannel . name } `
85+ ) ;
8886
8987 // Create progress tracker
9088 let progressMessage = '' ;
Original file line number Diff line number Diff line change @@ -26,7 +26,9 @@ class BackfillManager {
2626 */
2727 async startBackfill ( discordId : string ) : Promise < number > {
2828 if ( this . backfillInProgress ) {
29- throw new Error ( 'A backfill operation is already in progress. Please wait for it to complete.' ) ;
29+ throw new Error (
30+ 'A backfill operation is already in progress. Please wait for it to complete.'
31+ ) ;
3032 }
3133
3234 this . backfillInProgress = true ;
@@ -117,10 +119,9 @@ class BackfillManager {
117119 * Get backfill operation by ID
118120 */
119121 async getBackfillById ( operationId : number ) : Promise < BackfillOperation | undefined > {
120- return db . get < BackfillOperation > (
121- 'SELECT * FROM backfill_operations WHERE id = ?' ,
122- [ operationId ]
123- ) ;
122+ return db . get < BackfillOperation > ( 'SELECT * FROM backfill_operations WHERE id = ?' , [
123+ operationId ,
124+ ] ) ;
124125 }
125126}
126127
Original file line number Diff line number Diff line change @@ -47,7 +47,9 @@ export async function backfillChannelHistory(
4747 // Fetch messages in batches (Discord API limit is 100)
4848 while ( true ) {
4949 try {
50- onProgress ?.( `Fetching messages (batch starting from ${ beforeId ? 'messageId ' + beforeId : 'latest' } )...` ) ;
50+ onProgress ?.(
51+ `Fetching messages (batch starting from ${ beforeId ? 'messageId ' + beforeId : 'latest' } )...`
52+ ) ;
5153
5254 const messages = await textChannel . messages . fetch ( {
5355 limit : 100 ,
@@ -91,7 +93,9 @@ export async function backfillChannelHistory(
9193 }
9294 }
9395
94- onProgress ?.( `Found ${ stats . codesFound } codes in ${ messageCount } messages. Now attempting to redeem...` ) ;
96+ onProgress ?.(
97+ `Found ${ stats . codesFound } codes in ${ messageCount } messages. Now attempting to redeem...`
98+ ) ;
9599
96100 // Now attempt to redeem found codes for each user with credentials
97101 const users = await userManager . getAllUsers ( ) ;
You can’t perform that action at this time.
0 commit comments