Commit Graph

13 Commits

Author SHA1 Message Date
Luna 0f600543e8 Refactor GatewayState with proper types
Make websocket loop be inside app context
2020-01-30 01:50:50 +00:00
Luna 83a1c1ae29 black fmt pass 2019-10-25 07:27:50 -03:00
Luna 53d7515f8c all: update copyright year 2019-01-26 19:25:46 -03:00
Luna 2632d033fa all: add GPL header 2018-12-07 02:14:58 -03:00
Luna Mendes 1d3520876d gateway: more comments and docstrings 2018-10-13 17:30:02 -03:00
Luna Mendes 02f2ee6943 Add some lazy loading handling
Mostly adding guild_id to some events. It isn't complete support for
them, but its some of the way there.

 - storage: give guild_id on get_message

 - gateway.websocket: decrease logging for some stuff
    - a debug log for the whole packet is still there for development
       reasons, maybe i'll put it on a config option.

 - gateway.websocket: dispatch an offline presence when the user has no
    connections tied to them anymore
2018-09-28 19:34:50 -03:00
Luna Mendes cd5dbc4886 Rough presence management
Lots of changes to get it working.

One day changes will be able to be small enough to be split across
commits.

 - enums: use enum.Enum, make EasyEnum subclass
 - enums: add ActivityType, ActivityFlags, StatusType
 - gateway.state: use 128 random bits instead of 256
 - gateway.state: add MAX_STORE_SIZE in PayloadStore and check it when
    adding a new payload
 - gateway.websocket: add GatewayWebsocket.update_status
 - presence: add PresenceManager.dispatch_guild_pres and
    PresenceManager.dispatch_pres
 - schema: add snowflake, activity_type, status_external types
 - schema: add GW_ACTIVITY, GW_STATUS_UPDATE
 - storage: fix _channels_extra and fixes for ChannelType as enum instead of
    class
2018-09-10 01:09:09 -03:00
Luna Mendes d62db421b0 gateway.websocket: add basics of resuming
- gateway.state: add PayloadStore
 - state: add last_seq
 - gateway.websocket: send string on non zlib-stream
 - gateway.websocket: add cleanup of state on ws close
2018-06-24 18:28:28 -03:00
Luna Mendes c477b2ed50 storage: add channel fetching logic
- litecord: add enums
 - storage: add get_user
 - storage: use column::text instead of str() in some cases
2018-06-20 17:39:21 -03:00
slice 75c79a6503
add newline before constructor in classes
pep8
2018-06-19 17:55:12 -07:00
Luna Mendes 6f0528eaec gateway.websocket: detach app object from GatewayWebsocket
It doesn't work since quart's objects only work with stuff
that is already from quart, e.g the current_app stuff
requires you to be inside a special hidden context
that only quart functions get.

Gateway code is detached from quart since quart's websocket
stuff can't handle custom error codes.

 - auth: optional db detach
 - gateway.errors: add InvalidShard, ShardingRequired
 - gateway.gateway: pass asyncpg connection and StateManager
 - gateway.state: add repr, etc
 - gateway.state_man: add remove(), fetch_states()
2018-06-19 21:05:26 -03:00
Luna Mendes 77c5a101c6 gateway.websocket: add basics of identify
- auth: add raw_token_check
 - gateway.gateway: pass the app object to GatewayWebsocket
 - gateway.state: add gen_session_id()
 - gateway: add state_man
2018-06-19 19:09:12 -03:00
Luna Mendes 32b9698ea7 add basic gateway logic 2018-06-19 04:06:01 -03:00