bot-eye-leak/src/handlers/jokeTask.js

37 lines
831 B
JavaScript

const { SERVICE } = require('../util/service')
class JokeTask {
async getRandomAnimation({ Extra, replyWithAnimation }) {
const { videoURL: sendGif, description: caption } =
await SERVICE.getJokeDev()
return replyWithAnimation(sendGif, {
caption,
...Extra.markup(m =>
m.inlineKeyboard([m.callbackButton('MOAR', 'joke|moar')])
)
})
}
async updateAnimation({
Extra,
answerCbQuery,
editMessageMedia,
editMessageCaption
}) {
await answerCbQuery()
const moar = Extra.markup(m =>
m.inlineKeyboard([m.callbackButton('MOAR', 'joke|moar')])
)
const { videoURL: media, description: caption } = await SERVICE.getJokeDev()
return await editMessageMedia(
{
type: 'animation',
media
},
moar
).then(() => editMessageCaption(caption, moar))
}
}
module.exports = new JokeTask()