Telegram client refactor for bot info availability #308
+50
−38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Relates to:
TELEGRAM CLIENT NOT WORKING ISSUE [RESOLVED WITH THIS PR]
Risks
Medium Risk: Uses some functionality directly from TelegrafJS source code to grab bot information to listen for new messages.
Background
PR changes the telegram client and index of the telegram client so that bot info is actually made available to the message listener and the agent can reply to users.
As stated above.
Many users including myself were not able to get the telegram bot to actually respond despite it logging the client as running/working.
Documentation changes needed?
Testing
The image above shows us that we are receiving all bot information and propagating it to the message handler.
["◎ 📱 Constructing new TelegramClient..."]
["◎ ✅ TelegramClient constructor completed"]
["◎ 🚀 Starting Telegram bot..."]
["◎ ✨ Telegram bot successfully launched and is running!"]
Server running at http://localhost:3000/
Bot username test: @ropAIrito_bot
Bot username: @ropAIrito_bot
message manager bot info: @[object Object]
["◎ Setting up message handler..."]
["✓ ✅ Telegram client successfully started for character ropAIrito"]
telegramClient TelegramClient {
bot: Telegraf {
handler: [Function (anonymous)],
context: {},
webhookFilter: [Function (anonymous)],
handleError: [Function (anonymous)],
options: {
telegram: {},
handlerTimeout: 90000,
contextType: [class Context]
},
telegram: Telegram {
token: [REDACTED],
response: undefined,
options: [Object]
},
botInfo: {
id: 7775236789,
is_bot: true,
first_name: '$ROPIRITO',
username: 'ropAIrito_bot',
can_join_groups: true,
can_read_all_group_messages: false,
supports_inline_queries: true,
can_connect_to_business: false,
has_main_web_app: false
}
}