Skip to content

Commit

Permalink
docs(menuPhoto): add to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
EdJoPaTo committed Mar 19, 2019
1 parent 6e9b974 commit e4b40ab
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
13 changes: 11 additions & 2 deletions example.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,20 @@ menu.submenu('Food menu', 'b', someMenu, {
hide: () => mainMenuToggle
})

menu.submenu('Third Menu', 'y', new TelegrafInlineMenu('Third Menu'))
.setCommand('third')
let isAndroid = true
menu.submenu('Photo Menu', 'y', new TelegrafInlineMenu('', {
photo: () => isAndroid ? 'https://telegram.org/img/SiteAndroid.jpg' : 'https://telegram.org/img/SiteiOs.jpg'
}))
.setCommand('photo')
.simpleButton('Just a button', 'a', {
doFunc: ctx => ctx.answerCbQuery('Just a callback query answer')
})
.select('img', ['iOS', 'Android'], {
isSetFunc: (_ctx, key) => key === 'Android' ? isAndroid : !isAndroid,
setFunc: (_ctx, key) => {
isAndroid = key === 'Android'
}
})

menu.setCommand('start')

Expand Down
13 changes: 11 additions & 2 deletions example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,20 @@ menu.submenu('Food menu', 'b', someMenu, {
hide: () => mainMenuToggle
})

menu.submenu('Third Menu', 'y', new TelegrafInlineMenu('Third Menu'))
.setCommand('third')
let isAndroid = true
menu.submenu('Photo Menu', 'y', new TelegrafInlineMenu('', {
photo: () => isAndroid ? 'https://telegram.org/img/SiteAndroid.jpg' : 'https://telegram.org/img/SiteiOs.jpg'
}))
.setCommand('photo')
.simpleButton('Just a button', 'a', {
doFunc: ctx => ctx.answerCbQuery('Just a callback query answer')
})
.select('img', ['iOS', 'Android'], {
isSetFunc: (_ctx, key) => key === 'Android' ? isAndroid : !isAndroid,
setFunc: (_ctx, key) => {
isAndroid = key === 'Android'
}
})

menu.setCommand('start')

Expand Down

0 comments on commit e4b40ab

Please sign in to comment.