You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Aiogram如何实现机器人发送无提示音消息

Aiogram 发送无提示音消息实现方案

Aiogram 完全支持发送无提示音消息,效果和用户手动发送的无提示音消息完全一致,该能力基于 Telegram Bot API 原生参数实现,不需要额外依赖或特殊配置。

核心参数说明

所有消息发送接口都支持disable_notification参数,将该参数设为True时,接收方收到消息不会触发铃声、振动提醒,仅会在聊天列表保留未读标记。

不同版本实现示例

Aiogram 3.x(当前主流稳定版)

所有发送类方法(文本、图片、音频、文件、位置等全类型消息)均可直接传入该参数,文本消息示例:

from aiogram import Bot

# 初始化机器人实例
bot = Bot(token="替换为你的机器人Token")

async def send_silent_text(chat_id: int, msg_text: str):
    await bot.send_message(
        chat_id=chat_id,
        text=msg_text,
        disable_notification=True
    )

如果需要发送其他类型的无提示音消息,直接在对应方法(如send_photo/send_video/send_document)中加入disable_notification=True参数即可,逻辑完全一致。

Aiogram 2.x(历史版本)

参数逻辑和3.x完全一致,仅调用写法有少量区别,示例:

from aiogram import Bot

bot = Bot(token="替换为你的机器人Token")

async def send_silent_text_old(chat_id: int, msg_text: str):
    await bot.send_message(
        chat_id=chat_id,
        text=msg_text,
        disable_notification=True
    )

补充说明:该参数不会影响消息的正常投递,也不会对消息内容做任何修改,仅关闭接收端的提醒音和振动。

内容的提问来源于stack exchange,提问作者Tanookie

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.29 19:27:16