rahiel / telegram-send Goto Github PK
View Code? Open in Web Editor NEWSend messages and files over Telegram from the command-line.
Home Page: https://www.rahielkasim.com/telegram-send/
License: GNU General Public License v3.0
Send messages and files over Telegram from the command-line.
Home Page: https://www.rahielkasim.com/telegram-send/
License: GNU General Public License v3.0
For example, $ telegram-send "hello before you get up!" --mute; would not ring a bell on the recipient phone side.
Hi, it's possible to send a same message in each group where the bot was added?
The script throws an error after the bot's password is entered
telegram-send is now ready for use!
Traceback (most recent call last):
File "c:\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python36\Scripts\telegram-send.exe\__main__.py", line 9, in <module>
File "c:\python36\lib\site-packages\telegram_send.py", line 55, in main
return configure(args.conf, fm_integration=True)
File "c:\python36\lib\site-packages\telegram_send.py", line 207, in configure
with open(conf, 'w') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\alex.bokhankovich\\AppData\\Local\\telegram-send\\telegram-send.conf'
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32
Hi!
I was wondering if this is possible.
telegram-send --file /path/to/files/*.*
or
telegram-send --file /path/to/files/*.txt
(for example)
Thank you!
Hello,
I would love to be able to send an image file uncompressed, then the compressed version immediately after with one command.
Replace usage of telegram.Emoji
with literal emoji string here.
I am trying to send an image with telegram-send. The message sending works fine, but I can't find any details in the documentation about how to send images. The signature indicates that it is expecting a file
, whatever that means.
import telegram_send
telegram_send.send(["message"], images=[what_to_put_here])
I've tried with the following options, but none of these work:
import base64
from PIL import Image
# Open image with Pillow
image = Image.open('2017-06-22_vgg4_99.9p.png')
telegram_send.send(["message"], images=[image])
# Serialize into bytes
imageBytes = image.tobytes()
telegram_send.send(["message"], images=[imageBytes])
# Encode with base64
imageBase64 = base64.encodebytes(imageBytes)
telegram_send.send(["message"], images=[imageBase64])
# Just open a file and try that
f = open('2017-06-21_vgg_staff74_192x96_Adadelta.txt')
telegram_send.send(["message"], images=[f])
I am getting either telegram.error.BadRequest: Wrong persistent file_id specified: wrong string length
or something like TypeError: <PIL.PngImagePlugin.PngImageFile image mode=RGBA size=800x600 at 0x19D5281EE48> is not JSON serializable
.
I actually found the answer here: https://github.com/python-telegram-bot/python-telegram-bot/wiki/Code-snippets#post-an-image-from-memory
Now my code looks like this:
from PIL import Image
from io import BytesIO
image_path = 'MyFile.png'
byteStream = BytesIO()
byteStream.name = image_path
image = Image.open(image_path)
image.save(byteStream, "png")
byteStream.seek(0)
telegram_send.send([message], parse_mode="Markdown", images=[byteStream])
I believe this deserves at least a place in the documentation. Actually it would be even better, if the telegram_send.send()
-method would accept Pillow
-images and do this conversion into a byte-stream internally.
I started getting this weird error:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/telegram_send.py", line 127, in main
timeout=args.timeout
File "/usr/local/lib/python3.7/dist-packages/telegram_send.py", line 195, in send
request = telegram.utils.request.Request(read_timeout=timeout)
AttributeError: module 'telegram' has no attribute 'utils'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/telegram-send", line 10, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/dist-packages/telegram_send.py", line 136, in main
except telegram.error.NetworkError as e:
AttributeError: module 'telegram' has no attribute 'error'
Been trying to use telegram-send to send videos from a directory, however it will not work for larger files no matter how much I increase the arguments.
I was able to send 1MB and 5MB videos (had to add timeout for the 5MB). But when trying to send a 13MB video command errors out. I have even added something like
--timeout 99999999999999999999999999999999999
and still won't work. It keeps saying to increase it further?
The limit is 50MB so I'm not sure why this is happening
Hi,
bot added to the group doesn't show messages send to it. However, personally it shows, but only for the first recipient.
P.S. /setprivacy disabled just in case.
It's hard to say (sorry, can't see it again) how big message was to reproduce the issue, but I'm sure if to send a big amount of text (e.g. wiki page) it will rise the error like this:
Traceback (most recent call last): File "/usr/local/bin/telegram-send", line 11, in sys.exit(main()) File "/usr/local/lib/python3.4/dist-packages/telegram_send.py", line 70, in main send(messages=args.message, conf=args.conf, parse_mode=args.parse_mode, files=args.file, images=args.image, captions=args.caption) File "/usr/local/lib/python3.4/dist-packages/telegram_send.py", line 112, in send bot.send_message(chat_id=chat_id, text=m, parse_mode=parse_mode) File "/usr/local/lib/python3.4/dist-packages/telegram/bot.py", line 125, in decorator result = func(self, *args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/telegram/bot.py", line 158, in decorator return Bot._message_wrapper(self, url, data, *args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/telegram/bot.py", line 146, in _message_wrapper result = self._request.post(url, data, timeout=kwargs.get('timeout')) File "/usr/local/lib/python3.4/dist-packages/telegram/utils/request.py", line 246, in post **urlopen_kwargs) File "/usr/local/lib/python3.4/dist-packages/telegram/utils/request.py", line 188, in _request_wrapper raise BadRequest(message) telegram.error.BadRequest: Message is too long
Thanks for the project, everything works perfect.
Is there a possibility to start 2-3 bots on same pc ?
Can i define api in python script ?
Anyway to send telegram stickers?
Hi there, and first thank you for this great tool.
When trying to either import or run telegram-send
from the terminal, it cannot find the module version
(is it the telegram-cli.version
module that should be imported here ?):
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/private/tmp/venv/lib/python3.7/site-packages/telegram_send.py", line 34, in <module>
from version import __version__
ModuleNotFoundError: No module named 'version'
Installation through pip (inside a python 3 virtualenv) using:
pip install telegram-send
OS/version:
You need to add dependencies that you check during build to setup_requires
.
I installed telegram-send into Ubuntu 16.04 box using the command:
sudo pip3 install telegram-send
The directory '/home/jk/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/jk/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting telegram-send
Downloading https://files.pythonhosted.org/packages/3c/d8/03c1e644fd5e7cb4d12506178fbf27cbfc3f0449c839a41f7cf349b05d6b/telegram_send-0.20-py2.py3-none-any.whl
Collecting colorama (from telegram-send)
Downloading https://files.pythonhosted.org/packages/db/c8/7dcf9dbcb22429512708fe3a547f8b6101c0d02137acbd892505aee57adf/colorama-0.3.9-py2.py3-none-any.whl
Collecting python-telegram-bot>=5.0 (from telegram-send)
Downloading https://files.pythonhosted.org/packages/f1/51/d1bd383522c12b313eddd7b97b8e7d6cd2a8e3b44b8ff3c88e4a7b045cc8/python_telegram_bot-10.1.0-py2.py3-none-any.whl (298kB)
100% |████████████████████████████████| 307kB 1.9MB/s
Collecting appdirs (from telegram-send)
Downloading https://files.pythonhosted.org/packages/56/eb/810e700ed1349edde4cbdc1b2a21e28cdf115f9faf263f6bbf8447c1abf3/appdirs-1.4.3-py2.py3-none-any.whl
Collecting certifi (from python-telegram-bot>=5.0->telegram-send)
Downloading https://files.pythonhosted.org/packages/df/f7/04fee6ac349e915b82171f8e23cee63644d83663b34c539f7a09aed18f9e/certifi-2018.8.24-py2.py3-none-any.whl (147kB)
100% |████████████████████████████████| 153kB 3.3MB/s
Collecting future>=0.16.0 (from python-telegram-bot>=5.0->telegram-send)
Downloading https://files.pythonhosted.org/packages/00/2b/8d082ddfed935f3608cc61140df6dcbf0edea1bc3ab52fb6c29ae3e81e85/future-0.16.0.tar.gz (824kB)
100% |████████████████████████████████| 829kB 1.3MB/s
Installing collected packages: colorama, certifi, future, python-telegram-bot, appdirs, telegram-send
Running setup.py install for future ... done
Successfully installed appdirs-1.4.3 certifi-2018.8.24 colorama-0.3.9 future-0.16.0 python-telegram-bot-10.1.0 telegram-send-0.20
You are using pip version 8.1.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
When I try to run telegram-send I get:
jk@mypc:~$ telegram-send
Traceback (most recent call last):
File "/usr/local/bin/telegram-send", line 7, in <module>
from telegram_send import main
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 661, in exec_module
File "<frozen importlib._bootstrap_external>", line 766, in get_code
File "<frozen importlib._bootstrap_external>", line 818, in get_data
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/telegram_send.py'
jk@mypc:~$ ls -al /usr/local/lib/python3.5/dist-packages/telegram_send.py
-rw-r----- 1 root staff 17633 elo 28 09:26 /usr/local/lib/python3.5/dist-packages/telegram_send.py
Are these normal permissions after install?
When I run sudo telegram-send, it seems to work:
jk@mypc:~$ sudo telegram-send
[sudo] password for jk:
Config not found
Please run: telegram-send --configure
I run
sudo chmod 644 /usr/local/lib/python3.5/dist-packages/telegram_send.py
And then try again
jk@mypc:~$ telegram-send
Traceback (most recent call last):
File "/usr/local/bin/telegram-send", line 7, in <module>
from telegram_send import main
File "/usr/local/lib/python3.5/dist-packages/telegram_send.py", line 29, in <module>
from telegram.constants import MAX_MESSAGE_LENGTH
ImportError: No module named 'telegram.constants'
So it seems that chmoding /usr/local/lib/python3.5/dist-packages/telegram_send.py does not help.
How to fix this?
When I try telegram-send --configure
, It gives the following prompt, to which I enter the key generated from the BotFather:
Talk with the BotFather on Telegram (https://telegram.me/BotFather), create a bot and insert the token
❯ Number:Key
However. I get the following error messages:
Something went wrong, please try again.
Traceback (most recent call last):
ConnectionResetError: [Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
telegram.vendor.ptb_urllib3.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /botNumber:Key/getMe (Caused by ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/rakshith/anaconda3/envs/detect_cv/bin/telegram-send", line 11, in <module>
sys.exit(main())
File "/home/rakshith/anaconda3/envs/detect_cv/lib/python3.6/site-packages/telegram_send.py", line 83, in main
return configure(conf[0], fm_integration=True)
File "/home/rakshith/anaconda3/envs/detect_cv/lib/python3.6/site-packages/telegram_send.py", line 308, in configure
return configure()
TypeError: configure() missing 1 required positional argument: 'conf'
This happens on one system, even if I create new bots, and keys, and try.
When using Python2.7
ERROR: Failed to send notification using telegram
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/ntfy/__init__.py", line 48, in notify
**backend_config)
File "/usr/local/lib/python2.7/dist-packages/ntfy/backends/telegram.py", line 17, in notify
configure(config_file)
File "/usr/local/lib/python2.7/dist-packages/telegram_send.py", line 185, in configure
config["telegram"] = {"TOKEN": token, "chat_id": chat_id}
AttributeError: ConfigParser instance has no attribute '__setitem__'
config = configparser.ConfigParser()
config['telegram'] = {"TOKEN": token, "chat_id": chat_id}
This appears to be a difference between py2 and py3 ConfigParser
apis.
I have been using this bot for a while and realized that sending big files fails if you fail to upload them in 20secs. I tried setting timeout=120 but it is not completely related to my issue as I see.
case:
I have average upload speed of 2.0 MB/sec
I try to upload a file with the size of 40MB
Sometimes it succeeds, sometimes it fails as my connection is not stable at all times
Maybe related to telegram's limitations but I have hopes on bot API to have a solution for this.
i send only one image from raspbian to channel and it success.
but many images case, just run the send_photo command several times.
but other one send many images in a framed format.
how can i do that?
https://imgur.com/a/JBzgtcx
i want to send different messages to different rooms.
do i have to change configure each time?
or does another command exist?
thankyou
As an image
https://pastebin.com/N2XnkZum
As a file
https://pastebin.com/yJCpND7c
Hey!
Could you tell me whether there is a way to go to the next line when sending messages?
Like e.g.:
telegram-send --format html "Line1<br />Line2"
telegram-send "Line1\nLine2"
...
That would be really handy for messages in the shape of
error on
systemname
timetime
Content:log
Thank you very much for all the work!
Please add the option "disable_web_page_preview=True" to be able to send links without preview. this is a crucial feature for me.
Hi again!
I tried to send several files at once and it worked.
Now I would like to include a caption with every file, the caption should be the complete filename
Reason for this is sometimes I have very long filenames and I can't see them on telegram (it cuts the filenames when they are long)
so how could I do it when I execute
telegram-send --file /path/to/files/*.txt
for every of those text files to be sent with a caption of their filenames?
Thanks again!
Plz tell me how to use $ https_proxy="https://127.0.0.1:xxxxx" telegram-send "test";.
127.0.0.1:9170 (which is well used with telegram desktop tcp proxy settings) spits lots of error msgs.
Im using Bash on Ubuntu on Windows
, which is more or less equvalent to Ubuntu 14.04.5 LTS
and has python 2.7.6
installed.
When using telegram-send
or the Telegram backbone of ntfy it works, but I get the following warning:
/usr/local/lib/python2.7/dist-packages/urllib3/util/ssl_.py:334: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/urllib3/util/ssl_.py:132: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecurePlatformWarning
I want use telegram-send in python, but i can only connect tekegram server by proxy.
How to use telegram-send with proxy in python, i don't want set proxy globa.
Could you help me?
Have my working bot but telegram-send cannot use it.
Why no possible show any debug messages?
https://monosnap.com/file/xGhCwTfwED2Xawf8YKUbNSP9sTzX7a.png
How do you send a video (.mp4) and have it show up a preview of the video in Telegram?
I installed and configured telegram-send. I tried in bash and it works. But Python doesn't work.
Here is a video where I tried the script from the documentation: https://youtu.be/iCgjwXae1co
Here is the full error: https://pastebin.com/cMuCTmp5
OS: Raspbian stretch from 2018-11-13
Python: 3.7.2
If you need more information tell me please.
The following files were written to the plist by the --record {plist}
feature, but weren't actually installed:
===> Checking for items in pkg-plist which are not in STAGEDIR
Error: Missing: libexec/punjab.tac
Error: Missing: %%WWWDIR%%/crossdomain.xml
Error: Missing: %%WWWDIR%%/favicon.ico
Error: Missing: %%WWWDIR%%/index.html
Error: Missing: %%WWWDIR%%/punjab.gif
===> Error: Plist issues found.
When i try to use "telegram-send" in bash script like that:
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
telegram-send --image image.jpg
i get this error :
Config not found
Please run: telegram-send --configure
it's already configured.
Hi and thanks for telegram-send. I noticed that when I use makdown or html formats telegram-send will fail to send the message and raise an error if the syntax is not 100% correct like in these example:
$ telegram-send --format markdown "another *test"
Traceback (most recent call last):
...
telegram.error.BadRequest: Can't parse entities in message text: can't find end of the entity starting at byte offset 20
$ telegram-send --format html "another <b>test"
Traceback (most recent call last):
File "/usr/local/bin/telegram-send", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/telegram_send.py", line 127, in main
raise(e)
File "/usr/local/lib/python3.5/dist-packages/telegram_send.py", line 111, in main
timeout=args.timeout
File "/usr/local/lib/python3.5/dist-packages/telegram_send.py", line 185, in send
bot.send_message(chat_id=chat_id, text=m, parse_mode=parse_mode)
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 272, in post
**urlopen_kwargs)
File "/usr/local/lib/python3.5/dist-packages/telegram/utils/request.py", line 210, in _request_wrapper
raise BadRequest(message)
telegram.error.BadRequest: Can't parse entities in message text: can't found end tag corresponding to start tag at byte offset 8
Hello.
I try to send file more than 50MB, but have error
# truncate -s 50M filename
# telegram-send --file /home/k.turevsky/filename
Traceback (most recent call last):
File "/usr/lib/python3.4/site-packages/telegram/utils/request.py", line 98, in _parse
data = json.loads(decoded_s)
File "/usr/lib64/python3.4/json/__init__.py", line 318, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.4/json/decoder.py", line 343, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.4/json/decoder.py", line 361, in raw_decode
raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/telegram-send", line 11, in <module>
sys.exit(main())
File "/usr/lib/python3.4/site-packages/telegram_send.py", line 64, in main
send(messages=args.message, conf=args.conf, parse_mode=args.parse_mode, files=args.file, images=args.image, captions=args.caption)
File "/usr/lib/python3.4/site-packages/telegram_send.py", line 110, in send
bot.sendDocument(chat_id=chat_id, document=f)
File "/usr/lib/python3.4/site-packages/telegram/bot.py", line 125, in decorator
result = func(self, *args, **kwargs)
File "/usr/lib/python3.4/site-packages/telegram/bot.py", line 151, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "/usr/lib/python3.4/site-packages/telegram/utils/request.py", line 199, in post
result = self._request_wrapper('POST', url, body=data.to_form(), headers=data.headers)
File "/usr/lib/python3.4/site-packages/telegram/utils/request.py", line 145, in _request_wrapper
message = self._parse(resp.data)
File "/usr/lib/python3.4/site-packages/telegram/utils/request.py", line 100, in _parse
raise TelegramError('Invalid server response')
telegram.error.TelegramError: Invalid server response
If file 49MB everything OK!
#export https_proxy=socks5://user:pass@IP:PORT
#telegram-send "hello"
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/socks.py", line 851, in connect
negotiate(self, dest_addr, dest_port)
File "/usr/lib/python3.6/site-packages/socks.py", line 497, in _negotiate_SOCKS5
self, CONNECT, dest_addr)
File "/usr/lib/python3.6/site-packages/socks.py", line 578, in _SOCKS5_request
raise SOCKS5Error("{0:#04x}: {1}".format(status, error))
socks.SOCKS5Error: 0x04: Host unreachable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/contrib/socks.py", line 87, in _new_conn
**extra_kw
File "/usr/lib/python3.6/site-packages/socks.py", line 262, in create_connection
raise err
File "/usr/lib/python3.6/site-packages/socks.py", line 252, in create_connection
sock.connect((remote_host, remote_port))
File "/usr/lib/python3.6/site-packages/socks.py", line 100, in wrapper
return function(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/socks.py", line 855, in connect
raise GeneralProxyError("Socket error", error)
socks.GeneralProxyError: Socket error: 0x04: Host unreachable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
chunked=chunked)
File "/usr/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 360, in _make_request
self._validate_conn(conn)
File "/usr/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 857, in _validate_conn
super(HTTPSConnectionPool, self)._validate_conn(conn)
File "/usr/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 289, in _validate_conn
conn.connect()
File "/usr/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connection.py", line 284, in connect
conn = self._new_conn()
File "/usr/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/contrib/socks.py", line 109, in _new_conn
"Failed to establish a new connection: %s" % error
telegram.vendor.ptb_urllib3.urllib3.exceptions.NewConnectionError: <telegram.vendor.ptb_urllib3.urllib3.contrib.socks.SOCKSHTTPSConnection object at 0x7faeb4db38>: Failed to establish a new connection: 0x04: Host unreachable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/telegram/utils/request.py", line 195, in _request_wrapper
resp = self._con_pool.request(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
**urlopen_kw)
File "/usr/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/usr/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/usr/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 695, in urlopen
**response_kw)
File "/usr/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 695, in urlopen
**response_kw)
File "/usr/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 695, in urlopen
**response_kw)
File "/usr/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 376, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
telegram.vendor.ptb_urllib3.urllib3.exceptions.MaxRetryError: NewConnectionError('<telegram.vendor.ptb_urllib3.urllib3.contrib.socks.SOCKSHTTPSConnection object at 0x7faeb4db38>: Failed to establish a new connection: 0x04: Host unreachable',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/telegram-send", line 11, in <module>
sys.exit(main())
File "/usr/lib/python3.6/site-packages/telegram_send.py", line 132, in main
raise(e)
File "/usr/lib/python3.6/site-packages/telegram_send.py", line 116, in main
timeout=args.timeout
File "/usr/lib/python3.6/site-packages/telegram_send.py", line 202, in send
send_message(m)
File "/usr/lib/python3.6/site-packages/telegram_send.py", line 191, in send_message
return bot.send_message(chat_id=chat_id, text=message, parse_mode=parse_mode, disable_web_page_preview=disable_web_page_preview)
File "/usr/lib/python3.6/site-packages/telegram/bot.py", line 60, in decorator
result = func(self, *args, **kwargs)
File "/usr/lib/python3.6/site-packages/telegram/bot.py", line 85, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "/usr/lib/python3.6/site-packages/telegram/utils/request.py", line 278, in post
**urlopen_kwargs)
File "/usr/lib/python3.6/site-packages/telegram/utils/request.py", line 201, in _request_wrapper
raise NetworkError('urllib3 HTTPError {0}'.format(error))
Arch Linux 3.14.79+
Other software like pip3 works via socks5 normally.
How can i send picture/images from URL.
I installed telegram-send into Ubuntu 16.04 box.
When I run telegram-send --configure I get:
jk@ka:~$ telegram-send --configure
Talk with the BotFather on Telegram (https://telegram.me/BotFather), create a bot and insert the token
❯ /newbot
Something went wrong, please try again.
Traceback (most recent call last):
File "/home/jk/.local/lib/python3.5/site-packages/telegram_send.py", line 254, in configure
bot = telegram.Bot(token)
File "/home/jk/.local/lib/python3.5/site-packages/telegram/bot.py", line 108, in __init__
self.token = self._validate_token(token)
File "/home/jk/.local/lib/python3.5/site-packages/telegram/bot.py", line 134, in _validate_token
raise InvalidToken()
telegram.error.InvalidToken: Invalid token
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jk/.local/bin/telegram-send", line 11, in <module>
sys.exit(main())
File "/home/jk/.local/lib/python3.5/site-packages/telegram_send.py", line 79, in main
return configure(conf, fm_integration=True)
File "/home/jk/.local/lib/python3.5/site-packages/telegram_send.py", line 258, in configure
return configure()
TypeError: configure() missing 1 required positional argument: 'conf'
All configure options --configure --configure-group --configure-channel start "Talk with the BotFather" to create bot which then fails.
How to fix this?
How can I create/edit manually conf files? Where can I find examples of conf files or links to conf file specs?
Thank you for your support.
Hi there, is it possible to increase the maximum amount of upload size?
Send files from the context menu in file managers.
Hi got an error: looks like something went wrong with coloring.
Talk with the BotFather on Telegram (https://telegram.me/BotFather), create a bot and insert the token
Traceback (most recent call last):
File "/usr/local/bin/telegram-send", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.4/dist-packages/telegram_send.py", line 56, in main
return configure(args.conf, fm_integration=True)
File "/usr/local/lib/python3.4/dist-packages/telegram_send.py", line 137, in configure
token = input(markup(prompt, "magenta")).strip()
UnicodeEncodeError: 'ascii' codec can't encode character '\u276f' in position 5: ordinal not in range(128)
Hello, I've tried to install telegram-send on Ubuntu 17.04 without sudo, but this is what I get when I do pip3 install telegram_send.py
:
Collecting telegram_send.py
Could not find a version that satisfies the requirement telegram_send.py (from versions: ) No matching distribution found for telegram_send.py
What can I do?
Hey! First of all, thanks for great project.
When I was trying to configure/send message to private channel I saw an error telegram.error.BadRequest: Chat not found
.
Following this comment at python-telegram-bot
repo I finished with workaround - manual changing example.conf
file with chat_id=-100NUMBER
.
Now telegram-send --config example.conf 'hello world'
works with private channels.
Want to share this for everybody who needs this functionality. I can create PR for adding this workaround to README.md
if you want. But if you add this as step --configure-channel
stage it'll be much better.
Thanks!
Hi - is there a way to configure the tool to read the api-key from a config file. so we don't have to use the interactive bot:
telegram-send --configure
I would like to set this up in a Docker container, that runs remotely, and pushes messages from supervisord
If you post an animated gif with --image, Telegram only displays the first frame.
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.