我的机器人如何删除组中发送给它的/ command消息?

时间:2019-03-22 17:15:07

标签: python telegram telegram-bot

首先,我要说我不是程序员。

我需要一些帮助来获取以下代码,以从群聊中删除发送到机器人的/ command。

不是程序员,请将以下代码与我发现的示例放在一起。

谢谢


import telegram
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
from telegram import (ReplyKeyboardMarkup, ReplyKeyboardRemove)
import logging
import time

updater = Updater(token='TOKEN')

dispatcher = updater.dispatcher

logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
                     level=logging.INFO)

def start(bot, update):
        bot.send_message(chat_id=update.message.chat_id, text="Where would you like to go?")
start_handler = CommandHandler('start', start)
dispatcher.add_handler(start_handler)

### lions_park
def lions_park(bot, update):
    bot.send_message(chat_id=update.message.chat_id, text='<b>lions park</b> <a href="https://www.google.com/maps/search/?api=1&query=49.266137,-122.780679"> Take Me There! </a>', parse_mode=telegram.ParseMode.HTML)
lions_park_handler = CommandHandler('lions_park', lions_park)
dispatcher.add_handler(lions_park_handler)

### frog_gym
def frog_gym(bot, update):
    bot.send_message(chat_id=update.message.chat_id, text='<b>frog gym</b> <a href="https://www.google.com/maps/search/?api=1&query=49.299372,-122.760475"> Take Me There! </a>', parse_mode=telegram.ParseMode.HTML)
frog_gym_handler = CommandHandler('frog_gym', frog_gym)
dispatcher.add_handler(frog_gym_handler)

### bee_house
def bee_house(bot, update):
    bot.send_message(chat_id=update.message.chat_id, text='<b>bee house</b> <a href="https://www.google.com/maps/search/?api=1&query=49.286018,-122.784835"> Take Me There! </a>', parse_mode=telegram.ParseMode.HTML)
bee_house_handler = CommandHandler('bee_house', bee_house)
dispatcher.add_handler(bee_house_handler)

updater.start_polling()

0 个答案:

没有答案