Как использовать репозиторий Python-telegram-bot для отправки сообщения на запрос пользователя telegram?
I programmed a telegram bot for downloading torrents with python-telegram-bot repository; however, my functions seem to work on the server side and the responses appear on my terminal/console where im running the py-script and transmissionBT server, but it does not send the response back to the user. below is my code:
Что я уже пробовал:
def get_torrent(MAGNET): import subprocess get_it = subprocess.run(["transmission-remote", "-a", "-D", "-o", "--utp", MAGNET]) return "*success*" def list_torrent(LISTED): import subprocess get_list = subprocess.run(["transmission-remote", LISTED]) return "*listed*" def del_torrent(TORRENT_NO): import subprocess del_torrent = subprocess.run(["transmission-remote", "-t", TORRENT_NO, "-r"]) return "*deleted*" def crepttit(bot, update, args): import time MAGNET = " ".join(args) media_content = get_torrent(MAGNET) time.sleep(1) bot.send_meessage(chat_id=update.message.chat_id, text=media_content) def crepttl(bot, update, args): import time LISTED = " ".join(args) listed_torrent = list_torrent(LISTED) time.sleep(1) chat_id = update.message.chat_id bot.send_message(chat_id=chat_id, text=torrent_list) def crepttd(bot, update, args): import time TORRENT_NO = " ".join(args) deleted_torrent = del_torrent(TORRENT_NO) time.sleep(1) bot.send_meessage(chat_id=update.message.chat_id, text=deleted_torrent) from telegram.ext import Updater, CommandHandler import subprocess import time import os TOKEN = "1119029063:AAHfUqNTQuwDr3vRD7c8lOfa01N-2zZn14c" updater = Updater(TOKEN) dispatcher = updater.dispatcher start_handler = CommandHandler("creptt", crepttit, pass_args=True) dispatcher.add_handler(start_handler) start_handler2 = CommandHandler("crepttl", crepttl, pass_args=True) dispatcher.add_handler(start_handler2) start_handler3 = CommandHandler("crepttd", crepttd, pass_args=True) dispatcher.add_handler(start_handler3) updater.start_polling() updater.idle()