Telegram feed: name a freshly activated member by wallet when the chain id is not mapped yet

The "switched on payouts" line read a bare "#200" although the member had a
username (roodtriaan07): names are looked up by chain id, which the account only
gets after the index links it. Fall back to the activating wallet's account.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-11 06:48:35 -05:00
parent a6c523c6aa
commit 9cf039270e
+2
View File
@@ -1157,6 +1157,8 @@ async function telegramOnEvent(ev) {
if (!sc.telegramChatId && !sc.telegramEchoChatId) return;
const names = await accounts.namesForMembers([ev.recipientId, ev.buyerId, ev.sponsorId, ev.newBuyerId, ev.id].filter(Boolean)).catch(() => ({}));
const who = id => '#' + id + (names[id] ? ' @' + names[id] : '');
// a brand-new chain id is not mapped to its account yet when the activation lands, so the line read bare "#200" (Marty 2026-10-11): name them by wallet
if (ev.type === 'MemberActivated' && ev.id && !names[ev.id] && ev.account) { const a = await accounts.byAddress(ev.account).catch(() => null); if (a && a.username) names[ev.id] = a.username; }
const cc = chain.getConfig();
const tx = (cc.explorer ? cc.explorer.replace(/\/+$/, '') : 'https://polygonscan.com') + '/tx/' + ev.tx;
const build = async (mode) => {