mirror of
https://github.com/artemium428/first-commenting-bot.git
synced 2026-09-15 16:46:19 +00:00
Disable link previews in bot reply comments.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
9147306713
commit
6affbb40c9
1 changed files with 6 additions and 2 deletions
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
from aiogram import Bot, Dispatcher, F, Router
|
from aiogram import Bot, Dispatcher, F, Router
|
||||||
from aiogram.enums import ParseMode
|
from aiogram.enums import ParseMode
|
||||||
from aiogram.filters import Filter
|
from aiogram.filters import Filter
|
||||||
from aiogram.types import Message
|
from aiogram.types import LinkPreviewOptions, Message
|
||||||
|
|
||||||
from bot.config import Config, load_config
|
from bot.config import Config, load_config
|
||||||
|
|
||||||
|
|
@ -29,7 +29,11 @@ def create_dispatcher(config: Config) -> Dispatcher:
|
||||||
@router.message(F.chat.id == config.discussion_chat_id, FromLinkedChannel())
|
@router.message(F.chat.id == config.discussion_chat_id, FromLinkedChannel())
|
||||||
async def on_channel_post(message: Message) -> None:
|
async def on_channel_post(message: Message) -> None:
|
||||||
try:
|
try:
|
||||||
await message.reply(config.comment_text, parse_mode=ParseMode.HTML)
|
await message.reply(
|
||||||
|
config.comment_text,
|
||||||
|
parse_mode=ParseMode.HTML,
|
||||||
|
link_preview_options=LinkPreviewOptions(is_disabled=True),
|
||||||
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception(
|
logger.exception(
|
||||||
"Failed to reply to channel post message_id=%s in chat_id=%s",
|
"Failed to reply to channel post message_id=%s in chat_id=%s",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue