Global commands in scenes
See original GitHub issueI have a problem with using scenes and commands. I need to have a command that leaves the scene. When I type /cancel at the scene it’s ignoring me and continue to do other actions.
Example:
// app.js
import Telegraf, { session } from 'telegraf'
import Stage from 'telegraf/stage'
import testScene from './scenes/test'
const telegraf = new Telegraf(process.env.TOKEN)
const stage = new Stage([
testScene
])
telegraf.use(session())
telegraf.use(stage.middleware())
telegraf.command('cancel', async ({ reply, scene }) => {
await reply('Hey, you canceled previous scene!')
await scene.leave()
})
telegraf.startPolling()
// scenes/test/index.js
import Scene from 'telegraf/scenes/base'
const scene = new Scene('echo')
scene.enter(async ({ reply }) => reply('Hello.'))
scene.leave(async ({ reply }) => reply('Goodbye.'))
scene.on('text', async ({ reply }) => reply('Ping Pong.'))
export default scene
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Key commands for Global Commands in Logic Pro
Key commands for Global Commands in Logic Pro ; Discard Recording and Return to Last Play Position. Command-Period (.) ; Capture as Recording....
Read more >Choose global or local—ArcGIS Online Help | Documentation
You can choose between a global or local scene to best display your data, such as airline flight patterns, campus facilities, or underground...
Read more >How can I get more documentation on Scenes, Stages and stuff?
When inside one, all the outer noise, such as global commands or message handlers, stop reacting on user actions. Scenes can be entered, ......
Read more >scenedetect Application - PySceneDetect - Read the Docs
The options in this section represent the “global” arguments for the main scenedetect command. The most commonly used options are the input video(s)...
Read more >To Work with Local and Global Scene Explorers | 3ds Max 2019
In any local Scene Explorer, click the arrow to the right of the text field at the bottom-left of the dialog and choose...
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
Hey @mvrlin
To add global command to all scenes, you can use
stage.command
:@dotcypress thank you! Working great!