T2969
Depends on D13232
Add a Telegram bot to broadcast msgs to a Telegram channel when new aliases are registered.
Differential D13233
[alias-server] Telegram bot to announce new alias registrations bytesofman on Mar 3 2023, 19:42. Authored by
Details
T2969 Depends on D13232 Add a Telegram bot to broadcast msgs to a Telegram channel when new aliases are registered. cp secrets.js.sample sample.js Enter your bot information and channel ID (can ping me to use mine or create your own using the Botfather)
Diff Detail
Event TimelineComment Actions Upon initialization of the bot, the alias server throws a MongoBulkWriteException before the bot reporting on a number of recent registrations but then rate limits itself after 5 hits. Is this expect behavior or should it only be report on new registrations from the point of bot startup? After waiting out the rate limit, I registered fisherman2 which was picked up by the alias server's websocket but the bot did not announce it in the tg chat. Comment Actions I waited for the next block (781805) to be found and the alias server rate limited itself again, whilst the bot simply repeated the previous batch of registrations but no sign of fisherman2 Comment Actions
I saw this behavior from the last diff due to conflicts between aliases existing in the database and the new "reserved aliases" feature. The database needs to be wiped before node index.js. This diff is built on top of the reserved alias diff, so it has the same thing.
The screenshot here shows an "added to the mempool" websocket msg. Currently the app only responds to new blocks found -- and will only send a msg if an alias tx was confirmed in that block
This is related to the first issue of the database needing to be erased to get rid of registrations that conflict with the new reserved list. Expected behavior for now (will probably not have a need to patch) is for Telegram to get rate limited if it's asked to send more than 25 messages. So, when you run the app for the first time on an empty database, and it writes 170-odd entries, Telegram will probably only send 25 msgs. We could patch this by batching Tg msgs and using timeouts, but it would get complicated and probably only be relevant for this initial start-up scenario. |