Open kettly1260 opened 1 year ago
我也遇到这个问题,但是我可以接收文件,但是发送文件时会提示
Message is not sent.
InvalidToken()
以下是我使用的主端和从端版本
您正在使用 EFB Telegram 主端 2.3.1,运行于默认配置档案与实例、EFB 版本 2.1.1。
已激活 1 个从端:
- 💬 WeChat Slave (blueset.wechat, 2.0.7)
日志
stderr: 2023-09-05 08:47:10,448 [ERROR]: efb_telegram_master.master_message (master_message.process_telegram_message; master_message.py:422)
stderr: Message is not sent. (update: {'message': {'caption_entities': [], 'message_id': 941506, 'new_chat_members': [], 'new_chat_photo': [], 'entities': [], 'reply_to_message': {'edit_date': 1693874817, 'caption_entities': [], 'message_id': 941505, 'new_chat_members': [], 'new_chat_photo': [], 'entities': [], 'text': '回复该消息以与 ‘文件传输助手’ @ ‘💬 WeChat Slave’ 对话。', 'delete_chat_photo': False, 'chat': {'first_name': 'xxxxxx', 'type': 'private', 'id': xxxxxxxxxxx}, 'channel_chat_created': False, 'group_chat_created': False, 'photo': [], 'date': 1693874813, 'supergroup_chat_created': False, 'from': {'is_bot': True, 'first_name': 'xxxxxxxxxxx', 'id': xxxxxxxxxxx, 'username': 'xxxxxxxxx'}}, 'delete_chat_photo': False, 'chat': {'first_name': 'xxxxxxxxx', 'type': 'private', 'id': xxxxxxxxx}, 'channel_chat_created': False, 'group_chat_created': False, 'photo': [], 'date': 1693874826, 'supergroup_chat_created': False, 'document': {'file_unique_id': 'AgADEgsAAkmOuFc', 'file_size': 13654, 'mime_type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'file_name': 'xxxxxx.xlsx', 'file_id': 'BQACAgUAAxkBAAEOXcJk9nqKu2CLCBtVrMU6VtqIOAaDPAACEgsAAkmOuFc2BlO2pnttLjAE'}, 'from': {'is_bot': False, 'first_name': 'xxxxxxxxx', 'id': xxxxxxxxxxxxx, 'language_code': 'zh-hans'}}, 'update_id': 299213794}, exception: Invalid token)
stderr: Traceback (most recent call last):
stderr: File "/app/.venv/lib/python3.10/site-packages/efb_telegram_master/master_message.py", line 405, in process_telegram_message
stderr: slave_msg = coordinator.send_message(m)
stderr: File "/app/.venv/lib/python3.10/site-packages/ehforwarderbot/coordinator.py", line 108, in send_message
stderr: msg.verify()
stderr: File "/app/.venv/lib/python3.10/site-packages/ehforwarderbot/message.py", line 519, in verify
stderr: assert hasattr(self.file, "read") or not hasattr(self.file, "close"), \
stderr: File "/app/.venv/lib/python3.10/site-packages/efb_telegram_master/message.py", line 130, in get_file
stderr: self._load_file()
stderr: File "/app/.venv/lib/python3.10/site-packages/efb_telegram_master/message.py", line 77, in _load_file
stderr: file_meta.download(out=file)
stderr: File "/app/.venv/lib/python3.10/site-packages/telegram/files/file.py", line 148, in download
stderr: buf = self.bot.request.retrieve(url)
stderr: File "/app/.venv/lib/python3.10/site-packages/telegram/utils/request.py", line 385, in retrieve
stderr: return self._request_wrapper('GET', url, **urlopen_kwargs)
stderr: File "/app/.venv/lib/python3.10/site-packages/telegram/utils/request.py", line 281, in _request_wrapper
stderr: raise InvalidToken()
stderr: telegram.error.InvalidToken: Invalid token
stderr: 2023-09-05 08:47:10,862 [ERROR]: efb_telegram_master.master_message (master_message.message_worker; master_message.py:105)
stderr: Error [InvalidToken()] occurred while processing update {'message': {'caption_entities': [], 'message_id': 941506, 'new_chat_members': [], 'new_chat_photo': [], 'entities': [], 'reply_to_message': {'edit_date': 1693874817, 'caption_entities': [], 'message_id': 941505, 'new_chat_members': [], 'new_chat_photo': [], 'entities': [], 'text': '回复该消息以与 ‘文件传输助手’ @ ‘💬 WeChat Slave’ 对话。', 'delete_chat_photo': False, 'chat': {'first_name': 'xxxxxx', 'type': 'private', 'id': xxxxxxx}, 'channel_chat_created': False, 'group_chat_created': False, 'photo': [], 'date': 1693874813, 'supergroup_chat_created': False, 'from': {'is_bot': True, 'first_name': 'xxxxxxxxxxx', 'id': xxxxxxxxxxxx, 'username': 'xxxxxxxxx'}}, 'delete_chat_photo': False, 'chat': {'first_name': 'xxxxxxxxx', 'type': 'private', 'id': xxxxxxxxxxxxx}, 'channel_chat_created': False, 'group_chat_created': False, 'photo': [], 'date': 1693874826, 'supergroup_chat_created': False, 'document': {'file_unique_id': 'AgADEgsAAkmOuFc', 'file_size': 13654, 'mime_type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'file_name': 'xxxx.xlsx', 'file_id': 'BQACAgUAAxkBAAEOXcJk9nqKu2CLCBtVrMU6VtqIOAaDPAACEgsAAkmOuFc2BlO2pnttLjAE'}, 'from': {'is_bot': False, 'first_name': 'xxxxxxx', 'id': xxxxxxxx, 'language_code': 'zh-hans'}}, 'update_id': 299213794}.
stderr: Traceback (most recent call last):
stderr: File "/app/.venv/lib/python3.10/site-packages/efb_telegram_master/master_message.py", line 103, in message_worker
stderr: self.msg(update, context)
stderr: File "/app/.venv/lib/python3.10/site-packages/efb_telegram_master/master_message.py", line 207, in msg
stderr: return self.process_telegram_message(update, context, destination, quote=quote, edited=edited)
stderr: File "/app/.venv/lib/python3.10/site-packages/efb_telegram_master/master_message.py", line 426, in process_telegram_message
stderr: if m.file:
stderr: File "/app/.venv/lib/python3.10/site-packages/efb_telegram_master/message.py", line 130, in get_file
stderr: self._load_file()
stderr: File "/app/.venv/lib/python3.10/site-packages/efb_telegram_master/message.py", line 77, in _load_file
stderr: file_meta.download(out=file)
stderr: File "/app/.venv/lib/python3.10/site-packages/telegram/files/file.py", line 148, in download
stderr: buf = self.bot.request.retrieve(url)
stderr: File "/app/.venv/lib/python3.10/site-packages/telegram/utils/request.py", line 385, in retrieve
stderr: return self._request_wrapper('GET', url, **urlopen_kwargs)
stderr: File "/app/.venv/lib/python3.10/site-packages/telegram/utils/request.py", line 281, in _request_wrapper
stderr: raise InvalidToken()
stderr: telegram.error.InvalidToken: Invalid token
问题1:发送文件失败,提示 FileNotFoundError: [Errno 2] No such file or directory: 'file:///tmp/tmpp5_qox2o’
解决方法:efb_telegram_master/slave_message.py文件中process_file_obj 修改为:
def process_file_obj(self, file: IO[bytes], path: Union[str, Path]) -> Union[IO[bytes], str]:
return file
问题2:接收文件失败,提示invalid Token
解决方法:profiles/default/blueset.telegram/config.yaml 中 api_base_file_url 填写telegram bot api的work dir,例如:
api_base_file_url: "/home/pangxiezhou/.telegram_bot_server/"