[QUESTION] How to enter a scene without context but with chatId
See original GitHub issueI’m trying to enter a scene because a server side event happened.
I have the chatId
but no context, since the user didn’t talk in the chat.
How should I enter the scene ?
Here’s a little bit of code:
const PrivateMessage = new Scene('PRIVATE_MESSAGE')
PrivateMessage.enter((ctx) => ctx.reply('echo scene'))
PrivateMessage.leave((ctx) => ctx.reply('exiting echo scene'))
PrivateMessage.command('back', leave())
PrivateMessage.on('text', (ctx) => ctx.reply(ctx.message.text))
this.bot = new Telegraf(this.options.token, {username: this.options.username});
const stage = new Stage([PrivateMessage]);
this.bot.use(session());
this.bot.use(stage.middleware());
ipcMain.on('TelegramNotificationRequest', (ev, obj) => {
Stage.enter(obj.type); // 'PRIVATE_MESSAGE'
})
When the TelegramNotificationRequest
happens, I would like to enter the scene to ask the user what does he want to do.
Is it possible ?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How to send message only once to every individual user who ...
You want to ignore the incoming message if the chat id exists in the sheets to avoid duplicates; Send message to user using...
Read more >Top 5 telegraf Code Examples - Snyk
To help you get started, we've selected a few telegraf examples, based on popular ways it is used in public projects. Secure your...
Read more >Telegraf VS Node-Telegram-Bot-API - DEV Community
Here we imported our scenes and registered them in array. Also we added a stage middleware without which our scenes won't work. And...
Read more >SIGNAL Behind the Scenes: Twilio's Andres Jaan Tack
In this interview, Twilio's Andres Jaan Tack sits down with Corey Weathers to talk about Twilio's launch of Conversations.
Read more >Telethon Documentation - Read the Docs
In short, the same code above but without comments to make it clearer: ... Telethon will add a minus sign (negate) the real...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello, isn’t still possible to enter into the scene during some server event? I think it is a very useful case and is there any way to realize it? So I need to enter into the scene, then send a message to the user and wait for a response.
Guys,
enter
can’t be called without context. If you want to achieve external control for user, you need to store this event and use it only when you have any update from user.