Python中如何在电报发送消息bot中使用解析模式
我对制造机器人还很陌生,所以我有几个问题想问:Python中如何在电报发送消息bot中使用解析模式,python,telegram-bot,telethon,Python,Telegram Bot,Telethon,我对制造机器人还很陌生,所以我有几个问题想问: 我正在使用机器人发送消息 def send_message(chat_id, msg): url = f"https://api.telegram.org/bot{bot_token}/sendMessage?chat_id={chat_id}&text={msg}" requests.get(url) send_message(chat_id,msg) 通过这个,我可以发送消息,我想通过使用parse_模式
def send_message(chat_id, msg):
url = f"https://api.telegram.org/bot{bot_token}/sendMessage?chat_id={chat_id}&text={msg}"
requests.get(url)
send_message(chat_id,msg)
destination_channel_username='test_ali3'
entity=client.get_entity(destination_channel_username)
client.send_message(entity=entity,message="Hi")
但它需要我的通道访问\u散列,如何获得它,或者是否有任何其他方式将消息发送到通道
Python电报Bot
,请参阅。免责声明:我目前是该软件包的维护者。还有其他用于bot api的python包,请参见
>但该库主要用于所谓的用户机器人。事实并非如此,机器人得到了很好的支持,开销更少(您直接与电报通话),限制也更少。
def send_message(chat_id, msg, parse_mode):
url = f"https://api.telegram.org/bot{bot_token}/sendMessage?chat_id={chat_id}&text={msg}&parse_mode={parse_mode}"
requests.get(url)