diff --git a/src/lib/telegram/commands/meme/kitten.ts b/src/lib/telegram/commands/meme/kitten.ts index f4f731b9..9413c78c 100644 --- a/src/lib/telegram/commands/meme/kitten.ts +++ b/src/lib/telegram/commands/meme/kitten.ts @@ -1,6 +1,7 @@ import { faker } from '@faker-js/faker' import { Telegraf } from 'telegraf' +import { logger } from '../../../../logger' import { ContextMessageUpdate } from '../../context-message-update' export const kitten = (bot: Telegraf): void => { @@ -9,13 +10,11 @@ export const kitten = (bot: Telegraf): void => { const x = faker.datatype.number({ min: 128, max: 2048 }) try { - await ctx.replyWithPhoto({ - url: `https://placekitten.com/${x}/${x}`, - filename: 'kitten.jpg' - }) + await ctx.replyWithPhoto(`https://placekitten.com/${x}/${x}`) } - catch { - ctx.reply('Meow!') + catch (e: any) { + logger.error(`Cannot send Photo: ${e.message}`) + await ctx.reply('Meow!') } }) }) diff --git a/src/lib/telegram/commands/meme/porn.ts b/src/lib/telegram/commands/meme/porn.ts index d9ebc782..2e6333eb 100644 --- a/src/lib/telegram/commands/meme/porn.ts +++ b/src/lib/telegram/commands/meme/porn.ts @@ -1,6 +1,7 @@ import { Telegraf } from 'telegraf' import { ShipInfo } from '../../../../db/entities' +import { logger } from '../../../../logger' import { ContextMessageUpdate } from '../../context-message-update' export const porn = (bot: Telegraf): void => { @@ -14,14 +15,13 @@ export const porn = (bot: Telegraf): void => { .getOne() const imageName = randomShip?.imageName || '' + const imageUrl = `https://storage.googleapis.com/nft-assets/items/${imageName}.jpg` - await ctx.replyWithPhoto({ - url: `https://storage.googleapis.com/nft-assets/items/${imageName}.jpg`, - filename: `${imageName}.jpg` - }) + await ctx.replyWithPhoto(imageUrl) } - catch { - ctx.reply(':-*') + catch (e: any) { + logger.error(`Cannot send Photo: ${e.message}`) + await ctx.reply(':-*') } }) }) diff --git a/src/lib/telegram/commands/meme/wen.ts b/src/lib/telegram/commands/meme/wen.ts index 8c262bf1..507b06ac 100644 --- a/src/lib/telegram/commands/meme/wen.ts +++ b/src/lib/telegram/commands/meme/wen.ts @@ -1,18 +1,17 @@ import { Telegraf } from 'telegraf' +import { logger } from '../../../../logger' import { ContextMessageUpdate } from '../../context-message-update' export const wen = (bot: Telegraf): void => { bot.command(['wen'], async (ctx) => { await ctx.persistentChatAction('upload_photo', async () => { try { - await ctx.replyWithAnimation({ - url: 'http://2damnfunny.com/wp-content/uploads/2013/06/Very-Thoon-Husky-Dog-Meme-Gif.gif', - filename: 'thoon.gif' - }) + await ctx.replyWithAnimation('http://2damnfunny.com/wp-content/uploads/2013/06/Very-Thoon-Husky-Dog-Meme-Gif.gif') } - catch { - ctx.reply('Thoon!') + catch (e: any) { + logger.error(`Cannot send Photo: ${e.message}`) + await ctx.reply('Thoon!') } }) })