1
0
Fork 0
mirror of https://github.com/muerwre/vk-tg-bot.git synced 2025-04-25 06:56:40 +07:00

#4 added photo thumbs for posts

This commit is contained in:
Fedor Katurov 2021-05-06 10:47:06 +07:00
parent 5535a36cb8
commit c8c5c7bff1
5 changed files with 107 additions and 18 deletions

View file

@ -2,9 +2,10 @@ import { TelegramConfig, WebhookConfig } from "./types";
import { Telegraf } from "telegraf";
import logger from "../logger";
import { Response } from "express";
import { Update } from "typegram";
import { InputFile, Update } from "typegram";
import loggerTgMiddleware from "../logger/tg";
import { ExtraReplyMessage } from "telegraf/typings/telegram-types";
import axios from "axios";
// import SocksProxyAgent from 'socks-proxy-agent';
@ -87,4 +88,20 @@ export class TelegramService {
logger.debug(`sending message "${message}" to chan "${channel}"`);
return await this.bot.telegram.sendMessage(channel, message, extra);
};
/**
* Sends simple message to channel
*/
public sendPhotoToChan = async (
channel: string,
caption: string,
src: string,
extra?: ExtraReplyMessage
) => {
logger.debug(`sending photo message "${caption}" to chan "${channel}"`);
return await this.bot.telegram.sendPhoto(channel, src, {
...extra,
caption,
});
};
}