def handle_exec(update: Update):
     telegram_id = BotUtil.get_telegram_id(update)
     command = BotUtil.get_message_arguments(update)
     func_result, bot_result = exec_cmd_bot(telegram_id=telegram_id,
                                            command=command)
     TelegramBotManager().bot.send_message(chat_id=update.message.chat_id,
                                           text=func_result)
示例#2
0
 def handle_getfile(update: Update):
     telegram_id = BotUtil.get_telegram_id(update)
     file_name = BotUtil.get_message_arguments(update)
     func_result, bot_result = get_file_stream(telegram_id=telegram_id,
                                               file_name=file_name)
     TelegramBotManager().bot.send_document(chat_id=update.message.chat_id,
                                            document=func_result)
示例#3
0
 def handle_getvideo(update: Update):
     telegram_id = BotUtil.get_telegram_id(update)
     video_len = int(BotUtil.get_message_arguments(update))
     Util.capture_video(video_len)
     func_result, bot_result = get_file_stream(telegram_id=telegram_id,
                                               file_name='out.avi')
     TelegramBotManager().bot.send_document(chat_id=update.message.chat_id,
                                            document=func_result)
 def handle_python(update: Update):
     telegram_id = BotUtil.get_telegram_id(update)
     cmd = BotUtil.get_message_arguments(update)
     func_result, bot_result = exec_python(telegram_id=telegram_id, cmd=cmd)
     TelegramBotManager().bot.send_message(chat_id=update.message.chat_id,
                                           text=bot_result)
 def handle_speak(self, update: Update):
     telegram_id = BotUtil.get_telegram_id(update)
     message = BotUtil.get_message_arguments(update)
     # func_result, bot_result = self.speak(telegram_id=telegram_id, text=message)
     # bot.send_message(chat_id=update.message.chat_id, text=bot_result)
     self.speak(message)