GithubHelp home page GithubHelp logo

ehforwarderbot / efb-telegram-master Goto Github PK

View Code? Open in Web Editor NEW
221.0 10.0 78.0 10.01 MB

EFB Telegram Master Channel, a channel for EH Forwarder Bot.

License: GNU Affero General Public License v3.0

Python 100.00%
eh-forwarder-bot efb-master-channel telegram telegram-bot

efb-telegram-master's Issues

Stack for undelivered messages

Create a queue for all undelivered messages, have a thread in parallel that checks if if there is message in the queue in a fixed in a fixed interval. If found, dequeue and resend, enqueue it back when failed.

Original content (chatlog) liwanglin12 Unofficial: @blueset 话说

telegram 服务器临时连接不上造成的丢消息

能重发么

Eana Hufwe:
目前是使用的 PTB 的5次重试策略

5次重试都不行就输出到 log

liwanglin12 Unofficial:
感觉能不能有一个机制

比如定期检测一下连通性

(比如利用updates

这个五次重试不行的

拉个库存起来

一旦链接恢复就重发

另外给main.py加一个让他重发的能力

主动重连

Eana Hufwe:
倒是可以搞一个 stack 隔一段时间检查一次

nice idea

到 ETM v2 repo 丢一个 issue 吧(俺可能会忘……((

话说这个「主动重连」是什么意思

liwanglin12 Unofficial:
比如 python3 main.py command updateetm

Eana Hufwe:
哦哦

This mistake happened when wechat logining successful

And efb_telegram_master seems goes wrong,I don't know how to slove this

Traceback (most recent call last):
File "/usr/local/bin/ehforwarderbot", line 11, in sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/ehforwarderbot/main.py", line 190, in main init()
File "/usr/local/lib/python3.6/dist-packages/ehforwarderbot/main.py", line 94, in init
(instance_id=instance_id)) File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/init.py", line 126, in init
self.voice_recognition: VoiceRecognitionManager = VoiceRecognitionManager(self)
File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/voice_recognition.py", line 49, in init
self.voice_engines.append(BaiduSpeech(self.channel, tokens['baidu']))
File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/voice_recognition.py", line 116, in init
"client_id": key_dict['api_key'],
TypeError: 'NoneType' object is not subscriptable

An error during voice recog

Here is the log:

2018-07-14 00:13:48,454 [ERROR]: telegram.ext.dispatcher (dispatcher.process_update; dispatcher.py:301)
    An uncaught error was raised while processing the update
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/telegram/ext/dispatcher.py", line 279, in process_update
    handler.handle_update(update, self)
  File "/usr/local/lib/python3.6/dist-packages/telegram/ext/commandhandler.py", line 173, in handle_update
    return self.callback(dispatcher.bot, update, **optional_args)
  File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/voice_recognition.py", line 74, in recognize_speech
    file, _, _ = self._download_file(update.message, update.message.reply_to_message.voice, MsgType.Audio)
AttributeError: 'VoiceRecognitionManager' object has no attribute '_download_file'

Message is not found in database. Please try with another one. (UC03)

From @jqqqqqqqqqq on September 25, 2017 11:22

issue

"Message is not found in database. Please try with another one. (UC03)" occurs when replying to a document message(e.g. someone sent a GIF in group).

part of the error message:

2017-09-25 20:14:34,670: plugins.eh_telegram_master.db [INFO]
    get_msg_log 164884364.1718
2017-09-25 20:14:34,671: peewee [DEBUG]
    ('SELECT "t1"."master_msg_id", "t1"."slave_message_id", "t1"."text", "t1"."slave_origin_uid", "t1"."slave_origin_display_name", "t1"."slave_member_uid", "t1"."slave_member_display_name", "t1"."msg_type", "t1"."sent_to", "t1"."time" FROM "msglog" AS t1 WHERE ("t1"."master_msg_id" = ?) ORDER BY "t1"."time" DESC LIMIT 1', ['164884364.1718'])

Copied from original issue: ehForwarderBot/ehForwarderBot#86

TypeError: 'NoneType' object is not subscriptable

when I want to send message in my group, I get
捕获

when I pick one of my contact, the log shows:

2019-04-09 09:05:37,715 [ERROR]: telegram.ext.dispatcher (dispatcher.process_update; dispatcher

.py:301)
    An uncaught error was raised while processing the update
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/telegram/ext/dispatcher.py", line 279, in process_update
    handler.handle_update(update, self)
  File "/usr/local/lib/python3.6/dist-packages/telegram/ext/conversationhandler.py", line 305, in handle_update
    new_state = self.current_handler.handle_update(update, dispatcher)
  File "/usr/local/lib/python3.6/dist-packages/telegram/ext/callbackqueryhandler.py", line 143, in handle_update
    return self.callback(dispatcher.bot, update, **optional_args)
  File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/chat_binding.py", line 822, in suggested_recipient
    chat = self.msg_storage[storage_id].candidates[int(param.split(' ', 1)[1])]
TypeError: 'NoneType' object is not subscriptable

Database is locked

From @Gontid on July 27, 2017 14:31

Doesn't seem to affect functionality but I saw the following in the log file. Can someone explain what is wrong? Running ehForwarderBot on Centos 7.

return self.database.execute_sql(sql, params, self.require_commit)
  File "/usr/lib/python3.6/site-packages/peewee.py", line 3775, in execute_sql
    self.commit()
  File "/usr/lib/python3.6/site-packages/peewee.py", line 3598, in __exit__
    reraise(new_type, new_type(*exc_args), traceback)
  File "/usr/lib/python3.6/site-packages/peewee.py", line 135, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3.6/site-packages/peewee.py", line 3768, in execute_sql
    cursor.execute(sql, params or ())
peewee.OperationalError: database is locked

Appreciate your help!

Copied from original issue: ehForwarderBot/ehForwarderBot#68

No prompt, no retry when ETM times out while sending file

From @blueset on November 9, 2017 10:37

Log
2017-11-09 10:28:54,822: itchat [DEBUG]
    No uins in 51 message
2017-11-09 10:28:54,823: itchat [DEBUG]

2017-11-09 10:28:54,823: plugins.eh_wechat_slave.WeChatChannel [DEBUG]
    WeChat "System" message:
<Message: {'SystemInfo': 'uins', 'Url': '', 'Status': 3, 'PlayLength': 0, 'ImgStatus': 1, 'Content': '', 'FileName': '', 'AppInfo': {'Type': 0, 'AppID': ''}, 'ImgWidth': 0, 'Ticket': '', 'FromUserName': '@4cbf265ac22d857f11523b24730b0a2b', 'AppMsgType': 0, 'SubMsgType': 0, 'HasProductId': 0, 'User': <User: {'MemberList': <ContactList: []>, 'UserName': 'filehelper'}>, 'Type': 'System', 'ImgHeight': 0, 'ForwardFlag': 0, 'StatusNotifyCode': 2, 'RecommendInfo': {'Alias': '', 'AttrStatus': 0, 'QQNum': 0, 'NickName': '', 'Content': '', 'Sex': 0, 'City': '', 'Ticket': '', 'Scene': 0, 'VerifyFlag': 0, 'OpCode': 0, 'Province': '', 'Signature': '', 'UserName': ''}, 'FileSize': '', 'MsgType': 51, 'MsgId': '5125997940070499124', 'NewMsgId': 5125997940070499124, 'VoiceLength': 0, 'CreateTime': 1510223334, 'OriContent': '', 'MediaId': '', 'Text': [], 'StatusNotifyUserName': 'filehelper', 'ToUserName': 'filehelper'}>
2017-11-09 10:29:00,129: plugins.eh_wechat_slave.wechat_msg_meta [DEBUG]
    Raw message: <Message: {'Url': '', 'Status': 3, 'PlayLength': 0, 'ImgStatus': 1, 'Content': '<?xml version="1.0"?>\n<msg>\n\t<appmsg appid="wx6618f1cfc6c132f8" sdkver="0">\n\t\t<title>complete-info20003-database-systems-subject-notes.pdf</title>\n\t\t<des />\n\t\t<username />\n\t\t<action>view</action>\n\t\t<type>6</type>\n\t\t<showtype>0</showtype>\n\t\t<content />\n\t\t<url />\n\t\t<lowurl />\n\t\t<dataurl />\n\t\t<lowdataurl />\n\t\t<contentattr>0</contentattr>\n\t\t<streamvideo>\n\t\t\t<streamvideourl />\n\t\t\t<streamvideototaltime>0</streamvideototaltime>\n\t\t\t<streamvideotitle />\n\t\t\t<streamvideowording />\n\t\t\t<streamvideoweburl />\n\t\t\t<streamvideothumburl />\n\t\t\t<streamvideoaduxinfo />\n\t\t\t<streamvideopublishid />\n\t\t</streamvideo>\n\t\t<canvasPageItem>\n\t\t\t<canvasPageXml><![CDATA[]]></canvasPageXml>\n\t\t</canvasPageItem>\n\t\t<appattach>\n\t\t\t<totallen>2183828</totallen>\n\t\t\t<attachid>@cdn_30590201000452305002010002041eab456502030f52590204c394cdcb02045a042d40042b6175706174746163685f363238303562613137353139393064645f313531303232333136363839325f31300204010c00050201000400_d00a1b50fe924d6f86807e2777311dfb_1</attachid>\n\t\t\t<cdnattachurl>30590201000452305002010002041eab456502030f52590204c394cdcb02045a042d40042b6175706174746163685f363238303562613137353139393064645f313531303232333136363839325f31300204010c00050201000400</cdnattachurl>\n\t\t\t<emoticonmd5 />\n\t\t\t<aeskey>d00a1b50fe924d6f86807e2777311dfb</aeskey>\n\t\t\t<fileext>pdf</fileext>\n\t\t\t<islargefilemsg>0</islargefilemsg>\n\t\t</appattach>\n\t\t<extinfo />\n\t\t<androidsource>3</androidsource>\n\t\t<thumburl />\n\t\t<mediatagname />\n\t\t<messageaction><![CDATA[]]></messageaction>\n\t\t<messageext><![CDATA[]]></messageext>\n\t\t<emoticongift>\n\t\t\t<packageflag>0</packageflag>\n\t\t\t<packageid />\n\t\t</emoticongift>\n\t\t<emoticonshared>\n\t\t\t<packageflag>0</packageflag>\n\t\t\t<packageid />\n\t\t</emoticonshared>\n\t\t<weappinfo>\n\t\t\t<username />\n\t\t\t<appid />\n\t\t</weappinfo>\n\t\t<designershared>\n\t\t\t<designeruin>0</designeruin>\n\t\t\t<designername>null</designername>\n\t\t\t<designerrediretcturl>null</designerrediretcturl>\n\t\t</designershared>\n\t\t<emotionpageshared>\n\t\t\t<tid>0</tid>\n\t\t\t<title>null</title>\n\t\t\t<desc>null</desc>\n\t\t\t<iconUrl>null</iconUrl>\n\t\t\t<secondUrl />\n\t\t\t<pageType>0</pageType>\n\t\t</emotionpageshared>\n\t\t<webviewshared>\n\t\t\t<shareUrlOriginal />\n\t\t\t<shareUrlOpen />\n\t\t\t<jsAppId />\n\t\t\t<publisherId />\n\t\t</webviewshared>\n\t\t<template_id>0</template_id>\n\t\t<statextstr>GhQKEnd4NjYxOGYxY2ZjNmMxMzJmOA==</statextstr>\n\t\t<md5>9f8bf94a54db4094a5596e14ac1b165c</md5>\n\t</appmsg>\n\t<fromusername>blueset</fromusername>\n\t<scene>0</scene>\n\t<appinfo>\n\t\t<version>7</version>\n\t\t<appname>微信电脑版</appname>\n\t</appinfo>\n\t<commenturl></commenturl>\n</msg>\n', 'FileName': 'complete-info20003-database-systems-subject-notes.pdf', 'AppInfo': {'Type': 0, 'AppID': 'wx6618f1cfc6c132f8'}, 'ImgWidth': 0, 'Ticket': '', 'FromUserName': '@4cbf265ac22d857f11523b24730b0a2b', 'AppMsgType': 6, 'SubMsgType': 0, 'HasProductId': 0, 'User': <User: {'MemberList': <ContactList: []>, 'UserName': 'filehelper'}>, 'Type': 'Attachment', 'ImgHeight': 0, 'ForwardFlag': 0, 'StatusNotifyCode': 0, 'RecommendInfo': {'Alias': '', 'AttrStatus': 0, 'QQNum': 0, 'NickName': '', 'Content': '', 'Sex': 0, 'City': '', 'Ticket': '', 'Scene': 0, 'VerifyFlag': 0, 'OpCode': 0, 'Province': '', 'Signature': '', 'UserName': ''}, 'FileSize': '2183828', 'MsgType': 49, 'MsgId': '511218672271321680', 'NewMsgId': 511218672271321680, 'VoiceLength': 0, 'CreateTime': 1510223339, 'OriContent': '', 'MediaId': '@crypt_6a80f494_7569bf0780148248ea33855c99e082337bed75ccabb3321e8765c06e33f9bf0d1d142386f75843341b80f8f389f2a124bd928aeae4b549b7f7223cc8cb9078152a0c33b3ec3a685d516fe0741c0c3ddaff4feccf6af246cab315e06b58ba7a32d85dbc8fae405e2810b5793bb32e3bac5a1b117159b302de716334634b20147564cb0a9cf0015729a65cddcc7776cf21bb16dcdee283eb01656505de4c21b26c4558061ea760caa0d385489783e2a5ccdcf9e65bcf62a60f8f9a7cdfe4d5ec34abe009dd1394b824010e766f2651d57cb940ece5decbbb45d49acd7fb78eaa03', 'Text': <function produce_msg.<locals>.download_atta at 0x7f04300821e0>, 'StatusNotifyUserName': '', 'ToUserName': 'filehelper'}>
2017-11-09 10:29:01,436: plugins.eh_wechat_slave.WeChatChannel [INFO]
    File saved from WeChat
Full path: storage/eh_wechat_slave/File_511218672271321680_1510223340.pdf
MIME: application/pdf
2017-11-09 10:29:01,436: plugins.eh_wechat_slave.wechat_msg_meta [DEBUG]
    me, True
2017-11-09 10:29:01,436: plugins.eh_wechat_slave.wechat_msg_meta [DEBUG]
    From user, {'Uin': 'filehelper', 'RemarkName': 'System (filehelper)', 'UserName': 'filehelper', 'NickName': 'System (filehelper)'}
2017-11-09 10:29:01,450: plugins.eh_wechat_slave.wechat_msg_meta [DEBUG]
    dest: {'alias': '\u2006', 'name': '\u2006', 'uid': '1786733442'}
2017-11-09 10:29:01,450: plugins.eh_wechat_slave.wechat_msg_meta [INFO]
    WeChat incoming message:
Type: File
Text: <function produce_msg.<locals>.download_atta at 0x7f04300821e0>
UserName: filehelper
uid: filehelper
name: System (filehelper)
2017-11-09 10:29:01,451: plugins.eh_telegram_master.TelegramChannel [INFO]
    Got message from queue
Type: File
Text: You: complete-info20003-database-systems-subject-notes.pdf
----
2017-11-09 10:29:01,451: plugins.eh_telegram_master.TelegramChannel [DEBUG]
    1510223341.451574, Msg text: You: complete-info20003-database-systems-subject-notes.pdf
2017-11-09 10:29:01,451: plugins.eh_telegram_master.TelegramChannel [INFO]
    Msg sent to TG, task_done marked.
2017-11-09 10:29:01,451: plugins.eh_telegram_master.TelegramChannel [DEBUG]
    1510223341.451574, process_msg_step_0
2017-11-09 10:29:01,452: peewee [DEBUG]
    ('SELECT "t1"."id", "t1"."master_uid", "t1"."slave_uid" FROM "chatassoc" AS t1 WHERE ("t1"."slave_uid" = ?)', ['eh_wechat_slave.filehelper'])
2017-11-09 10:29:01,453: plugins.eh_telegram_master.TelegramChannel [DEBUG]
    1510223341.451574, process_msg_step_1, tg_dest=57995782, msg.origin={'alias': 'System (filehelper)', 'name': 'System (filehelper)', 'uid': 'filehelper'}
2017-11-09 10:29:01,453: plugins.eh_telegram_master.TelegramChannel [DEBUG]
    1510223341.451574, process_msg_step_2
2017-11-09 10:29:08,007: plugins.eh_telegram_master.TelegramChannel [ERROR]
    NetworkError()Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 390, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.5/http/client.py", line 1107, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.5/http/client.py", line 1152, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.5/http/client.py", line 1103, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.5/http/client.py", line 936, in _send_output
    self.send(message_body)
  File "/usr/lib/python3.5/http/client.py", line 908, in send
    self.sock.sendall(data)
  File "/usr/lib/python3.5/ssl.py", line 899, in sendall
    v = self.send(data[count:])
  File "/usr/lib/python3.5/ssl.py", line 869, in send
    return self._sslobj.write(data)
  File "/usr/lib/python3.5/ssl.py", line 594, in write
    return self._sslobj.write(data)
socket.timeout: The write operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/telegram/utils/request.py", line 190, in _request_wrapper
    resp = self._con_pool.request(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
    **urlopen_kw)
  File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 347, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 390, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.5/http/client.py", line 1107, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.5/http/client.py", line 1152, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.5/http/client.py", line 1103, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.5/http/client.py", line 936, in _send_output
    self.send(message_body)
  File "/usr/lib/python3.5/http/client.py", line 908, in send
    self.sock.sendall(data)
  File "/usr/lib/python3.5/ssl.py", line 899, in sendall
    v = self.send(data[count:])
  File "/usr/lib/python3.5/ssl.py", line 869, in send
    return self._sslobj.write(data)
  File "/usr/lib/python3.5/ssl.py", line 594, in write
    return self._sslobj.write(data)
telegram.vendor.ptb_urllib3.urllib3.exceptions.ProtocolError: ('Connection aborted.', timeout('The write operation timed out',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/ehforwarderbot/plugins/eh_telegram_master/__init__.py", line 385, in process_msg
    filename=file_name)
  File "/usr/local/lib/python3.5/dist-packages/telegram/bot.py", line 57, in decorator
    result = func(self, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/telegram/bot.py", line 82, in decorator
    result = self._request.post(url, data, timeout=kwargs.get('timeout'))
  File "/usr/local/lib/python3.5/dist-packages/telegram/utils/request.py", line 264, in post
    'POST', url, body=data.to_form(), headers=data.headers, **urlopen_kwargs)
  File "/usr/local/lib/python3.5/dist-packages/telegram/utils/request.py", line 196, in _request_wrapper
    raise NetworkError('urllib3 HTTPError {0}'.format(error))
telegram.error.NetworkError: urllib3 HTTPError ('Connection aborted.', timeout('The write operation timed out',))

Copied from original issue: ehForwarderBot/ehForwarderBot#93

KeyError: 'access_token'

After I login wechat , I saw this:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/dist-packages/ehforwarderbot/main.py", line 207, in
main()
File "/usr/local/lib/python3.6/dist-packages/ehforwarderbot/main.py", line 202, in main
init()
File "/usr/local/lib/python3.6/dist-packages/ehforwarderbot/main.py", line 95, in init
(instance_id=instance_id))
File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/init.py", line 126, in init
self.voice_recognition: VoiceRecognitionManager = VoiceRecognitionManager(self)
File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/voice_recognition.py", line 49, in init
self.voice_engines.append(BaiduSpeech(self.channel, tokens['baidu']))
File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/voice_recognition.py", line 120, in init
self.access_token = r['access_token']
KeyError: 'access_token'

How should I do?

I got the following error after restarting the host.

I got the following error after restarting the host.Before that it works fine.
The error is about missing ffmpeg ? But I have installed it.

root@:# cat /etc/debian_version
9.5
root@:
# uname -a
Linux xx-vm 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u5 (2018-09-30) x86_64 GNU/Linux

root@:# apt-get install ffmpeg
Reading package lists... Done
Building dependency tree
Reading state information... Done
ffmpeg is already the newest version (7:3.2.12-1
deb9u1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

root@:~# ehforwarderbot
Traceback (most recent call last):
File "/usr/local/bin/ehforwarderbot", line 11, in
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/ehforwarderbot/main.py", line 202, in main
init()
File "/usr/local/lib/python3.6/dist-packages/ehforwarderbot/main.py", line 75, in init
conf = config.load_config()
File "/usr/local/lib/python3.6/dist-packages/ehforwarderbot/config.py", line 33, in load_config
channel = utils.locate_module(data['master_channel'], 'master')
File "/usr/local/lib/python3.6/dist-packages/ehforwarderbot/utils.py", line 134, in locate_module
return i.load()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2291, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2297, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/init.py", line 27, in
from .master_message import MasterMessageProcessor
File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/master_message.py", line 13, in
from moviepy.video.io.VideoFileClip import VideoFileClip
File "/usr/local/lib/python3.6/dist-packages/moviepy/video/io/VideoFileClip.py", line 3, in
from moviepy.video.VideoClip import VideoClip
File "/usr/local/lib/python3.6/dist-packages/moviepy/video/VideoClip.py", line 18, in
from ..config import get_setting
File "/usr/local/lib/python3.6/dist-packages/moviepy/config.py", line 35, in
FFMPEG_BINARY = get_exe()
File "/usr/local/lib/python3.6/dist-packages/imageio/plugins/ffmpeg.py", line 127, in get_exe
"Need ffmpeg exe. "
imageio.core.fetching.NeedDownloadError: Need ffmpeg exe. You can obtain it with either:

  • install using conda: conda install ffmpeg -c conda-forge
  • download using the command: imageio_download_bin ffmpeg
  • download by calling (in Python): imageio.plugins.ffmpeg.download()

Language Code of Chinese family

According to the newest standard, the language code scheme should be:
[Macro Language]-[Language]-[Script]-[Region Varient].
For example:
Mandarin written in Simplifed Chinese of mainland China: zh-cmn-Hans-CN
Mandarin written in Traditional Chinese of Hong Kong: zh-cmn-Hant-HK
Cantonese written in Simplifed Chinese of Taiwan: zh-yue-Hans-TW
Hakka language written in Simplifed Chinese of mainland China: zh-hak-Hans-CN

Parts can be ignore in case the information is not important.

In the case of speed recognition, we want to focus on the oral language, so we should use:
(zh-)cmn, (zh-)yue to represent Mandarin and Cantonese. If we want to control the output script used to write the language, script code(Hans, Hant) should also be added.

PS: at least, we should use yue instead of ct as the code for cantonese.

File transfer failed when file name contains non-ASCII characters.

Issue that exists in upstream library python-telegram-bot since 11.0.

The issue is now fixed in 12.0 beta, along with multiple compatibility changes.

Timeline

  • Include a workaround / notification to user.
  • ETM adopt to PTB 12.0 API
  • PTB finalizes their API for 12.0, and release stable version.
  • ETM release new version
  • Issue (properly) fixed.

Relevant traceback

2019-04-20 04:05:04,518 [ERROR]: efb_telegram_master.slave_message (slave_message.send_message; slave_message.py:214)
    [3454101684214458072] Error occurred while processing message from slave channel.
Message: [Redacted]
BadRequest()
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/efb_telegram_master/slave_message.py", line 149, in send_message
    tg_msg = self.slave_message_file(msg, tg_dest, msg_template, old_msg_id, target_msg_id, reply_markup)
  File "/usr/local/lib/python3.6/site-packages/efb_telegram_master/slave_message.py", line 418, in slave_message_file
    reply_markup=reply_markup)
  File "/usr/local/lib/python3.6/site-packages/efb_telegram_master/bot_manager.py", line 230, in caption_affix
    return fn(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/efb_telegram_master/bot_manager.py", line 342, in send_document
    return self.updater.bot.send_document(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/telegram/bot.py", line 65, in decorator
    result = func(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/telegram/bot.py", line 90, in decorator
    result = self._request.post(url, data, timeout=kwargs.get('timeout'))
  File "/usr/local/lib/python3.6/site-packages/telegram/utils/request.py", line 305, in post
    result = self._request_wrapper('POST', url, fields=data, **urlopen_kwargs)
  File "/usr/local/lib/python3.6/site-packages/telegram/utils/request.py", line 223, in _request_wrapper
    raise BadRequest(message)
telegram.error.BadRequest: Wrong url host

[ERROR]: telegram.ext.dispatcher (dispatcher.process_update; dispatcher.py:301)

出现了一个不影响使用的 error :


2019-04-09 13:03:39,298 [ERROR]: telegram.ext.dispatcher (dispatcher.process_update; dispatcher.py:301)
    An uncaught error was raised while processing the update
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/telegram/ext/dispatcher.py", line 279, in process_update
    handler.handle_update(update, self)
  File "/usr/local/lib/python3.6/site-packages/telegram/ext/commandhandler.py", line 173, in handle_update
    return self.callback(dispatcher.bot, update, **optional_args)
  File "/usr/local/lib/python3.6/site-packages/efb_telegram_master/commands.py", line 132, in extra_listing
    msg += "\n\n<b>%s %s (%s)</b>" % (i.channel_emoji, i.module_name, i.module_id)
AttributeError: 'WeChatChannel' object has no attribute 'module_name'

Conflicted polling detected

After update to 2.0.0b15. The bot repeat a message

Conflicted polling detected. If this error persists, please ensure you are running only one instance of this Telegram bot

However, message can be sended to wechat.

AttributeError: 'Message' object has no attribute 'message'

My coding skill is poor,I spent two hours to try solving this,But I failed.

The error message like this

ERROR]: telegram.ext.dispatcher (dispatcher.process_update; dispatcher.py:370)
    An uncaught error was raised while processing the update
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/telegram/ext/dispatcher.py", line 329, in process_update
    check = handler.check_update(update)
  File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/global_command_handler.py", line 34, in check_update
    res = self.filters(message)
  File "/usr/local/lib/python3.6/dist-packages/telegram/ext/filters.py", line 75, in __call__
    return self.filter(update)
  File "/usr/local/lib/python3.6/dist-packages/telegram/ext/filters.py", line 823, in filter
    return update.message is not None or update.edited_message is not None
AttributeError: 'Message' object has no attribute 'message'

Can you help me?
Thanks

Add support to message reactions

Interface

Receiving reaction updates

Append the message with box in fomat like [😄 , 👍 x3, 🤣x2]

Sending reaction updates

Reply to a message with /react <emoji> to send reaction. Reply with error message if the reaction is not possilbe

[BUG REPORT] ValueError: Deliver_to is not valid.

BUG description:

  • When:

It occurs when attempting to login WeChat.

  • Details:

Console logs ValueError: Deliver_to is not valid. after successfully logging in with QR code, while no Web-WeChat using status in WeChat app and the bot doesn't work.

Log:

.......................... upper logs has been ignored .....................................

Please scan the QR code to log in.
2018-04-22 12:18:18,281 [INFO]: itchat (login.login; login.py:50) 
    Please scan the QR code to log in.
2018-04-22 12:18:26,909 [Level 99]: plugins.blueset.wechat.WeChatChannel (__init__.console_qr_code; __init__.py:203) 
    Confirm on your phone.
Please press confirm on your phone.
2018-04-22 12:18:26,910 [INFO]: itchat (login.login; login.py:60) 
    Please press confirm on your phone.
2018-04-22 12:18:29,145 [Level 99]: plugins.blueset.wechat.WeChatChannel (__init__.console_qr_code; __init__.py:206) 
    Successfully logged in.
Loading the contact, this may take a little while.
2018-04-22 12:18:29,145 [INFO]: itchat (login.login; login.py:70) 
    Loading the contact, this may take a little while.
Login successfully as 
2018-04-22 12:18:29,206 [INFO]: itchat (login.login; login.py:80) 
    Login successfully as 
2018-04-22 12:18:29,212 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:87) 
     Slave channel WeChat Slave (blueset.wechat) # None is initialized. 
2018-04-22 12:18:29,212 [Level 99]: ehforwarderbot.__main__ (__main__.init; __main__.py:90) 
     Initializing master blueset.telegram... 
Traceback (most recent call last):
  File "/usr/local/bin/ehforwarderbot", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/__main__.py", line 190, in main
    init()
  File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/__main__.py", line 94, in init
    (instance_id=instance_id))
  File "/usr/local/lib/python3.6/site-packages/efb_telegram_master/__init__.py", line 124, in __init__
    self.db: DatabaseManager = DatabaseManager(self)
  File "/usr/local/lib/python3.6/site-packages/efb_telegram_master/db.py", line 20, in __init__
    self.db.connect()
  File "/usr/local/lib/python3.6/site-packages/peewee.py", line 2505, in connect
    self._state.set_connection(self._connect())
  File "/usr/local/lib/python3.6/site-packages/peewee.py", line 2737, in _connect
    raise ImproperlyConfigured('SQLite driver not installed!')
peewee.ImproperlyConfigured: SQLite driver not installed!
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.6/site-packages/itchat/components/login.py", line 281, in maintain_loop
    exitCallback()
  File "/usr/local/lib/python3.6/site-packages/efb_wechat_slave/__init__.py", line 286, in exit_callback
    coordinator.send_message(msg)
  File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/coordinator.py", line 103, in send_message
    msg.verify()
  File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/message.py", line 128, in verify
    raise ValueError("Deliver_to is not valid.")
**ValueError: Deliver_to is not valid.**

Environment:

1. System:

Linux VM-68-189-ubuntu 4.14.11-041411-generic #201801022143 SMP Tue Jan 2 21:44:21 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

2. Software version:

EH Forwarder Bot
Version: 2.0.0b10
Python version:
3.6.1 (default, Apr 22 2018, 09:34:19) 
[GCC 5.4.0 20160609]

Master channel:
    Telegram Master (blueset.telegram) 2.0.0b11 # Default profile

Slave channel:
    WeChat Slave (blueset.wechat) 2.0.0a12

Middlewares:
    No middleware is enabled.

Additional information(config files):

  • ~/.ehforwarderbot/profiles/default/config.yaml
master_channel: blueset.telegram
slave_channels:
- blueset.wechat
  • ~/.ehforwarderbot/profiles/default/blueset.telegram/config.yaml
token: "AAAAAAAAAAAAAAA:AAAAAAAAAAAAAAA"
admins:
- 111111111

# API tokens required for speech recognition
speech_api:
    # https://azure.microsoft.com/en-us/try/cognitive-services/
    bing: "VOICE_RECOGNITION_TOKEN"
    # http://yuyin.baidu.com/
    baidu:
        app_id: 1111111
        api_key: "AAAAAAAAAAAAAAA"
        secret_key: "AAAAAAAAAAAAAAA"


# Experimental Flags
flags:
    no_conversion: false
  • ~/.ehforwarderbot/profiles/default/blueset.wechat/config.yaml
flags:
    delete_on_edit: true

Thanks for your extraordinary work, @blueset .
Best.

ETM is asking for module_name from a channel.

2019-04-22 17:14:23,301 [ERROR]: telegram.ext.dispatcher (dispatcher.process_update; dispatcher.py:301)
    An uncaught error was raised while processing the update
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/telegram/ext/dispatcher.py", line 279, in process_update
    handler.handle_update(update, self)
  File "/usr/local/lib/python3.6/dist-packages/telegram/ext/commandhandler.py", line 173, in handle_update
    return self.callback(dispatcher.bot, update, **optional_args)
  File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/commands.py", line 132, in extra_listing
    msg += "\n\n<b>%s %s (%s)</b>" % (i.channel_emoji, i.module_name, i.module_id)
AttributeError: 'WeChatChannel' object has no attribute 'module_name'

Problems with markdown conversion from the user

  • Message w/o text / caption causes exceptions
  • Links not overridden with text should not be converted. issue

Instead of having monkey patch here, I'll try to send PR to PTB.

Monkey patching will be added If PR was not accepted by PTB.

Related feature is available at PTB, will fix in next version.

Doesn't delete original file after converting to GIF

From @xiadong1994 on December 27, 2017 2:25

When I send a saved GIF from Telegram, the filename extension is .mp4. The EFB will convert it to .gif and send to WeChat. After sending to WeChat, the .gif file will be deleted but the original .mp4 file is remained. I think the file should be deleted after converting in _download_gif function in plugins/eh_telegram_master/__init__.py.

Copied from original issue: ehForwarderBot/ehForwarderBot#105

Unable to send gif animation in telegram

I saw the following in the log file when I tried to send gif animation. Can someone explain what is wrong? Running ehForwarderBot on Ubuntu 17.04.

2018-04-01 18:24:15,251 [ERROR]: telegram.ext.dispatcher (dispatcher.process_update; dispatcher.py:301) 
    An uncaught error was raised while processing the update
  File "/usr/local/lib/python3.6/dist-packages/moviepy/decorators.py", line 22, in convert_masks_to_RGB
    return f(clip, *a, **k)
  File "/usr/local/lib/python3.6/dist-packages/moviepy/video/VideoClip.py", line 491, in write_gif
    dispose=dispose, colors=colors)
  File "<decorator-gen-12>", line 2, in write_gif
  File "/usr/local/lib/python3.6/dist-packages/moviepy/decorators.py", line 54, in requires_duration
    return f(clip, *a, **k)
  File "<decorator-gen-11>", line 2, in write_gif
  File "/usr/local/lib/python3.6/dist-packages/moviepy/decorators.py", line 137, in use_clip_fps_by_default
    return f(clip, *new_a, **new_kw)
  File "/usr/local/lib/python3.6/dist-packages/moviepy/video/io/gif_writers.py", line 184, in write_gif
    '-r', "%.02f"%fps, filename], **popen_params)
  File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1275, in _execute_child
    restore_signals, start_new_session, preexec_fn)
TypeError: expected str, bytes or os.PathLike object, not _TemporaryFileWrapper
2018-04-01 18:24:15,251 [ERROR]: telegram.ext.dispatcher (dispatcher.process_update; dispatcher.py:301)
    An uncaught error was raised while processing the update
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/telegram/ext/dispatcher.py", line 279, in process_update
    handler.handle_update(update, self)
  File "/usr/local/lib/python3.6/dist-packages/telegram/ext/messagehandler.py", line 169, in handle_update
    return self.callback(dispatcher.bot, update, **optional_args)
  File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/master_message.py", line 70, in msg_thread_creator
    threading.Thread(target=self.msg, args=(bot, update)).run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/master_message.py", line 108, in msg
    return self.process_telegram_message(bot, update)
  File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/master_message.py", line 325, in process_telegram_message
    m.file, m.mime, m.filename, m.path = self._download_gif(message.document)
  File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/master_message.py", line 440, in _download_gif
    VideoFileClip(path).write_gif(gif_file, program="ffmpeg")
  File "<decorator-gen-56>", line 2, in write_gif
  File "/usr/local/lib/python3.6/dist-packages/moviepy/decorators.py", line 54, in requires_duration
    return f(clip, *a, **k)
  File "<decorator-gen-55>", line 2, in write_gif
  File "/usr/local/lib/python3.6/dist-packages/moviepy/decorators.py", line 22, in convert_masks_to_RGB
    return f(clip, *a, **k)
  File "/usr/local/lib/python3.6/dist-packages/moviepy/video/VideoClip.py", line 491, in write_gif
    dispose=dispose, colors=colors)
  File "<decorator-gen-12>", line 2, in write_gif
  File "/usr/local/lib/python3.6/dist-packages/moviepy/decorators.py", line 54, in requires_duration
    return f(clip, *a, **k)
  File "<decorator-gen-11>", line 2, in write_gif
  File "/usr/local/lib/python3.6/dist-packages/moviepy/decorators.py", line 137, in use_clip_fps_by_default
    return f(clip, *new_a, **new_kw)
  File "/usr/local/lib/python3.6/dist-packages/moviepy/video/io/gif_writers.py", line 184, in write_gif
    '-r', "%.02f"%fps, filename], **popen_params)
  File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1275, in _execute_child
    restore_signals, start_new_session, preexec_fn)
TypeError: expected str, bytes or os.PathLike object, not _TemporaryFileWrapper

FreeBSD got error : AttributeError: 'NoneType' object has no attribute 'startswith'

I installed all the depends , and configured the .yaml ,the I run eFB,but got the following error

    from moviepy.video.VideoClip import VideoClip                                                       
  File "/usr/local/lib/python3.6/site-packages/moviepy/video/VideoClip.py", line 18, in <module>        
    from ..config import get_setting                                                                    
  File "/usr/local/lib/python3.6/site-packages/moviepy/config.py", line 35, in <module>                 
    FFMPEG_BINARY = get_exe()                                                                           
  File "/usr/local/lib/python3.6/site-packages/imageio/plugins/ffmpeg.py", line 104, in get_exe         
    if plat.startswith("win"):                                                                          
AttributeError: 'NoneType' object has no attribute 'startswith'                                         
Error in atexit._run_exitfuncs:                                                                         
Traceback (most recent call last):                                                                      
  File "/usr/local/lib/python3.6/site-packages/ehforwarderbot/__main__.py", line 48, in stop_gracefully 
    if isinstance(coordinator.master, EFBChannel):                                                      
AttributeError: module 'ehforwarderbot.coordinator' has no attribute 'master'   

Why I got “ if plat.startswith("win"): ” , but I am on freebsd os

Currently does not support multiple 'admin'

Currently does not support multiple 'admin'

For example, I want everyone in my tg group to send messages through my bot.

Can I add multiple 'admin's via '|'?

Or delete 'admin'

'PhotoSize' object has no attribute 'msg_type'

File: <tempfile._TemporaryFileWrapper object at 0x7fcf9c5b0390> (None @ /tmp/tmpfcyd0592), image/jpeg; Vendor: {}>
AttributeError("'PhotoSize' object has no attribute 'msg_type'",)
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/efb_telegram_master/slave_message.py", line 202, in send_message
mime=attachment.msg_type)
AttributeError: 'PhotoSize' object has no attribute 'msg_type'

Something wrong with the linked chat

After linking a chat to a group successfully, it doesn't work. When the chat sends a new message, it can't forward to the group and shows the following error:

BadRequest()
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/efb_telegram_master/slave_message.py", line 138, in send_message
tg_msg = self.slave_message_file(msg, tg_dest, msg_template, old_msg_id, target_msg_id, reply_markup)
File "/usr/local/lib/python3.6/site-packages/efb_telegram_master/slave_message.py", line 374, in slave_message_file
reply_markup=reply_markup)
File "/usr/local/lib/python3.6/site-packages/efb_telegram_master/bot_manager.py", line 201, in caption_affix
return fn(self, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/efb_telegram_master/bot_manager.py", line 312, in send_document
return self.updater.bot.send_document(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/telegram/bot.py", line 65, in decorator
result = func(self, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/telegram/bot.py", line 90, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "/usr/local/lib/python3.6/site-packages/telegram/utils/request.py", line 305, in post
result = self._request_wrapper('POST', url, fields=data, **urlopen_kwargs)
File "/usr/local/lib/python3.6/site-packages/telegram/utils/request.py", line 223, in _request_wrapper
raise BadRequest(message)
telegram.error.BadRequest: Wrong url host

Operating system: | Centos 7 x86_64 bbr

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.