tuna / fishroom Goto Github PK
View Code? Open in Web Editor NEWMessage forwarding for multiple IM protocols
License: GNU General Public License v3.0
Message forwarding for multiple IM protocols
License: GNU General Public License v3.0
https://github.com/tuna/fishroom/blob/master/fishroom/telegram.py#L281 and #L297
self.file_store == None
results in instant crash.
Matrix.org seems to share the same dream with fishroom.
I tried the nickname /w \
after seeing \u
posting messages. Fishroom web got unhappy, and so did I.
w\
works, so.. why are you killing slashes?
Fishroom is a api-based bot on Telegram so it cannot see other bots message. Of cause it cannot forward it. It is necessary to send command messages which IRC and other platform not be able to recognize it?
😂 就是光给 IRC 发个 Telegram bot 命令的消息并没有啥用……
config.py
relevant part:
'gitter': {
'token': '',
'me': '', # bot username
},
'bindings': {
"channelname": {
"irc": '#somechannel',
"telegram": '-12345678',
"xmpp": ''
}
}
Traceback (most recent call last):
File "/srv/http/fishroom/fishroom/fishroom.py", line 278, in wrapper
f(*args, **kwargs)
File "/srv/http/fishroom/fishroom/gitter.py", line 151, in GitterThread
gt.listen_message_stream()
File "/srv/http/fishroom/fishroom/gitter.py", line 140, in listen_message_stream
asyncio.wait(tasks, return_when=asyncio.FIRST_EXCEPTION)
File "/usr/lib64/python3.5/asyncio/base_events.py", line 337, in run_until_complete
return future.result()
File "/usr/lib64/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
File "/usr/lib64/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/usr/lib64/python3.5/asyncio/tasks.py", line 332, in wait
raise ValueError('Set of coroutines/Futures is empty.')
ValueError: Set of coroutines/Futures is empty.
If I add a gitter
key to bindings
:
'bindings': {
"channelname": {
"irc": '#somechannel',
"telegram": '-12345678',
"xmpp": '',
"gitter": ''
}
}
Still crash but this time a different stack trace:
Traceback (most recent call last):
File "/srv/http/fishroom/fishroom/fishroom.py", line 278, in wrapper
f(*args, **kwargs)
File "/srv/http/fishroom/fishroom/gitter.py", line 151, in GitterThread
gt.listen_message_stream()
File "/srv/http/fishroom/fishroom/gitter.py", line 144, in listen_message_stream
raise d.exception()
File "/usr/lib64/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/srv/http/fishroom/fishroom/gitter.py", line 66, in fetch
msg = self.parse_jmsg(room, json.loads(line))
File "/srv/http/fishroom/fishroom/gitter.py", line 76, in parse_jmsg
from_user = jmsg['fromUser']['username']
KeyError: 'fromUser'
Traceback (most recent call last):
File "/root/fishroom/fishroom/runner.py", line 37, in wrapper
f(*args, **kwargs)
File "/root/fishroom/fishroom/telegram.py", line 692, in Telegram2FishroomThread
for msg in tg.message_stream(id_blacklist=tele_me):
File "/root/fishroom/fishroom/telegram.py", line 540, in message_stream
telemsg = self.parse_jmsg(jmsg)
File "/root/fishroom/fishroom/telegram.py", line 372, in parse_jmsg
url, err = self.upload_sticker(file_id)
File "/root/fishroom/fishroom/telegram.py", line 284, in upload_sticker
photo = webp2png(sticker)
File "/root/fishroom/fishroom/helpers.py", line 50, in webp2png
im.save(out, "PNG")
File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 1895, in save
self.load()
File "/usr/local/lib/python3.6/dist-packages/PIL/ImageFile.py", line 205, in load
seek(offset)
ValueError: I/O operation on closed file.
When the users from telegram send long messages, the long message link to irc becomes strange.
screeshot
The search of telegram is not usable.
Assuming I want to connect #debian-cn, #debiancn and telegram group, Dose fishroom support this?
CoolQ have Python API now
https://github.com/yukixz/qqbot.py
Room not found
e.g:
< forwarded from 欧洲德国贤狼赫萝😋(🍎🐈🐑*)>
=> < forwarded from KenOokamiHoro>
Can telegram bot get the ID of forwarded message sender?
RT. It would be great if there is a irc.password config and if set, the bot shall do automatic /msg nickserv identify pwd
.
redis是用apt install redis-server 安装的,config.py中redis的host改成了127.0.0.1,之前的步骤都没有报错
启动fishroom.fishroom的回显是:
root@hostker:~/fishroom# python3 -m fishroom.fishroom
[fishroom.command] [INFO] command `help` registered
[fishroom.command] [INFO] command `pia` registered
[fishroom.command] [INFO] command `mua` registered
[fishroom.command] [INFO] command `imglink` registered
[fishroom.command] [INFO] command `vote` registered
[fishroom.command] [INFO] command `hualao` registered
然后尝试启动fishroom.web出现错误
root@hostker:~/fishroom# python3 -m fishroom.web
[fishroom.command] [INFO] command `help` registered
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/root/fishroom/fishroom/web/__main__.py", line 30, in <module>
main()
File "/root/fishroom/fishroom/web/__main__.py", line 24, in main
application.listen(config['chatlog']['port'],address=config['chatlog'].get('host', '0.0.0.0'))
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 1944, in listen
server.listen(port, address)
File "/usr/local/lib/python3.5/dist-packages/tornado/tcpserver.py", line 142, in listen
sockets = bind_sockets(port, address=address)
File "/usr/local/lib/python3.5/dist-packages/tornado/netutil.py", line 156, in bind_sockets
0, flags)):
File "/usr/lib/python3.5/socket.py", line 732, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
Maillist is more suitable for searching and history.
How about sending messages of one day as digest to maillist.
crashing example: \x16Reverse
redesign irclog.tuna.moe
implement command handling
RT
The message listing should contain new messages received in (2).
The browser displays a stale log from (1). F5 fixes the issue.
% curl -vvv https://cdn.bootcss.com/jquery/2.1.4/jquery.min.js
* Trying 183.158.35.38...
* TCP_NODELAY set
* Connected to cdn.bootcss.com (183.158.35.38) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=cdn.bootcss.com
* start date: Sep 11 23:03:00 2017 GMT
* expire date: Dec 10 23:03:00 2017 GMT
* subjectAltName: host "cdn.bootcss.com" matched cert's "cdn.bootcss.com"
* issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x55864e39ecf0)
> GET /jquery/2.1.4/jquery.min.js HTTP/2
> Host: cdn.bootcss.com
> User-Agent: curl/7.55.1
> Accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 403
< server: marco/1.8
< date: Sat, 30 Sep 2017 03:25:19 GMT
< content-type: text/html
< content-length: 166
< via: M.ctn-zj-lna3-017
< x-request-id: efb713767ee700467507c23beee11b24
<
<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>marco/1.8</center>
</body>
</html>
* Connection #0 to host cdn.bootcss.com left intact
% date
2017年 09月 30日 星期六 11:26:32 CST
Use mIRC color format. http://www.mirc.com/colors.html
I tested it on Quassel, Weechat, Hexchat, Pidgin, https://irc.tuna.moe/
Traceback (most recent call last):
File "/root/fishroom/fishroom/runner.py", line 37, in wrapper
f(*args, **kwargs)
File "/root/fishroom/fishroom/wechat.py", line 230, in Fishroom2WechatThread
myid_chn = config[msg.channel].get("me")
KeyError: 'web'
@mytbk
On #archlinux-cn, the results of replying to someone can be highly annoying, if the replied message contains a command, e.g. 'google
(varia bot).
It would be great if users can supply functions to filter the thing...
https://dev.botframework.com/
加入 skype 支持
It makes me see the new message only if I scroll down page manually.
https://github.com/tuna/fishroom/blob/master/fishroom/web/chat_log.html#L108
Payload: http://aaa\"onmouseover=\"alert(1)
translate telegram reply to nick:
representation for IRC/Web/XMPP
This is needed to let IRC people play with nice speaking bots like orzdigbot.
建议增加teleboto的一个功能,使用户可以指定某些消息只显示在telegram群里,但不被web版记录。
比如让/mask 你的牙缝里有片菜叶
不显示在fishroom里,但是telegram里可以看到。
另外,或许要考虑发图片,@wiki,我有颜色
,@ bing 等功能的实现。
It should be idempotent instead.
See https://fishroom.tuna.moe/log/archlinux-cn/2016-04-18/2152 for details. br and < can be seen.
use logger!
When we send an image in Telegram together with description, the description part would be discarded by fishroom.
This should be a bug.
README.md says "Ensure your python version is at least 3.4". However, Python 3.4.3 from Ubuntu 14.04 cannot run fishroom.
In fishroom/bus.py, there is an import typing
, which is new in version Python 3.5.
https://docs.python.org/3/library/typing.html
Also I have the following error when running the latest git code.
root@redis-512mb-sfo1-01:~/fishroom# python3 -m fishroom.fishroom
Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/root/fishroom/fishroom/fishroom.py", line 8, in <module>
from .base import EmptyBot
File "/root/fishroom/fishroom/base.py", line 73
raw=msg, **msg.opt,
^
SyntaxError: invalid syntax
In case of screen flush in IRC
It seems that the via foo
display on log pages (e.g. https://fishroom.tuna.moe/log/archlinux-cn/today) takes a lot of space on the web page by creating a lot of one-line blanks (with nothing but the via foo
info).
Applying display: none
to this class in F12 as a dirty hack improves chatting experience substantially in a relatively small window (uh-oh).
print traceback of crashes
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.