Auto-sync queue levels from on-chain upgrades
When a queue member's MemberUpgraded event lands, their Level in the rotation queue updates automatically (same op as the admin dropdown), with a Telegram note. Current queue trued up against the chain: four entries corrected (30, 35, 46 up to Ascensus; 56 down to Scintilla — it had been set optimistically). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -469,4 +469,17 @@ chain.startIndexer(evt=>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch(e){console.error('auto-direct error',e.message)}
|
}catch(e){console.error('auto-direct error',e.message)}
|
||||||
|
// Queue level sync: when a queue member upgrades on-chain, their Level in the
|
||||||
|
// rotation queue follows automatically (same op as the admin level dropdown).
|
||||||
|
try{
|
||||||
|
if(evt.type==='upgraded'&&evt.id!=null){
|
||||||
|
const sponsors=getSponsors();
|
||||||
|
const idx=sponsors.findIndex(x=>String(x.id)===String(evt.id));
|
||||||
|
if(idx>=0&&LEVELS.includes(evt.levelName)&&sponsors[idx].level!==evt.levelName){
|
||||||
|
sponsors[idx].level=evt.levelName;
|
||||||
|
saveSponsors(sponsors);
|
||||||
|
sendTelegram(`🤖 AUTO-LEVEL: queue sponsor #${sponsors[idx].id}${sponsors[idx].name?` (${sponsors[idx].name})`:''} upgraded on-chain — queue level updated to ${evt.levelName}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(e){console.error('auto-level error',e.message)}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user