mirror of
https://github.com/muerwre/vk-tg-bot.git
synced 2025-04-25 15:06:41 +07:00
added plaintext fallback for markdown
This commit is contained in:
parent
1b0a1f20d5
commit
ef4794a33f
8 changed files with 161 additions and 68 deletions
|
@ -73,10 +73,14 @@ export class TelegramService {
|
|||
public sendMessageToChan = async (
|
||||
channel: string,
|
||||
message: string,
|
||||
markdown?: boolean,
|
||||
extra?: ExtraReplyMessage
|
||||
) => {
|
||||
logger.debug(`sending message "${message}" to chan "${channel}"`);
|
||||
return await this.bot.telegram.sendMessage(channel, message, extra);
|
||||
return await this.bot.telegram.sendMessage(channel, message, {
|
||||
...extra,
|
||||
...(markdown ? { parse_mode: "Markdown" } : {}),
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -86,12 +90,14 @@ export class TelegramService {
|
|||
channel: string,
|
||||
caption: string,
|
||||
src: string,
|
||||
markdown?: boolean,
|
||||
extra?: ExtraReplyMessage
|
||||
) => {
|
||||
logger.debug(`sending photo message "${caption}" to chan "${channel}"`);
|
||||
return await this.bot.telegram.sendPhoto(channel, src, {
|
||||
...extra,
|
||||
caption,
|
||||
...(markdown ? { parse_mode: "Markdown" } : {}),
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue