Skip to content

Commit

Permalink
feat: reset command
Browse files Browse the repository at this point in the history
  • Loading branch information
IITII committed Dec 4, 2023
1 parent f5952ff commit f3eea42
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
18 changes: 18 additions & 0 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,30 @@ async function main() {
return await bot_command.start(bot).then(_ => bot)
}

/**
* reset bot commands
* @see https://github.com/telegraf/telegraf/issues/1589
* @see https://github.com/jxxghp/MoviePilot/blob/0214beb6798f161623bf294266b1121040e83a41/app/modules/telegram/telegram.py#L216
*/
async function resetBotCommand(bot) {
const commands = [
{command: 'search', description: '找点什么?...'},
{command: 'copy_del', description: '让我康康!!!'},
{command: 'download', description: '仅下载'},
{command: 'sub', description: '订阅'},
{command: 'u_sub', description: '取消订阅'},
]
await bot.telegram.deleteMyCommands()
return bot.telegram.setMyCommands(commands)
}

// Error Handling
Promise.resolve()
.then(_ => msgHandle.start())
.then(_ => picHandle.start())
.then(_ => actionHandler.start())
.then(_ => taskRunner.start())
.then(_ => resetBotCommand(bot))
.then(_ => main())
.then(_ => {
// Enable graceful stop
Expand Down
4 changes: 0 additions & 4 deletions libs/download/sites/HentaiComic.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ async function handle_dom($, original) {
return Promise.resolve(res)
}

let url = 'https://www.hentaicomic.ru/photos-slide-aid-227644.html'
// url = 'https://www.hentaicomic.ru/photos-gallery-aid-227644.html'
getImageArray(url).then(console.log).catch(console.error)

module.exports = {
getImageArray,
}
4 changes: 0 additions & 4 deletions libs/download/sites/HentaiComicTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,3 @@ async function handle_dom($, original) {
const res = {title, imgs: url_texts}
return Promise.resolve(res)
}

let url = 'https://www.hentaicomic.ru/search/?q=Kitkatkitty&f=_all&s=create_time_DESC&syn=yes'
// url = 'https://www.hentaicomic.ru/albums-index-cate-3.html'
getTagUrls(url).then(console.log)

0 comments on commit f3eea42

Please sign in to comment.