![](/img/trans.png)
[英]How to use python-telegram-bot to send messages to a telegram channel
[英]How to handle and remove “joined the group” messages in python-telegram-bot?
我創建了一個機器人來使用python-telegram-bot
在電報中管理我的組。 我希望機器人處理和刪除加入/留下的消息。 我沒有像普通消息那樣收到這些消息。 有沒有辦法處理它們?
我使用機器人為我完成任務,但該機器人開始發布廣告。 我不相信任何現有的機器人,我想使用python-telegram-bot
創建我python-telegram-bot
因為我的機器人已經使用它構建了。
我已經解決了這個問題如下:
可以使用Filters.status_update.new_chat_members
處理加入的消息
以下是我的代碼。
def onjoin(update,context):
context.bot.delete_message(chat_id=update.message.chat_id,message_id=update.message.message_id)
def main():
updater = Updater(API_KEY, use_context=True)
dp = updater.dispatcher
dp.add_handler(MessageHandler(Filters.status_update.new_chat_members,onjoin))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.