0
私はpython-telegram-botモジュールを使って電報ボットを作成しました。管理group.Theボットでボットステッカー、GIFや音声がグループに送信されたときに削除されなければならない。しかし、ボットがthem.botコードを削除しません:テレグラムボットは、グループに送信されたステッカー、Gif、およびボイスを削除する必要がありますが、削除しないでください。
from telegram.ext import Updater, MessageHandler, Filters
def sticker_method(bot, update):
bot.delete_sticker(chat_id = update.message.chat_id, sticker_id = update.sticker.chat_id)
bot.delete_gif(chat_id = update.message.chat_id, gif_id = update.gif.chat_id)
bot.delete_voice(chat_id = update.message.chat_id, voice_id = update.voice.chat_id)
def main():
updater = Updater(token='TOKEN')
dispatcher = updater.dispatcher
dispatcher.add_handler(MessageHandler(Filters.all, sticker_method))
updater.start_polling()
updater.idle()
if __name__ == '__main__':
main()
# for exit
# updater.idle()
実行中にエラーがありません。しかし、ボットは何もしません!
私の英語はよくないと私はあなたのページを読むことができません私のコードを修正してください。 – Sajjad
特定のタイプのメッセージを受信したときにメッセージを削除する際の最小限の例を含むように答えを更新しました。 – jeffffc