Commit Graph

504 Commits

Author SHA1 Message Date
Dan
628ddd4a25 Update Client's docstrings 2019-01-27 11:24:23 +01:00
Dan
a8a6f53e2d Fix the configuration load process breaking in case of no plugins 2019-01-26 13:01:44 +01:00
Dan
be013de4d4 Fix plugins load via Client parameter 2019-01-16 20:25:48 +01:00
Dan
6ec3b12aeb Smart plugins enhancements 2019-01-16 15:54:48 +01:00
Dan
3d16a715ad Fix file using wrong line separator 2019-01-16 15:46:46 +01:00
Dan
6df7788379 Enhance proxy settings
- Allow proxy settings to omit "enabled" key
- Allow setting proxy to None in order to disable it
2019-01-16 13:10:01 +01:00
Dan
b37d4dc7ec Make get_file and save_file handle StopTransmission errors 2019-01-11 14:03:16 +01:00
Dan
6b63e88de7 Add Client.stop_transmission() method
As a wrapper for raise StopTransmission
2019-01-11 14:02:40 +01:00
Dan
200ed844fe Fix first_name and last_name not being called if they are callable 2019-01-11 13:02:19 +01:00
Dan
07276e31b9 Add restart method 2019-01-11 12:36:37 +01:00
Dan
66f70450aa Allow phone_number, phone_code and password to also be functions
Also add recovery_code
References #163
2019-01-08 14:28:52 +01:00
Dan
4f6990d735 Add takeout parameter in Client
This lets the client use a takeout session instead of a normal one.
Takeout sessions are useful for exporting Telegram data. Methods invoked
inside a takeout session are less prone to throw FloodWait exceptions.
2019-01-03 12:20:42 +01:00
Dan
b53ba81a6a Add no_updates parameter in Client
Useful to completely disable incoming updates for batch programs
2019-01-03 11:13:24 +01:00
Dan
4d7b1bafac Update copyright year 2019-01-01 12:36:16 +01:00
Dan
64ec26850e Document save_file 2018-12-28 15:16:46 +01:00
Dan
d91acfe2ca Re-implement password-protected log-ins and support password recovery 2018-12-25 15:41:55 +01:00
Dan
fccadf526e Merge branch 'develop' into future
# Conflicts:
#	pyrogram/__init__.py
2018-12-25 14:36:59 +01:00
Dan
00e4e385aa Allow bots to message old chats even if they don't exist in the session 2018-12-24 22:31:45 +01:00
Dan
84fef9ecf1 Add missing file_reference argument where applicable 2018-12-23 00:55:00 +01:00
Dan
bf0b947253 Type hint all Client methods 2018-12-19 14:55:48 +01:00
Dan
8f6f38e0b0 Merge branch 'develop' into new-parsers 2018-12-18 11:22:47 +01:00
Dan
bc824f738c Add extra warnings when sign-ins or sign-ups fail 2018-12-18 11:21:37 +01:00
Dan
c9bcf93cf7 Add extra checks in case sign-in or sign-up fails 2018-12-18 10:10:04 +01:00
Dan
914dfca574 Reformat code and optimize imports 2018-12-18 09:50:39 +01:00
Dan
70470360b1 Print account name when logging in the first time 2018-12-15 11:10:25 +01:00
Dan
001a067d82 Make start and stop methods return self to make chaining possible
Suggestion by @CharlesBachman in Telegram
2018-12-15 09:50:35 +01:00
Dan
4ba5e63034 Report offset instead of 0 in case file size is missing (for file_id) 2018-12-15 08:51:20 +01:00
Dan
9c91720104 Fix broken download_media progress args 2018-12-15 08:50:08 +01:00
Dan
e400641204 Fix Dispatcher bad behaviours in case of multiple Clients running at the same time. 2018-11-13 20:31:53 +01:00
Dan
c006ba5b30
Merge pull request #146 from TolichP/add-filesize-limit-error
Add file size limit error
2018-11-03 11:11:06 +01:00
Dan
09563067c7
Add a check for 0 B file sizes 2018-11-03 11:10:43 +01:00
Dan
45129658b0 Revisit docstrings 2018-11-03 10:49:11 +01:00
Dan
99bdaae365 Allow nested folders for smart plugins 2018-10-23 15:43:49 +02:00
Dan
a0780d793d Apply code review suggestions 2018-10-21 14:44:29 +07:00
Dan
1fe46610cd Make plugins disabled by default
Users need to explicitly set plugins_dir parameter
2018-10-21 09:42:22 +02:00
Alexandr
ee47c21eed Add file size limit error 2018-10-19 23:39:29 +07:00
Dan
f4146a8779 Accept None as plugins_dir 2018-10-13 19:33:43 +02:00
Dan
8e238ccc9a Add plugins_dir docstrings in Client class definition 2018-10-13 11:14:26 +02:00
Dan
345ac6e16a Merge branch 'develop' into plugins 2018-10-13 10:42:07 +02:00
Dan
9649b1457c Don't make use of hardcoded default int values too 2018-10-13 10:41:58 +02:00
Dan
340fb9c145 Merge branch 'develop' into plugins
# Conflicts:
#	pyrogram/client/client.py
#	pyrogram/client/ext/base_client.py
2018-10-13 10:39:47 +02:00
Dan
a32009a79d Don't make use of hardcoded default string values 2018-10-13 10:38:44 +02:00
Dan
6a0066b8b5 Move loading plugins logic into a separate method 2018-10-12 17:57:34 +02:00
Dan
4bb50ee35f More logs when loading plugins 2018-10-12 17:54:52 +02:00
Dan
6c05f9ff42 Sanitize (a bit) plugins directory 2018-10-12 15:26:52 +02:00
Dan
4e516d097f Don't raise exceptions in case of non-existent plugins folder
Don't even warn in case the default plugins folder doesn't exist
2018-10-12 14:32:35 +02:00
Dan
0b79f96b4f Turn hardcoded plugins dir into a constant 2018-10-12 14:19:26 +02:00
Dan
dfb841baa9 Automatically scan and load plugins from a customizable directory
Defined functions found inside the directory that are also decorated
properly will be registered in the Client's dispatcher as handlers.
2018-10-12 14:17:03 +02:00
Dan
b79bd1ea83 Don't swallow left_chat_member updates
Even though they are only relevant for supergroups with <50 members
2018-10-01 09:45:32 +02:00
Dan
12c61fb431 Fix unwanted CHANNEL_PRIVATE errors. Fixes #129 2018-10-01 09:40:34 +02:00
Dan
6a89c7ea02 Add missing ipv6 docstrings 2018-09-22 14:21:55 +02:00
Dan
3a858e6a57 Fix config values not being available when not using config.ini file 2018-09-19 17:30:23 +02:00
Dan
8b364202c3 Use list instead of set 2018-09-18 19:17:28 +02:00
Dan
500ec09b47 Clean up load_config 2018-09-18 19:16:55 +02:00
Dan
f850d6352e Enhance API by adding support for Context Managers. Closes #122
A batch script would be as simple as this example:

from pyrogram import Client

with Client("...") as app:
    app.send_message("haskell", "hi")
2018-09-17 18:53:04 +02:00
Dan
e7a85520f2 Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	pyrogram/client/client.py
2018-09-17 15:59:49 +02:00
Dan
c75a4f182a
Handle Telegram exceptions on start(). Fixes #121
The client doesn't need to be stopped as it never started successfully.
2018-09-15 13:23:25 +02:00
Dan
db6042e91b Fetch ChatForbidden and ChannelForbidden peers
This fixes unwanted PEER_ID_INVALID errors in cases where a user or a
bot was kicked/banned from a group, supergroup or channel
2018-09-02 13:04:29 +02:00
Dan
9f4d7854e8 Fix ipv6 branch merge mess 2018-08-30 01:23:19 +02:00
Dan
4b3b647245 Merge branch 'ipv6' into develop
# Conflicts:
#	pyrogram/client/client.py
#	pyrogram/session/session.py
2018-08-28 12:19:37 +02:00
Dan
2779e33d13 Rename "token" to "bot_token" 2018-09-10 19:55:53 +02:00
Dan
da436461a8 Revert "Move resolve_peer into utilities"
This reverts commit 6437c6c
2018-08-10 11:29:13 +02:00
Dan
6437c6c5be Move resolve_peer into utilities 2018-08-10 11:17:53 +02:00
Dan
d270d0d2aa Remove support for t.me/joinchat/ links in resolve_peer for now
Another way, which is 100% reliable, will be implemented
Also clean the method a bit by removing useless checks
2018-07-28 23:09:44 +02:00
Dan
0c96fa8b7c Don't flush each chunk. Let python/os deal with it 2018-07-11 17:05:33 +02:00
Dan
1d7c857e9f Rename get_dialogs 2018-07-04 21:02:26 +02:00
Dan
52f1f390ca Rename get_dialogs 2018-07-04 20:59:21 +02:00
Dan
8bdccda6ee Fix GetDialog call 2018-07-04 14:03:45 +02:00
Dan
c7489cf302 Reformat code 2018-07-04 14:03:14 +02:00
Dan
29fb0ce599 Also log UpdatesTooLong 2018-07-04 13:53:34 +02:00
Dan
e414956e71
Log UpdateChannelTooLong updates 2018-07-03 18:29:25 +02:00
Dan
c660d3a7d0 Fix PhotoSize not having date anymore 2018-07-01 19:43:29 +02:00
Dan
7ed9cd6759 Add "Login successful" message upon login 2018-06-27 14:42:04 +02:00
Dan
ecaba45523 Keep only lang_code 2018-06-27 00:42:32 +02:00
Dan
2587394e07 Merge branch 'layer-81' into develop 2018-06-25 00:43:47 +02:00
Dan
fa7b7d0ce3 Cleanup Client class 2018-06-24 19:09:39 +02:00
Dan
9c420bb73b Document the new parameters. Closes #86 2018-06-24 19:09:39 +02:00
Dan
9a012077cc Remove some redundant code. Related to #86 2018-06-24 18:54:47 +02:00
Dan
55ef4abb27 Allow user-defined session properties. Related to #86
This commit adds five 5 extra parameters to the Client class:
app_version, device_model, system_version, system_lang_code, lang_code
2018-06-24 18:47:49 +02:00
Dan
f4c0793a0b Make session leaner by removing some redundant parameters
Related to #86
2018-06-24 18:27:41 +02:00
Dan
69d1432251 Allow user-defined values for retries and timeout 2018-06-24 17:47:29 +02:00
Dan
44f71f096f Better docs for phone_code argument 2018-06-24 16:53:07 +02:00
Dan
47043380fb Pass the phone number when calling the phone_code callback function 2018-06-24 16:11:22 +02:00
Dan
0cd4795318 Use TOS provided by Telegram 2018-06-23 16:15:44 +02:00
Dan
668da4ae0e Merge branch 'tos' into layer-81
# Conflicts:
#	pyrogram/client/ext/base_client.py
2018-06-23 16:11:20 +02:00
Dan
fc541221ed Accept terms of service after successfully signing in 2018-06-23 16:08:28 +02:00
Dan
7f11f85c8f Move signal handler inside idle 2018-06-23 15:45:48 +02:00
Dan
82a0c965ba Don't make start and idle clickable 2018-06-22 13:12:31 +02:00
Dan
e3299bb3b7 Add run() method 2018-06-22 13:10:09 +02:00
Dan
ffd67ed408 Remove debug docstrings 2018-06-22 13:08:27 +02:00
Dan
dab0a05f16 Move idle() and signal_handler() definitions near stop() 2018-06-22 13:08:01 +02:00
YoilyL
2944181b38
fixed session mistake
use new session when uploading files instead of main session
2018-06-13 17:54:48 +03:00
Dan
ade1c2f377 Accommodate ipv6 in the Client class 2018-06-13 13:38:14 +02:00
Dan
8e2aec4d3a Show TOS on sign-ins 2018-06-07 12:54:23 +02:00
Dan
91cf103783 Remove a bunch of useless TODOs 2018-06-02 20:54:23 +02:00
Dan
dc7fe93aeb Clean up code 2018-06-02 20:52:16 +02:00
Dan
b4a2490da2 Use getpass instead of input 2018-06-01 19:27:05 +02:00
Dan
00b983ccc3 Fix proxy not being correctly updated 2018-05-25 11:52:40 +02:00
Dan
65c209000c Connection refactoring 2018-05-24 21:19:57 +02:00
Dan
9001ccd11f Add DisconnectHandler 2018-05-23 14:27:17 +02:00