mirror of
https://github.com/muerwre/vk-tg-bot.git
synced 2025-05-08 05:06:40 +07:00
made plaintext posts
This commit is contained in:
parent
26fea2541e
commit
ba2832ca34
7 changed files with 67 additions and 30 deletions
src/service/telegram
|
@ -2,7 +2,7 @@ import { TelegramConfig, WebhookConfig } from "./types";
|
|||
import { Telegraf } from "telegraf";
|
||||
import logger from "../logger";
|
||||
import { Response } from "express";
|
||||
import { Update } from "typegram";
|
||||
import { InputMediaPhoto, Update } from "typegram";
|
||||
import loggerTgMiddleware from "../logger/tg";
|
||||
import { ExtraReplyMessage } from "telegraf/typings/telegram-types";
|
||||
|
||||
|
@ -80,7 +80,7 @@ export class TelegramService {
|
|||
};
|
||||
|
||||
/**
|
||||
* Sends simple message to channel
|
||||
* Sends message with photo to channel
|
||||
*/
|
||||
public sendPhotoToChan = async (
|
||||
channel: string,
|
||||
|
@ -95,6 +95,27 @@ export class TelegramService {
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends simple message to channel
|
||||
*/
|
||||
public sendPhotoGroupToChan = async (
|
||||
channel: string,
|
||||
caption: string,
|
||||
src: string[],
|
||||
extra?: ExtraReplyMessage
|
||||
) => {
|
||||
logger.debug(`sending photo message "${caption}" to chan "${channel}"`);
|
||||
const group: InputMediaPhoto[] = src.map((media, i) => ({
|
||||
type: "photo",
|
||||
media,
|
||||
caption: i === 0 ? caption : undefined,
|
||||
}));
|
||||
|
||||
return await this.bot.telegram.sendMediaGroup(channel, group, {
|
||||
...extra,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Stops service
|
||||
* @param signal
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue