* Fix IndexError instead of StopIteration when MessageIterator is done
* Make fill() return a boolean based on whether items were added to the
buffer, and update __next__() accordingly
This commit is a fairly large chunk of code that fixes a previously
annoying and nasty bug causing cached_properties to not be cleared.
Alongside this bug fix I took the opportunity to refactor the entire
methdology behind cached properties, and bind them more strictly to the
behavior of models.
Prior to this commit, cached_properties where not be properly reset upon
a model's `update` method being called due to some invalid code. Along
with this issue, the actual behavior of cached properties landed in a
weird in-between/gray area where they had to support both non-model and
model use cases.
The new version of cached_property is strictly for use with models, and
another version `simple_cached_property` was added to support other use
cases. The new cached_property simply builds an actual `property` within
the metaclass. This is fairly efficient, and also reduces the surface
area of behavior.
When writing this I messed around with a few ideas, including allowing
the user of `cached_property` to define a linkage between the property
and fields that should invalidate its cached value, but this was both
messy and introduced massive cognitive load on understand when a
cached_property should be cleared. Although this version is slighty less
efficient, I'm very much in favor of it vs the alternatives I tried.
GUILD_UPDATES are cool and special and of course they are partial.
Although this is logical, our type/models autoinitialize some fields by
default (which is actually fairly sane). However when this happens, we
smash these new blank mappings over the previously updated state.
Instead we should just ignore fields that don't come in GUILD_UPDATEs,
and save our state.
- Add support for attachments and message embeds
- Fix commands being weirdly stored by some key (which doesn't make
sense)
- Added CommandEvent.codeblock which represents the first codeblock in
the message (useful for eval like commands)
- Cleanup the spawn utilties on plugin a bit
- Fix GuildBanAdd/GuildBanRemove
- Unset model fields are now a special sentinel value
- etc stuff
Tl;dr we now use __slots__ in a bunch of places. This could still be
better, and we do a bit too much magic in the modeling to make me happy.
But thats for later, for now we're going from ~250mb on 2500 guilds to
~160mb.
- Allow configuring the state module within the normal configuration
(under the 'state' key)
- Rate limit events being sent on the gateway socket
- Convert to using lazy_datetime in a bunch of places
- Allow configuring guild member sync
- Better logic around loading guilds, add State.ready condition which
can be waited on
- Fix inheritance in the modeling framework (how was this not working
before lol wut)
- Added __slots__ to a bunch of low-hanging fruit models
- Move member sync onto the guild object as Guild.sync()
- Convert to Dannys CachedSlotProperty (could still be better, will
improve later)
- Added util.snowflake.calculate_shard
* Minor spelling fixes
* Minor spelling fixes
* Minor spelling fixes
* Minor spelling fixes
* Minor spelling fixes
* Minor spelling fixes
* Minor spelling fixes
- Storage backends take a config
- Add command permissions
- Add ability to listen to BOTH incoming and outgoing gateway packets
- Heavily refactor cli, now prefer loading from config with options as
overrides
- Add debug function to gateway events, helps with figuring data out w/o
spamming console
- Change Channel.last_message_id from property that looks in the message
tracking deque, to a attribute that gets updated by the state module
- Add State.fill_messages for backfilling the messages store
- Handle MessageDeleteBulk in State
- Add some helper functions for hash/equality model functions
- Fix MessageIterator
- Add Channel.delete_message, Channel.delete_messages
- Some more functional stuff
- Snowflake timestamp conversion
- Bump holster
- Add the concept of storage backends, not fully fleshed out at this
point, but a good starting point
- Add a generic serializer
- Move mention_nick to the GuildMember object (I'm not sure this was a
good idea, but we'll see)
- Add a default config loader to the bot
- Fix some Python 2.x/3.x unicode stuff
- Start tracking greenlets on the Plugin level, this will help with
reloading when its fully completed
- Fix manhole locals being basically empty (sans the bot if relevant)
- Add Channel.delete_messages_bulk
- Add GuildMember.owner to check if the member owns the server
My previous stab at implementing the simple-modeling-orm-thing-tm failed
in the aspect that there was a lot of duplicated code doing runtime
inspection of stuff. This was due mostly to having no extra place to
store information on types, making it hard to introspect how the type
expected to be built, whether it had a default, etc.
This commit refactors the modeling code to actually have a Field type,
which wraps some information up in a simple class and allows extremely
easy conversion without having to do (more) expensive runtime
inspection. This also gives us the benefits of a much more
readable/cleaner code, expandable field options, and not having to fuck
with sphinx to get docs working correctly (it was duping attributes
because they where aliases...)
- s/DiscoClient/Client (was redundant and looked ugly)
- move cached_property to functional utils
- abstract client configuration out to a ClientConfig
- command line utility is now completely isolated from the client
- add ETF (using erlpack) support, optionally enabled via command line
flags (and only works on 2.x because of erlpack)
- Refactor the way gateway events are built a bit
- Add documentation on utilities