Commit Graph

312 Commits

Author SHA1 Message Date
Luna Mendes 660c8d43d9 blueprints.guild.roles: move main pairs algorithm to gen_pairs 2018-10-27 19:36:00 -03:00
Luna Mendes 0e3db251b8 guild.channels: subscribe users to the newly created channel 2018-10-27 02:17:29 -03:00
Luna Mendes 43b0482581 blueprints.guild: split blueprint into channels, members, roles 2018-10-27 02:04:47 -03:00
Luna Mendes 86705b0645 blueprints.guilds: add 2 role endpoints
Add PATCH /api/v6/guilds/:id/roles for multiple position changes for
roles and PATCH /api/v6/guilds/:id/roles/:id for single guild
role changes

 - permissions: add int maigc method
 - schemas: add ROLE_UPDATE and ROLE_UPDATE_POSITION
2018-10-26 21:05:45 -03:00
Luna Mendes 956498ac65 blueprints.guilds: fix guild_owner_check
- blueprints.guilds: fix create_guild_role
 - blueprints.guilds: fix giving ints in the place of snowflakes in some
    events
2018-10-26 16:35:00 -03:00
Luna Mendes a08eb0d068 blueprints.guilds: calculate new role position
- blueprints.guilds: add basic POST /api/v6/guilds/:id/roles
 - schemas: add ROLE_CREATE
 - litecord: add types
2018-10-26 16:21:27 -03:00
Luna Mendes dca1adc6f8 blueprints.guilds: add create_role function 2018-10-26 15:57:24 -03:00
Luna Mendes f8e44d62bd gateway.websocket: handle missing 'channels' on op 14 2018-10-26 04:30:56 -03:00
Luna Mendes 8888534580 blueprints.guilds: misc fixes to channel creation
Instances should run this SQL to maintain consistency with `schema.sql`
```sql
ALTER TABLE guild_channels DROP CONSTRAINT guild_channels_guild_id_fkey;

ALTER TABLE guild_channels ADD CONSTRAINT guild_id_fkey
FOREIGN KEY (guild_id)
REFERENCES guilds (id)
ON DELETE CASCADE;
```
2018-10-26 04:27:48 -03:00
Luna Mendes d2562d3262 schemas: add role_name and verification_level types
- schemas: also fix GUILD_UPDATE.icon and GUILD_CREATE.icon
2018-10-26 04:15:51 -03:00
Luna Mendes 856839d9e7 presence: don't send PRESENCE_UPDATEs about the same user 2018-10-26 03:50:29 -03:00
Luna Mendes e8ebfe6eeb schemas: fix GW_ACTIVITY schema
- blueprints.guilds: use GUILD_CREATE schema
2018-10-26 03:39:11 -03:00
Luna Mendes aaa11be258 blueprints.guilds: add auto-role and auto-channel creation
also simplify a lot of repeated code on the blueprint.

 - litecord: add permissions module
    for future role code

 - schemas: add channel_type, guild_name, channel_name types
 - schemas: add GUILD_CREATE schema
2018-10-26 02:34:17 -03:00
Luna Mendes 75a8e77a21 blueprints.dms: make sure no double dms happen
by first checking existance, then inserting if
none was found.
2018-10-24 19:25:44 -03:00
Luna Mendes 2605836790 dispatcher: add dispatch_filter
- presence: (basic) handle member lists when presence update.
    Note that the respective GUILD_UPDATE_MEMBER_LIST doesn't happen
    yet. we'll need roles beforehand.
2018-10-24 19:09:05 -03:00
Luna Mendes cd4181c327 litecord.pubsub: add more functionality to GuildMemberList
GuildMemberList, as of this commit, can generate a correct list
and handle (some of) the data given in OP 14. The implementation
is still rudimentary and there's a lot of work to finish.

 - dispatcher: add LazyGuildDispatcher
 - gateway.state_manager: add states_raw to fetch
    a single state without uid
 - gateway.websocket: remove rudimentary implementation
    (moved it to GuildMemberList in litecord.pubsub.lazy_guild)
2018-10-24 16:36:24 -03:00
Luna Mendes 1d33e46fd8 pubsub: add lazy_guild 2018-10-19 19:16:29 -03:00
Luna Mendes 79f91cd774 blueprints.users: fix user guild settings
- blueprints.users: make sure a row exists on guild_settings when
    patching
 - schemas: fix all 'bool' types to 'boolean'
 - schemas: fix GUILD_SETTINGS_CHAN_OVERRIDE
 - storage: add Storage.get_guild_settings_one
 - storage: fix Storage.get_guild_settings
2018-10-19 17:36:54 -03:00
Luna Mendes ef5d4f30e1 blueprints: create dms blueprint
It should be safe for instances to run the `schema.sql` file and update.

 - blueprints.users: s/GUILD_SETTINGS_UPDATE/USER_GUILD_SETTINGS_UPDATE
 - storage: fix get_guild_settings returning a dict instead of a list
 - schema.sql: fix types and syntax
2018-10-19 16:21:33 -03:00
Luna Mendes 692f9ef245 blueprints.channels: call try_dm_state on dm pre dispatch 2018-10-19 13:18:14 -03:00
Luna Mendes 8e3b5d79ab blueprints.users: use UPSERT when adding/patching a note
- blueprints.users: move get_mutual_friends to relationships blueprint
2018-10-19 12:17:00 -03:00
Luna Mendes 2df0d843c1 blueprints.users: add patch_guild_settings 2018-10-19 12:01:58 -03:00
Luna Mendes a926ed47ae storage: add Storage.get_guild_settings
- gateway.websocket: use Storage.get_guild_settings
 - schema.sql: chande defaults on message_notifications to 0
2018-10-19 04:45:56 -03:00
Luna Mendes 3a9bc22c60 guilds: set message_notifications = guilds.default_message_notifications 2018-10-19 04:45:14 -03:00
Luna Mendes 6865a5772f blueprints.invites: call create_guild_settings 2018-10-19 04:32:26 -03:00
Luna Mendes 809518f85f blueprints.guilds: add create_guild_settings 2018-10-19 04:32:03 -03:00
Luna Mendes 25b34c6a8a enums: add MessageNotifications
- schemas: add msg_notifications type validator
 - schemas: add GUILD_SETTINGS, GUILD_SETTINGS_CHAN_OVERRIDE
2018-10-19 04:31:20 -03:00
Luna Mendes b1a362418c schema: add guild_settings and guild_settings_channel_overrides 2018-10-19 04:30:52 -03:00
Luna Mendes cabc31360a blueprints.relationships: fix blocking when rel already exists
- storage: fix block fetch
2018-10-15 15:54:40 -03:00
Luna Mendes 151715943b blueprints.relationships: sub/unsub friends on friend request changes 2018-10-15 15:43:00 -03:00
Luna Mendes 1d3520876d gateway: more comments and docstrings 2018-10-13 17:30:02 -03:00
Luna Mendes 6be85ea305 litecord.pubsub: add docstrings for all methods 2018-10-13 16:30:05 -03:00
Luna Mendes 3f54f35dce gateway.websocket: only use pure zlib when payload is big
big here being more than 1024 characters.
2018-10-12 23:41:41 -03:00
Luna Mendes 3d96ccda35 blueprints.users: dispatch USER_UPDATE to guilds and friends
- dispatcher: add EventDispatcher.dispatch_many
2018-10-12 23:32:54 -03:00
Luna Mendes a62bc5af46 enums: add own Flags class
to help with understanding of user.flags and message.activity.type
2018-10-12 23:12:14 -03:00
Luna Mendes 1ab8dc0052 storage: only set mobile and phone when secure=True 2018-10-12 21:36:29 -03:00
Luna Mendes 051cdd8ff2 blueprints.users: finish user patch impl
- blueprints.auth: check availability of username on register
 - enums: add UserFlags
 - schemas: add DATA_REGEX, USER_UPDATE
 - storage: add dummy mobile and phone values on get_user
2018-10-12 21:34:45 -03:00
Luna Mendes 9aec27203b blueprints.auth: dispatch USER_UPDATE when setting verify status 2018-10-12 19:13:57 -03:00
Luna Mendes da4ce66a0c storage: multiple enhancements
storage:
 - don't use SELECT * when get_guild'ing
 - use field::text instead of the str() call madness
 - simplify get_member_data_one
 - fix parent_id being an int on get_channel_data
 - add Storage.get_role
 - better mention resolving on get_message
 - remove Storage.get_all_dms
2018-10-12 19:06:13 -03:00
Luna Mendes d28c0f1bc6 litecord.pubsub: add FriendDispatcher
- gateway.websocket: subscribe to friends on startup
 - presence: dispatch to friends on dispatch_pres
 - storage: add Storage.get_friend_ids
2018-10-12 16:17:29 -03:00
Luna Mendes 46fac95979 gateway.websocket: add presences field to ready payload
- presences: add PresenceManager.friend_presences
 - blueprints.auth: fix resend route
 - pubsub: add DispatcherWithState to decrease amount of
    repeated code between GuildDispatcher and ChannelDispatcher
 - storage: fix relationship id field
2018-10-12 02:10:31 -03:00
Luna Mendes c4db99aa9a blueprints.channels: use ChannelDispatcher
for CHANNEL_PINS_UPDATE and TYPING_START
2018-10-11 23:12:07 -03:00
Luna Mendes 919e5ff903 blueprints.channels: fix close_channel for dms
- dispatcher: add sub() and unsub() alias methods
2018-10-11 23:09:27 -03:00
Luna Mendes 20332805b8 blueprints.channels: support dms on message create
- storage: add Storage.get_dm_peer
 - gateway.websocket: subscribe to dms as well as guilds
2018-10-11 23:01:56 -03:00
Luna Mendes efefb0cc2f blueprints.channels: use ChannelDispatcher for MESSAGE_* events
- storage: add Storage.guild_from_channel
2018-10-11 22:12:51 -03:00
Luna Mendes 37d8114ae2 pubsub: add ChannelDispatcher
- pubsub: call ChannelDispatcher from GuildDispatcher when subbing a
    user
2018-10-11 18:56:40 -03:00
Luna Mendes 5372292f0d blueprints.channels: add route to delete read_state of a channel
- blueprints.checks: change return type from snowflake to (ChannelType,
    snowflake)
2018-10-11 17:53:32 -03:00
Luna Mendes b7f0bd1bb4 run: pass app instance to EventDispatcher
this should help with future DM channel pub/sub, as we'll
have to query the `dm_channel_state` table.
2018-10-11 16:52:15 -03:00
Luna Mendes b43b220882 blueprints.users: add profiles and mutual friends 2018-10-10 20:07:38 -03:00
Luna Mendes 76f3a9f868 storage: use premium_since instead of premium 2018-10-10 19:16:35 -03:00