Tulir Asokan
f271316d7d
Make logger fully configurable ( #1087 )
2019-01-11 15:52:30 +01:00
Manuel1510
eda4178333
Add hide_via to InlineResult.click ( #1084 )
2019-01-10 23:42:58 +01:00
Lonami Exo
f99b4874c8
Support passing media objects to inline results ( #1053 )
2019-01-04 11:15:11 +01:00
Lonami Exo
4b9b77614f
Support answering inline queries with empty text ( #1053 )
2019-01-04 11:13:13 +01:00
Lonami Exo
c51a17bf9a
Actually make AdminLogEvent work
...
Ideally this would have been tested before release one commit ago.
2019-01-03 22:25:50 +01:00
Lonami Exo
eda8d0dbc8
Support configuring the reply markup through buttons
2019-01-03 19:03:47 +01:00
Lonami Exo
2631144702
Add more properties to the client to make media more convenient
2019-01-03 18:34:29 +01:00
Lonami Exo
4ccabaf422
Add friendly method to get admin log ( #952 )
2019-01-03 13:09:59 +01:00
Lonami Exo
4ad9c9bf31
Add TLObject.to_json() for convenience
2018-12-27 20:15:35 +01:00
Lonami Exo
b66c1e6084
Revert "Get rid of now broken cache"
...
This reverts commit f73ae42a03
.
2018-12-25 16:50:11 +01:00
Lonami Exo
f73ae42a03
Get rid of now broken cache
2018-12-25 11:44:10 +01:00
Lonami Exo
de74711e82
Implement click for KeyboardButtonGame
2018-12-24 17:56:30 +01:00
Lonami Exo
7100b75598
Update to layer 89
...
This breaks edit_2fa
2018-12-18 16:37:07 +01:00
Lonami Exo
09f994c105
Except TypeError on empty access hash from 5018879
thoroughly
2018-12-18 08:39:36 +01:00
Lonami Exo
4d8f078ad9
Fix _document_by_attribute calls using cond
2018-12-03 08:49:24 +01:00
Lonami Exo
ed1bcb509f
Use InputMessageReplyTo in get_reply_message
...
This lets bots access to messages other bots sent through replies.
2018-11-29 14:21:49 +01:00
Lonami Exo
4a8a85d7a6
Refetch ChatAction service message to get input users
2018-11-28 18:59:49 +01:00
Lonami Exo
207d5ebdcb
Avoid packing more than 1024 messages in a single container
2018-11-19 08:29:44 +01:00
Lonami Exo
924b59d735
Actually fix cancelling custom conversations from f6bc80b
2018-11-12 08:21:18 +01:00
Lonami Exo
f6bc80bc6b
Fix cancellation of custom conversation events from d474458
2018-11-08 10:08:41 +01:00
Lonami Exo
0fc97a3e8c
Update to v1.4
2018-11-03 12:46:19 +01:00
Kyle2142
eacfa226fd
Add Conversation.cancel() ( #1030 )
2018-10-25 15:37:36 +02:00
Lonami Exo
e5fc9d8674
Fix several broken links in the docs
2018-10-17 11:50:11 +02:00
Lonami Exo
419fe6dca3
Raise RuntimeError on with blocks that need async
2018-10-17 11:30:07 +02:00
Lonami Exo
b219da6b87
Fix Dialog.is_group for types.ChatForbidden
2018-10-15 18:43:53 +02:00
Lonami Exo
0094eb391e
Support exclusive conversations by default
2018-10-12 22:17:07 +02:00
Lonami Exo
74f7ae525f
Document InlineBuilder
2018-10-12 12:38:46 +02:00
Lonami Exo
9ee415749d
Fix InlineBuilder.photo/document and clearer errors
2018-10-12 11:50:36 +02:00
Lonami Exo
32c884d543
Revert d392939
and use empty tuple as a sentinel value
2018-10-08 11:33:56 +02:00
Lonami Exo
8c14259728
Update documentation with new sections
2018-10-06 20:20:11 +02:00
Lonami Exo
67be6418b6
Remove callback parameter from custom.Button
...
Its behaviour was strange. Removing and adding an event
handler every time a message is sent is not a good idea
and it would just do more harm than good.
2018-10-05 20:54:50 +02:00
Lonami Exo
d392939018
Create a default module to use as a sentinel value
...
This looks better in the documentation than utils.Default,
cleans the utils with specific stuff like this, and users
may use it more easily.
2018-10-05 14:20:50 +02:00
Lonami Exo
dedbf29ca4
Fix Conversation.wait_event not resolving them (from d474458
)
2018-10-05 13:42:07 +02:00
Lonami Exo
ef60ade647
Rewrite container packing to support arbitrary sizes
2018-10-05 13:26:44 +02:00
Lonami Exo
1b9d6aac06
Gzip only content related data
2018-10-05 13:26:44 +02:00
Lonami Exo
9402b4a26d
Create a new layer to lift encryption off the MTProtoSender
2018-10-05 13:26:44 +02:00
nailerNAS
c2966297f1
Add delete method to custom.Dialog ( #1014 )
2018-09-28 15:47:24 +02:00
Lonami Exo
4e07712b04
Return new .web_preview's .photo/.document if present in Message
2018-09-15 10:45:15 +02:00
Lonami Exo
11ef4ce370
Fix _document_by_attribute failing on empty media
2018-09-06 15:41:04 +02:00
Lonami Exo
4e5b8c9c34
Let sender = chat for messages from channels
2018-09-06 10:33:56 +02:00
Lonami Exo
bbeb8f4ba3
Clarify and fix some docstrings
2018-09-04 11:27:10 +02:00
Lonami Exo
fbc46bd388
Use loop.create_future instead asyncio.Future
2018-08-21 12:22:06 +02:00
Lonami Exo
d3a6822fc9
Properly resolve events
2018-08-21 12:18:12 +02:00
Lonami Exo
47190d7d55
Fix event loop not being passed into many asyncio calls
2018-08-21 11:31:14 +02:00
Lonami Exo
d474458136
Simplify event resolving logic
...
Although this commit introduces a race condition since an
event may only be half-resolved. A lock is thus needed,
but it depends on an event-loop to which we don't have
access in the class-level.
2018-08-21 11:08:08 +02:00
Lonami Exo
9f237cc928
Simplify event building logic
...
This will also fix some bugs where the event type being accessed
would not be available, since it is now built on-demand, without
the need to keep track for the count of each event type.
2018-08-21 10:27:12 +02:00
Lonami Exo
f4b9c9d6d4
Remove critical code from assert statements
2018-08-14 19:14:13 +02:00
Lonami Exo
06da651f27
Fix edits in custom.Conversation
2018-08-14 18:42:16 +02:00
Lonami Exo
216805d62d
Fix telethon.sync for custom.Conversation
2018-08-14 18:41:13 +02:00
Lonami Exo
d3efc8f57d
Better logging for packing errors
...
https://github.com/expectocode/telegram-export/issues/76
2018-08-08 12:04:20 +02:00
Lonami Exo
f332e4c423
Clearer variable naming
2018-08-06 16:31:15 +02:00
Lonami Exo
f39f9a94b5
Remove unnecessary async/await
2018-08-06 16:30:25 +02:00
Lonami Exo
d3a9dcd36c
Replace wait code with asyncio.wait_for and pass the client's loop
2018-08-06 16:22:11 +02:00
Lonami Exo
63174ae404
Properly clean-up Conversation
2018-08-05 13:15:19 +02:00
Lonami Exo
26bcc78d14
Fix Conversation.get_response
2018-08-05 12:28:54 +02:00
Lonami Exo
cc067b2569
Add Conversation to the sync magic module
2018-08-05 11:05:01 +02:00
Lonami Exo
48113851a8
Fix built Conversation events don't have the client
2018-08-05 02:01:06 +02:00
Lonami Exo
ca40a9c282
Add Conversation.wait_event
2018-08-05 01:55:41 +02:00
Lonami Exo
1ecb751222
Add Conversation.send_file and .mark_read
2018-08-04 23:21:19 +02:00
Lonami Exo
396b1a4177
Improve getting edits in a Conversation
2018-08-04 15:35:51 +02:00
Lonami Exo
5f73482d29
Restart Conversation total timeout upon __aenter__
2018-08-04 15:35:04 +02:00
Lonami Exo
2cf95ce2b9
Fix accessing buttons on messages with reply markup
2018-08-04 11:16:51 +02:00
Lonami Exo
785ef7676f
Create a basic custom.Conversation
2018-08-03 17:51:56 +02:00
Lonami Exo
60c61181d9
Return custom.InlineResults instead of a simple list
2018-08-02 23:31:51 +02:00
Lonami Exo
070c971d11
Set media as None if it is MessageMediaEmpty
2018-08-02 20:18:28 +02:00
Lonami Exo
16f7626ceb
Fix custom.Button._is_inline failing for MessageButton
2018-08-02 14:53:26 +02:00
Lonami Exo
7a2d7d98ad
Implement client.inline_query()
2018-08-01 01:06:47 +02:00
Lonami Exo
49a6cb4ef8
Fix InlineResult.click()
2018-08-01 01:06:08 +02:00
Lonami Exo
7d880a856e
Implement InlineResult.download_media
2018-08-01 00:15:23 +02:00
Lonami Exo
682e650187
Create a basic InlineResult class
2018-07-29 12:56:11 +02:00
Lonami Exo
f2c8663266
Fix copy pasted docs and snake_case files
2018-07-28 11:28:02 +02:00
Lonami Exo
056842d1a0
Fix trailing comma breaking Python 3.5.2 compat
2018-07-23 12:18:35 +02:00
Lonami Exo
ace7254344
Fix classes MRO and abstractmethod usage
...
Furthermore utils needs to access the message by reference
through types.Message because it is patched and replaced.
2018-07-22 19:26:34 +02:00
Lonami Exo
fd17098447
Rename MessageBase for Message
2018-07-22 17:22:52 +02:00
Lonami Exo
c4e94abcf0
Complete moving properties to the new message base
2018-07-22 16:49:42 +02:00
Lonami Exo
a3ac6d1645
Create a common message base class
2018-07-22 13:26:12 +02:00
Lonami Exo
5df46f9ed8
(Try to) fix infinite recursion in custom.Message again
2018-07-22 12:27:08 +02:00
Lonami Exo
bc03c29216
Fix logical bugs when getting input peers in custom.Message
...
Such as incorrectly handling InputPeerSelf/InputPeerChat and
using self._input_sender when self._input_chat was expected.
2018-07-22 11:33:29 +02:00
Lonami Exo
3bdfd4b32c
Make build_reply_markup public
2018-07-21 13:55:26 +02:00
Lonami Exo
24758b82ec
Don't make a request at all if it will trigger flood wait
2018-07-21 12:25:20 +02:00
Lonami Exo
13437cc3f2
Fix infinite recursion for custom.Message.message
2018-07-21 10:19:17 +02:00
Lonami Exo
2d7c8908eb
Create events.InlineQuery
2018-07-15 11:31:24 +02:00
Lonami Exo
5017a9d1da
Fix typos and add the URL_INVALID error
2018-07-14 10:43:24 +02:00
Lonami Exo
dc3d281274
Load update state date with explicit timezone ( #808 )
2018-07-14 00:01:45 +02:00
Lonami Exo
051d56af88
Support clicking buttons known their data
2018-07-12 16:26:22 +02:00
Lonami Exo
38c65adf35
Set timezone info when reading datetimes
2018-07-12 00:30:57 +02:00
Lonami Exo
e2ffa816dc
Fix infinite recursion
2018-07-11 11:23:11 +02:00
Lonami Exo
a3d6baf408
Actually add callbacks registered through Button
2018-07-10 19:50:18 +02:00
Lonami Exo
8eecd9c226
Reuse code to get chat and sender
2018-07-10 17:59:13 +02:00
Lonami Exo
8c28be04bc
Create a custom.Button class and support send_message(buttons=...)
2018-07-10 17:59:13 +02:00
Lonami Exo
4328663c78
Support timedelta as datetimes
2018-07-09 13:36:52 +02:00
Lonami Exo
1b22d0eb12
Add missing await
2018-07-08 23:44:56 +02:00
Lonami Exo
393e1966c7
Avoid exceeding maximum container size
...
This issue would likely be triggered when automatically
merging multiple requests into a single one while having
their size exceed 1044456 bytes like SaveFilePartRequest.
This commit avoids such issue by keeping track of the
current size, and if it exceeds the limit, avoid merge.
2018-07-07 11:58:48 +02:00
Lonami Exo
33ce702ab9
Pre-pack outgoing TLMessage
...
This has several benefits:
- The message can be resent without re-calling bytes(),
which for some requests may be expensive.
- Converting requests to bytes early lets us detect
errors early, such as OverflowError on bad requests.
- Containers can't exceed 1044456 bytes so knowing their
length is important. This can now be done in O(1).
But also several drawbacks:
- If the object is modified the bytes won't reflect this.
This isn't an issue because it's only done for in msgs.
- Incoming messages can no longer be reconverted into
bytes but this was never needed anyway.
2018-07-07 11:46:21 +02:00
Lonami Exo
44630542d0
Fix MessageAction not allowing access to media
...
This caused some issues with events.MessageEdited because
some MessageAction can trigger these edit updates such as
scoring in a game.
2018-07-03 14:13:44 +02:00
Lonami Exo
43afdb9d77
Fix-up 53fbfb2
for InputPeerChat or others
2018-07-03 14:05:42 +02:00
Lonami Exo
53fbfb215f
Fix Telegram may omit entities' access hash in updates
2018-07-02 18:43:42 +02:00
Lonami Exo
0f5f6cc050
Fix opposite condition
2018-06-28 15:50:26 +02:00
Lonami Exo
ad01bda503
Fix custom.Message.buttons being None in channels ( #870 )
...
The implications behind this were bigger than expected. The sender
of the message is not actually needed for anything in the bot. The
bot itself may be needed, but only for KeyboardButtonSwitchInline.
2018-06-27 19:25:14 +02:00
chrizrobert
1eb4af33df
Fix get_entities_text with cls ( #866 )
2018-06-26 15:58:55 +02:00
Lonami Exo
96e8b0b840
Remove get_fwd_sender
2018-06-26 12:38:58 +02:00
Lonami Exo
fc834f60fb
Fix custom.Dialog passing the wrong instance to custom.Draft
2018-06-25 21:24:46 +02:00
Lonami Exo
59f6b75391
Stop showing "data left after" warning
2018-06-25 12:54:33 +02:00
Lonami Exo
410518aa65
Stop using await with properties
2018-06-25 11:38:56 +02:00
Lonami Exo
0d09f9d8c1
Create a custom.Forward class
2018-06-25 11:34:10 +02:00
Lonami Exo
efc9f4c414
Get rid of all remaining async properties
2018-06-25 11:03:20 +02:00
Lonami Exo
266d44dd86
Fix EventsCommon still having async properties
2018-06-24 13:05:58 +02:00
Lonami Exo
0d0e78e10b
Use the right chat peer in private messages
2018-06-23 15:10:07 +02:00
Lonami Exo
8d98c04932
Fix awaits on input_chat property
2018-06-22 10:05:29 +02:00
Lonami Exo
5e322a6ca9
Remove async properties from custom.Message
...
Awaiting on a property was strange and only really made sense
in events.NewMessage. Methods like client.get_messages() and
similar return entire custom.Message which won't need to touch
the network, and requiring the await was a poor UX.
2018-06-21 21:15:48 +02:00
Lonami Exo
5c602d4ba7
Add __str__ to RpcResult/GzipPacked
2018-06-21 09:58:12 +02:00
Lonami Exo
8d5c052fce
Fix TypeError when accessing unexisting sender
2018-06-21 09:26:31 +02:00
Lonami Exo
c85ba4accc
Revisit documentation, cross-references and unnecessary indents
2018-06-20 11:06:03 +02:00
Lonami Exo
463847ad50
Revisit and remove a few TODOs
2018-06-18 18:46:06 +02:00
Lonami Exo
ee7a44d447
Return an empty list from get_entities_text if no entities
2018-06-18 13:54:09 +02:00
Lonami Exo
56ddaaee6f
Make non-fwded messages sent to yourself outgoing
2018-06-16 17:35:24 +02:00
Lonami Exo
b7286be3b0
Get the "correct" chat in private incoming messages
2018-06-15 12:46:41 +02:00
Lonami Exo
24d2074e0c
Set _input_chat on custom.Message creation/fixup input_chat
2018-06-14 23:40:44 +02:00
Lonami
bb3a564500
Merge pull request #843 from LonamiWebs/core-rewrite
...
Core rewrite
2018-06-14 16:25:28 +02:00
Lonami Exo
3f16c92eb3
Subclass TLRequest for content-related objects
2018-06-12 20:14:21 +02:00
Lonami Exo
d4dc147459
Handle DraftMessageEmpty ( closes #844 )
2018-06-12 19:25:13 +02:00
Lonami Exo
2a90de2b08
Fix broadcast being named post for is_group property
2018-06-12 12:31:37 +02:00
Lonami Exo
f581db294a
Better custom.MessageButton.click() docs
2018-06-11 10:25:57 +02:00
Lonami Exo
aa6d3430ae
Properly handle bot timeouts when clicking buttons
2018-06-11 10:20:22 +02:00
Lonami Exo
f86f52d960
Fix async_generator's and missing awaits
2018-06-10 22:00:55 +02:00
Lonami Exo
d462b04a9c
Add async/await on tl.custom
2018-06-10 20:29:57 +02:00
Lonami Exo
3e151a1b7a
Make TelegramBareClient able to invoke requests
2018-06-09 21:03:48 +02:00
Lonami Exo
be279ce3f5
Make TLMessage always have a valid TLObject
...
This simplifies the flow instead of having separate request/body
attributes, and also means that BinaryReader.tgread_object() can
be used without so many special cases.
2018-06-09 13:48:27 +02:00
Lonami Exo
f7e8907c6f
Create RpcResult class and generalise core special cases
...
This results in a cleaner MTProtoSender, which now can always
read a TLObject with a guaranteed item, if the message is OK.
2018-06-09 13:13:55 +02:00
Lonami Exo
adfe861e9f
Create a self-contained MTProtoState
...
This frees us from using entire Session objects in something
that's supposed to just send and receive items from the net.
2018-06-09 11:34:01 +02:00
Lonami Exo
0418f7e375
Fix get_entities_text and allow filtering by type
2018-06-07 10:46:32 +02:00
Lonami Exo
56b09c0c9d
Properly set future results
2018-06-07 10:30:20 +02:00
Lonami Exo
e469258ab9
Create a new MTProtoSender structure and its foundation
...
This means that the TcpClient and the Connection (currently only
ConnectionTcpFull) will no longer be concerned about handling
errors, but the MTProtoSender will.
The foundation of the library will now be based on asyncio.
2018-06-06 20:41:01 +02:00
Lonami Exo
8c8a0153ef
Revert 9db9d1e's count and fix typo
2018-06-03 15:20:52 +02:00
Lonami Exo
b2ed6caff4
Fix setattr for events.NewMessage/custom.Message
2018-06-03 13:00:07 +02:00
Lonami Exo
0a3151175d
Fix infinite recursion on setattr custom.Message
2018-06-03 12:29:30 +02:00
Lonami Exo
8d7c7a19c0
Add some setters for custom.Message
2018-06-03 11:53:18 +02:00
Lonami Exo
8b16023566
Allow setting a per-client default parse mode
2018-06-03 11:29:48 +02:00
Lonami Exo
f7222407de
Document custom.Message
2018-06-02 12:52:38 +02:00
Lonami Exo
6dcd0911a7
Move events.NewMessage properties to custom.Message
2018-06-02 12:30:25 +02:00
Lonami Exo
e2ce55871e
Replace custom.Message's class on creation
2018-06-01 21:20:34 +02:00
Lonami Exo
9db9d1ed5c
Implement __bytes__ and use count instead sum
2018-05-31 22:39:32 +02:00
Lonami Exo
2191fbf30b
Fix custom.Message.click not having buttons
2018-05-31 14:10:19 +02:00
Lonami Exo
a1c511429e
Port NewMessage.edit/delete to custom.Message
2018-05-31 14:01:42 +02:00
Lonami Exo
66d5443fcd
Add custom.Message.fwd_from_entity
2018-05-31 13:56:33 +02:00
Lonami Exo
58f621ba82
Make custom.Message more consistent with previous patches
2018-05-31 13:50:08 +02:00
Lonami Exo
5aed494aac
Fix custom.Message special methods
2018-05-31 12:50:08 +02:00
Lonami Exo
192b7af136
Lazily load user/input user on Message
2018-05-31 12:24:25 +02:00
Lonami Exo
aa70436441
Add a custom Message class
2018-05-31 10:32:32 +02:00
Lonami Exo
68bb8e8b91
Add is_user/group/channel and title to Dialog
2018-05-30 19:20:27 +02:00
Lonami Exo
ef509d13c7
Move InvokeAfterMsg to TLMessage to cleanly confirm results
2018-05-09 16:18:42 +02:00
Lonami Exo
3b7c4fe278
Further TLObject generator clean-up
...
Split everything into several functions, reused some more
common code (like accessing the "real" arguments instead
constantly filtering) and more, like using classmethods
instead staticmethods and then hardcoding the class name.
2018-04-14 20:28:25 +02:00
vegeta1k95
3bf259d6b3
Make TLObjects picklable ( #752 )
2018-04-12 18:02:46 +02:00
Lonami Exo
395e702586
Make py:obj default Sphinx's role
2018-03-28 16:03:47 +02:00
Lonami Exo
ae2abd2ba9
Add __str__/.stringify() to tl.custom for completeness
2018-03-27 11:08:40 +02:00
Lonami Exo
1c9dc8dc63
Fix getting ID on custom Dialog class from dce0fd9
2018-03-24 18:44:13 +01:00
Lonami Exo
43c6896481
Add a custom role for TL references and make use of it
2018-03-23 21:42:17 +01:00
Lonami Exo
dce0fd9e03
Add missing documentation for telethon.tl.custom and crosslinks
2018-03-22 19:02:08 +01:00
Lonami Exo
9d46bb35c8
Rename and reorder some params in Draft for consistency ( #673 )
2018-03-08 13:05:40 +01:00
Lonami Exo
8cefb22e14
Add .text and .raw_text properties to the Draft class ( #673 )
2018-03-08 12:56:20 +01:00
Lonami Exo
6e6d40be18
Implement Draft.send() ( closes #673 )
2018-03-08 12:37:06 +01:00
Joscha Götzer
835ff51e25
Multiple small changes/fixed typos to docs/error messages ( #623 )
2018-03-01 13:21:28 +01:00
Lonami Exo
fbd53e2126
Override TLObject's __eq__ and __ne__ methods
2018-02-01 12:10:03 +01:00
Lonami Exo
4a83784fe8
Simplify TLObject.pretty_format since Telegram returns no dicts
2018-01-25 09:51:12 +01:00
Lonami Exo
2873dcf1c6
Add '_' key to TLObject's .to_dict() and remove recursive param
...
Closes #559
2018-01-25 09:44:07 +01:00
Lonami Exo
b716c4fe67
Several documentation enhancements and build warnings fixes
...
- Made the documentation even more friendly towards newbies.
- Eased the usage of methods like get history which now set
a default empty message for message actions and vice versa.
- Fixed some docstring documentations too.
- Updated the old normal docs/ to link back and forth RTD.
- Fixed the version of the documentation, now auto-loaded.
2018-01-20 11:47:17 +01:00
Lonami Exo
4d4e81e609
Fix cyclic imports on Python 3.4 by moving Session one level up
2018-01-19 22:55:28 +01:00
Lonami Exo
33e50aaee1
Reuse .on_response/.__str__/.stringify, override iff necessary
2018-01-19 12:12:52 +01:00
Lonami Exo
1c9fa76ede
Add new method to .resolve() parameters instead on init
...
TLObject's __init__ used to call utils.get_input_* methods and
similar to auto-cast things like User into InputPeerUser as
required. Now there's a custom .resolve() method for this purpose
with several advantages:
- Old behaviour still works, autocasts work like usual.
- A request can be constructed and later modified, before the
autocast only occured on the constructor but now while invoking.
- This allows us to not only use the utils module but also the
client, so it's even possible to use usernames or phone numbers
for things that require an InputPeer. This actually assumes
the TelegramClient subclass is being used and not the bare version
which would fail when calling .get_input_peer().
2018-01-19 11:47:45 +01:00
Lonami Exo
b546c02210
Return a custom class for sized InputFile instead extra attrs
2018-01-18 20:09:59 +01:00
Lonami Exo
0e4611a593
Properly implement InputPhoto/InputDocument caching
...
Since uploading a file is done on the TelegramClient, and the
InputFiles are only valid for a short period of time, it only
makes sense to cache the sent media instead (which should not
expire). The problem is the MD5 is only needed when uploading
the file.
The solution is to allow this method to check for the wanted
cache, and if available, return an instance of that, so to
preserve the flexibility of both options (always InputFile,
or the cached InputPhoto/InputDocument) instead reuploading.
2018-01-18 19:36:47 +01:00
Lonami Exo
7e707dbbd9
Fix using enum on sqlite instead its value
2018-01-18 19:35:46 +01:00
Lonami Exo
55efb2b104
Use a different schema for file cache which actually persists
...
Caching the inputFile values would not persist accross several
days so the cache was nearly unnecessary. Saving the id/hash of
the actual inputMedia sent is a much better/persistent idea.
2018-01-18 09:52:39 +01:00
Lonami Exo
494c90af69
Fix uploaded files cache may have expired
2018-01-15 12:36:46 +01:00
Lonami Exo
045f7f5643
Assert hash is not None when migrating from JSON sessions
2018-01-10 10:46:43 +01:00
Lonami Exo
3c686fecdf
Avoid more cyclic imports on the session file
2018-01-08 12:14:03 +01:00
Lonami Exo
34fe150096
Save only one auth_key on the database again
2018-01-07 00:38:30 +01:00
Lonami Exo
7745b8e7ee
Use without rowid only if supported ( closes #523 )
2018-01-06 19:35:24 +01:00
Lonami Exo
f357d00911
Assert user/channel ID is non-zero too for #392
2018-01-06 15:54:27 +01:00
Lonami Exo
ec4ca5dbfc
More consistent with asyncio branch (style/small fixes)
...
Like passing an extra (invalid) dt parameter when serializing
a datetime, and handling more errors in the TcpClient class.
2018-01-05 18:31:48 +01:00
Lonami Exo
c4e26c95f5
Always cache files smaller than 10MB, now in the database
...
This removes the need for a .clear_cache() method as now files
are identified by their MD5 (which needs to be calculated
always) and their file size (to make collisions even more
unlikely) instead using the file path (which can now change).
2018-01-05 15:33:25 +01:00
Lonami Exo
cbf6306599
Fix early cast to input from 932ed9e
causing error on Peer
2017-12-29 22:07:16 +01:00
Lonami Exo
d2121c76cb
Fetch and persist each auth_key per DC
2017-12-29 19:41:12 +01:00
Lonami Exo
0570c55120
Remove hardcoded database version from session sql statement
2017-12-29 00:43:52 +01:00
Lonami Exo
47b53ce89f
Except only UnicodeDecodeError to check migration ( fix #511 )
2017-12-28 17:06:14 +01:00
Lonami Exo
4a139b0ae4
Fix session table may be empty if no DC switch
2017-12-28 14:58:42 +01:00
Lonami Exo
55b67b65a1
Remove optional add_mark parameter from .get_peer_id
...
It was always True after all, and it made no sense for it to
be False.
2017-12-28 13:31:43 +01:00
Lonami Exo
3537e9bcc9
Support more types to represent a date
2017-12-28 12:32:16 +01:00
Lonami Exo
52a4ef82f4
Merge branch 'master' of github.com:LonamiWebs/Telethon
2017-12-28 01:17:30 +01:00
Lonami Exo
ab07f0220a
Save dc_id instead layer and salt in the session file
...
Server salts change every 30 minutes after all, so keeping them
in the long-term storage session file doesn't make much sense.
Saving the layer doesn't make sense either, as it was only used
to know whether to init connection or not, but it should be done
always.
2017-12-28 01:06:27 +01:00
Dmitry D. Chernov
6ec6967ff9
Make exception types correspond to Python docs
2017-12-28 09:48:02 +10:00
Lonami Exo
f29ee41f6c
Don't use rowid for the entities table
2017-12-27 13:27:54 +01:00
Lonami Exo
932ed9ea9d
Cast to input peer early on get input entity and close cursor
2017-12-27 13:06:03 +01:00
Lonami Exo
843e777eba
Simplify .process_entities() flow
2017-12-27 12:58:50 +01:00
Lonami Exo
b6b47d175c
Fix username.lower() on instances with username field but None
2017-12-27 12:16:49 +01:00
Lonami Exo
86429e7291
Lowercase usernames before adding them to the database
2017-12-27 11:54:08 +01:00
Lonami Exo
aef96f1b68
Remove custom EntityDatabase and use sqlite3 instead
...
There are still a few things to change, like cleaning up the
code and actually caching the entities as a whole (currently,
although the username/phone/name can be used to fetch their
input version which is an improvement, their full version
needs to be re-fetched. Maybe it's a good thing though?)
2017-12-27 00:50:09 +01:00
Lonami Exo
0a4849b150
Small cleanup of the Session class
2017-12-26 16:59:30 +01:00
Lonami Exo
664417b409
Use sqlite3 instead JSON for the session files
2017-12-26 16:45:47 +01:00
Lonami Exo
238198db5a
Create a convenient class to wrap Dialog instances
2017-12-24 16:18:09 +01:00