maskray / telegramircd Goto Github PK
View Code? Open in Web Editor NEWControl Telegram user account with IRC
License: Apache License 2.0
Control Telegram user account with IRC
License: Apache License 2.0
First of all, thank you for the awesome piece of software! This is perfect for my needs. Was amazed telegramircd to support converting images, stickers and videos to urls, magnificent! Is it possible for telegramircd to support animated stickers (.TGS) as well? Currently they show up as [MessageMediaUnsupported] {'_': 'MessageMediaUnsupported'}
whic is not bad, but I'm curious anyway.
Traceback (most recent call last):
File "/home/USERNAME/.local/lib/python3.5/site-packages/telethon/update_state.py", line 119, in _worker_loop
handler(update)
File "./telegramircd.py", line 2011, in on_telegram_update
getattr(TelegramUpdate, name)(self, update)
File "./telegramircd.py", line 1666, in UpdateNewChannelMessage
server.on_telegram_update_message(update, update.message)
File "./telegramircd.py", line 2056, in on_telegram_update_message
text = '[{}] {}'.format(type(msg.media).name, msg.media.to_dict())
TypeError: 'str' object is not callable
你好。
当我运行./telegramircd.py时,报错:
INFO: 127.0.0.1 - - [06/Dec/2016:09:21:22 +0000] "GET /app.js HTTP/1.1" 200 3143478 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/53.0.2785.143 Chrome/53.0.2785.143 Safari/537.36"
INFO: WebSocket client connected from ('127.0.0.1', 60470)
ERROR: Error handling request
Traceback (most recent call last):
File "/home/kin/.local/lib/python3.5/site-packages/aiohttp/server.py", line 265, in start
yield from self.handle_request(message, payload)
File "/home/kin/.local/lib/python3.5/site-packages/aiohttp/web.py", line 96, in handle_request
resp = yield from handler(request)
File "./telegramircd.py", line 66, in handle_web_socket
Server.instance.on_websocket(data)
File "./telegramircd.py", line 1602, in on_websocket
client.on_websocket(data)
File "./telegramircd.py", line 1377, in on_websocket
getattr(SpecialCommands, command)(self, data)
File "./telegramircd.py", line 478, in room
room = client.ensure_special_room(record)
File "./telegramircd.py", line 1134, in ensure_special_room
assert isinstance(record['flags'], int)
KeyError: 'flags'
I'm using branch master
(commit 5b84bbf9f08032a8ab6517dfa3e9f47fe9f6b28a
) of telegramircd and version 0.16.2.2 of telethon (obtained by pip3 install telethon
). (Edit: I updated telethon to 0.16.2.3, but the bug remains.)
Whenever someone sends an image with a caption, my IRC client only gets the image url created by telecramid, not the caption. Whenever someone sends a message containing an URL, I only get or the webpage and its title information, not the full message.
Examples:
This is what Telegram web client shows for image with caption: https://i.imgur.com/5telBU6.png
But my IRC client only shows: 13:23:33 <xx> [photo] https://[xx]/document/2.jpg
Telegram web for a message containing a URL: https://i.imgur.com/yQQAV8j.png
IRC: 13:30:18 <xx> [WebPage] https://github.com/MaskRay/telegramircd MaskRay/telegramircd
When I set join: all
, it doesn't autojoin to all channels on connect.
The only part of the code referring to this option is lines 1956-1957 where a nonexistent function Server.auto_join()
is called. This gives an error.
Traceback (most recent call last):
File "telegramircd.py", line 313, in init
await web.channel_list()
File "telegramircd.py", line 288, in channel_list
server.ensure_special_room(data)
File "telegramircd.py", line 1957, in ensure_special_room
self.auto_join(room)
AttributeError: 'Server' object has no attribute 'auto_join'
So:
self.auth_clients()
and calling client.auto_join
for each client.options.join=='all'
. (Currently apparently the user can ensure this function is called by the IRC command /list
but that's not what this option is supposed to do.)If anyone quotes a post you made, at least in a supergroup, the 'Re: USERNAME, MESSAGE' part comes up not referencing the post others are quoting.
I am trying to run using python3.8 but I keep running into this
telegramircd.py:135: DeprecationWarning: Application.make_handler(...) is deprecated, use AppRunner API instead self.handler = self.app.make_handler() telegramircd.py:111: RuntimeWarning: coroutine 'TelegramBaseClient.connect' was never awaited self.proc.connect() RuntimeWarning: Enable tracemalloc to get the object allocation traceback Traceback (most recent call last): File "telegramircd.py", line 294, in init web.get_self() File "telegramircd.py", line 290, in get_self server.user_id = data.id AttributeError: 'coroutine' object has no attribute 'id' telegramircd.py:298: RuntimeWarning: coroutine 'UserMethods.get_me' was never awaited traceback.print_exc() RuntimeWarning: Enable tracemalloc to get the object allocation traceback
I've tried older versions of aiohttp but have no luck. Any ideas?
For some reason it just suddenly died.
e', 'type': 'm', 'location': {'_': 'FileLocation', 'dc_id': 4, 'volume_id': 400187400703, 'local_id': 84341, 'secret': -73309301113771800}, 'w': 320, 'h': 168, 'size': 12482}, {'_': 'PhotoSize', 'type': 'x', 'location': {'_': 'FileLocation', 'dc_id': 4, 'volume_id': 400187400703, 'local_id': 84342, 'secret': -3508359373354518116}, 'w': 800, 'h': 420, 'size': 46335}, {'_': 'PhotoSize', 'type': 'y', 'location': {'_': 'FileLocation', 'dc_id': 4, 'volume_id': 400187400703, 'local_id': 84343, 'secret': -2226223468058160481}, 'w': 1200, 'h': 630, 'size': 68430}], 'has_stickers': False}, 'embed_url': None, 'embed_type': None, 'embed_width': None, 'embed_height': None, 'duration': None, 'author': None, 'document': None, 'cached_page': None}
WARNING: socket.send() raised exception.
WARNING: socket.send() raised exception.
WARNING: socket.send() raised exception.
WARNING: socket.send() raised exception.
WARNING: socket.send() raised exception.
WARNING: socket.send() raised exception.
WARNING: socket.send() raised exception.
WARNING: socket.send() raised exception.
Started to work again by force-killing the process manually with kill <pid>
and starting again. python3 --version
:
Python 3.6.9. Ubuntu 18.04.5 LTS.
Below is the dump from the program:
INFO: [IRC NAME]![HOSTNAME]@127.0.0.1 registered
ERROR: Task exception was never retrieved
future: <Task finished coro=<Web.handle_telegram_cli() done, defined at /home/[USERNAME]/git/telegramircd/telegramircd.py:106> exception=AttributeError("'Web' object has no attribute 'message'",)>
Traceback (most recent call last):
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/home/[USERNAME]/git/telegramircd/telegramircd.py", line 132, in handle_telegram_cli
Server.instance.on_telegram_cli(data)
File "/home/[USERNAME]/git/telegramircd/telegramircd.py", line 1717, in on_telegram_cli
client.on_telegram_cli(data)
File "/home/[USERNAME]/git/telegramircd/telegramircd.py", line 1515, in on_telegram_cli
getattr(SpecialCommands, name)(self, data)
File "/home/[USERNAME]/git/telegramircd/telegramircd.py", line 595, in message
client.ensure_special_room(data['to']).on_telegram_cli_message(data)
File "/home/[USERNAME]/git/telegramircd/telegramircd.py", line 1143, in on_telegram_cli_message
irc_message(self.client, sender, self.name, self, data)
File "/home/[USERNAME]/git/telegramircd/telegramircd.py", line 291, in irc_message
del web.message[msg['id']]
AttributeError: 'Web' object has no attribute 'message'
I know it might be out of scope for you, but I would be greatly appreciative if there was an English translation of the README file.
In my groups, I see two users, [USERNAME] and [USERNAME]1
Whenever I post in a group, on my IRC client it double posts, with my reply being posted by both [USERNAME] and [USERNAME]1.
The double post does not occur in the actual chat room on Telegram, checked with Telegram Web and only one post was showing.
After receiving an image file (doesn't seem to happen for gifs), the server will hang with this error:
May 16 19:00:55 vps-c41f521a python3[306830]: Downloading file in chunks of 131072 bytes
May 16 19:00:55 vps-c41f521a python3[306830]: 127.0.0.1 [16/May/2021:19:00:55 +0000] "GET /document/1.jpg HTTP/1.0" 500 207 "-" "Mozilla/5.0 (compatible; The Lounge IRC Client; +https://github.com/thelounge/thelounge) facebookexternalhit/>
May 16 19:01:10 vps-c41f521a python3[306830]: Downloading file in chunks of 131072 bytes
May 16 19:01:10 vps-c41f521a python3[306830]: Unhandled exception while processing TLMessage(msg_id=6962965205144311809, seq_no=95, obj=RpcResult(req_msg_id=6962965204889086836, body=None, error=RpcError(error_code=406, error_message='FIL>
Traceback (most recent call last):
File "/home/telegramircd/.local/lib/python3.8/site-packages/telethon/network/mtprotosender.py", line 486, in _recv_loop
self._process_message(message)
File "/home/telegramircd/.local/lib/python3.8/site-packages/telethon/network/mtprotosender.py", line 506, in _process_message
handler(message)
File "/home/telegramircd/.local/lib/python3.8/site-packages/telethon/network/mtprotosender.py", line 528, in _handle_rpc_result
error = rpc_message_to_error(rpc_result.error)
File "/home/telegramircd/.local/lib/python3.8/site-packages/telethon/errors/__init__.py", line 70, in rpc_message_to_error
return cls(rpc_error.error_message)
File "/home/telegramircd/.local/lib/python3.8/site-packages/telethon/errors/rpcbaseerrors.py", line 76, in __init__
super().__init__(message)
TypeError: __init__() missing 1 required positional argument: 'message'
The server still sends out messages from Telegram, but cannot send them if you try to send a message via IRC. The HTTP server also hangs. This does not stop until a restart, making this a very big problem. Any idea what's wrong here? Perhaps a telegram library needs to be upgraded?
I am running the server like this:
~/telegramircd$ ./telegramircd.py -c config
./telegramircd.py:111: RuntimeWarning: coroutine 'TelegramBaseClient.connect' was never awaited
self.proc.connect()
Traceback (most recent call last):
File "./telegramircd.py", line 294, in init
web.get_self()
File "./telegramircd.py", line 290, in get_self
server.user_id = data.id
AttributeError: 'coroutine' object has no attribute 'id'
./telegramircd.py:298: RuntimeWarning: coroutine 'UserMethods.get_me' was never awaited
traceback.print_exc()
INFO: [email protected] registered
I am able to connect to it via WeeChat and join #telegram, but nothing happens past that. I don't receive the code for oper. Is there any additional logging I could collect to figure out what's wrong?
Currently there's not any easy way to locate pinned messages after they're posted, one solution could be to change the IRC room description to match whatever's pinned
When running 'python3 ./telegramircd.py'
File "telegramircd.py", line 57
async def send_command(self, command, timeout=None):
^
SyntaxError: invalid syntax
Installed the dependencies and followed the instructions in the readme and this still occurs, on Ubuntu 14.04.
Been getting this problem recently, if someone posts an image it no longer shows.
e.g. [<class 'type'>] https://MYSERVERADDRESS/document/0
After updating to the latest build, I'm getting an issue where every time I reset the daemon and connect to it for the first time again, it adds a list of my groups, but it adds them as users instead of channels, and when it starts fetching messages from those groups, it just creates new channels leaving the ones created at the initialisation and it fills up my room list with duplicates.
Getting a few errors in my lists, the service seems to do this at launch now.
If needed I can supply the full traceback with names redacted.
I updated and ran with the new command, but my groups and channels don't load. When Quassel tries to auto join, it errors 'No such channel', and even when people post in the groups and channels I'm part of nothing comes through on IRC.
Hello.
I found a problem that the program init will be failed if the account's 2FA is enabled.
When entering the login code, the program will be restarted without any notification for entering 2FA password. The error log is there:
Traceback (most recent call last):
File "telegramircd.py", line 658, in oper
ok = web.proc.sign_in(options.tg_phone, password)
File "/lib/python3.5/site-packages/telethon/telegram_client.py", line 435, in sign_in
result = self(SignInRequest(phone, phone_code_hash, str(code)))
File "/lib/python3.5/site-packages/telethon/telegram_bare_client.py", line 461, in __call__
result = self._invoke(call_receive, *requests)
File "/lib/python3.5/site-packages/telethon/telegram_bare_client.py", line 558, in _invoke
raise next(x.rpc_error for x in requests if x.rpc_error)
telethon.errors.rpc_error_list.SessionPasswordNeededError: Two-steps verification is enabled and a password is required
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "telegramircd.py", line 1560, in handle_irc
self.handle_command(command, args)
File "telegramircd.py", line 1516, in handle_command
fn(*ba.args)
File "telegramircd.py", line 661, in oper
except SessionPasswordNeededError:
NameError: name 'SessionPasswordNeededError' is not defined
Links show as 'MYSERVERDOMAIN:9003/document/id' but with no file type appended to the end.
In Firefox 57 I get 'The Image can't be displayed because it contains errors', and it tries to parse it as a JPEG.
When a received link has Telegram preview, it displays incorrectly and URL is not shown. For example:
[webpage] {'webpage': {'id': 1616137859779238602, 'date': datetime.datetime(2018, 1, 12, 13, 12, 35)}}
I've noticed that you can run Chromium in a headless (no GUI) mode now which would make this application a lot more portable.
https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
Would it be possible to somehow integrate this library into your project? That would eliminate the need for a desktop client to have the web.telegram.com webpage open all the time.
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.