Commit Graph

1027 Commits

Author SHA1 Message Date
Luna 0a1ce291a9 gateway.schemas: add bot-related properties
close #129
2021-08-10 23:46:09 -03:00
Luna c0bac8bc21 gateway.schemas: validate Intents as an int 2021-08-10 23:45:57 -03:00
Luna 04b839b969 gateway: cast reset_after_ts to positive value always
close #128
2021-08-10 23:35:38 -03:00
Luna b71950715c fix typo 2021-07-15 00:20:14 -03:00
Luna 0eb37554d3 fix typos 2021-07-14 23:44:04 -03:00
Luna d1b10e7409 fix new joins not subscribing to channels 2021-07-14 23:41:19 -03:00
Luna 9273d8cbda schemas: update invite 2021-07-14 23:41:07 -03:00
Luna 67785920bb lazy_guild: do not remove member nicks 2021-07-14 23:27:30 -03:00
Luna bf5774aa03 schemas: update guild create 2021-07-14 23:27:23 -03:00
Luna 5b0a632b9f handle optional voice regions on guild create 2021-07-14 23:27:07 -03:00
Luna 8f229bf764 pubsub: fix typo 2021-07-14 22:38:51 -03:00
Luna 36e6e078b3 guild: add secondary route for nick updating 2021-07-14 22:37:36 -03:00
Luna 55032aba1e gateway: fix guild_hashes fallback 2021-07-14 22:31:00 -03:00
Luna 2b3f1ac48c gateway: add hack for Request Guild Members 2021-07-14 22:24:28 -03:00
Luna a5c52f5a2c fix typo 2021-07-14 22:24:19 -03:00
Luna a830c9cb77 update gateway schemas 2021-07-14 22:13:09 -03:00
Luna 07edc235f5 lazy_guild: add handling for member losing permissions 2021-07-14 21:45:43 -03:00
Luna 03dd1f0406 pubsub: remove DispatcherWithFlags superclass 2021-07-14 15:53:37 -03:00
Luna 7757c837d0 pubsub: remove flags from dispatchers 2021-07-14 15:51:36 -03:00
Luna f3af9b5f11 pubsub: add intents logic for Guild Member Update 2021-07-14 15:14:51 -03:00
Luna a51840487f pubsub: add passthrough logic 2021-07-14 15:04:33 -03:00
Luna bc1c0f3b20 add intents support to channel dispatcher 2021-07-14 14:59:34 -03:00
Luna dae56a68ae move events-intents table to enums module 2021-07-14 14:59:15 -03:00
Luna c03ed978ca pubsub.guild: replace flags with intents checking 2021-07-11 01:40:05 -03:00
Luna 0119044a6c gateway: remove subscriptions with flags 2021-07-11 01:39:40 -03:00
Luna 33c7db9cbb gateway: add support for intents in identify input 2021-07-11 01:21:46 -03:00
Luna a12ef353d3 add intents to identify schema 2021-07-11 01:21:24 -03:00
Luna 566920b120 enums: make Intents an IntFlag subclass 2021-07-11 01:21:03 -03:00
Luna 49e1938ed6 enums: add Intents flags 2021-07-11 00:20:02 -03:00
Luna 2ae6d3ffd2 remove unused import 2021-07-10 23:44:37 -03:00
Luna 093f11aad9 fix bug on gdm ack leading to no events 2021-07-10 23:42:17 -03:00
Luna 6c2c6500a6 add bulk ack implementation 2021-07-10 23:41:59 -03:00
Luna 87b1257e06 move code to dedicated read_states blueprint 2021-07-10 23:28:17 -03:00
Luna ea8f629e30 webhooks: add type field
close #66
2021-07-10 18:58:11 -03:00
Luna 173a2330fe add validation for guild sync 2021-07-03 00:00:47 -03:00
Luna ba62403674 add schemas for 'resume' and 'request guild' 2021-06-30 18:36:14 -03:00
Luna fe9ccb68a8 add gateway schema module 2021-06-30 18:28:31 -03:00
Luna 8742df1ffa storage: use better defaults for max_members and max_presences 2021-06-26 00:49:29 -03:00
Luna 70678aaaf3 gateway: only remove self if it is in ready.users 2021-06-26 00:32:42 -03:00
Luna 265de527a9 gateway: omit guild.members for user ready
LESS BYTES!!! MORE EFFICIENTER!!!!
2021-06-26 00:27:02 -03:00
Luna 6df48316f5 gateway: remove own user from ready.users 2021-06-26 00:12:52 -03:00
Luna a51c98de0f gateway: deduplicate ready.users array 2021-06-26 00:11:10 -03:00
Luna ae6c85f0ad gateway: populate ready.users array 2021-06-26 00:04:36 -03:00
Luna 03d470dbe7 remove recipient filtering from dm channels 2021-06-25 17:51:15 -03:00
Luna a65f9a9565 gateway: allow more gateway versions 2021-06-25 16:22:43 -03:00
Luna abd2eb94e3 allow api v9 2021-06-25 16:09:41 -03:00
Luna 111444c545 update to quart 0.15.1 2021-06-25 15:42:46 -03:00
Luna 1a2e7446c7 fix winter usage across codebase 2021-06-25 15:32:29 -03:00
Luna 1d2df14527 black run 2021-06-25 15:19:38 -03:00
Luna fa937825df bring joined_at to GUILD_MEMBER_UPDATE
see https://github.com/discord/discord-api-docs/pull/1858
2020-08-03 16:21:08 -03:00
Luna a90b79b3f3 black fmt pass
fix failing ci on !65
2020-08-02 21:26:27 -03:00
Luna 3dc289d90f Merge branch 'patch-2' into 'master'
Prevent ability to add yourself as a friend

See merge request litecord/litecord!65
2020-08-03 00:24:30 +00:00
Mai f9cff687ee Prevent ability to add yourself as a friend 2020-08-03 00:24:29 +00:00
Mai 42df1b38de Lower channel name minlength to 1 2020-08-02 23:40:39 +00:00
Luna 7dfd6d6b7c state_manager: make deletion schedule methods sync 2020-08-02 01:52:20 -03:00
Luna 37585760bb add permissions fields to multi-role fetch 2020-07-30 00:46:05 -03:00
Luna 88d6a19415 don't use copy_current_app_context
in some scenarios, the app context might not be there yet, it's easier
to use the global app instance and embed it in JobManager instead
2020-07-29 18:42:28 -03:00
Luna ad6643421d add route to fetch notes from singular users 2020-07-29 17:39:27 -03:00
Luna de357dd524 add guild-specific voice region list support 2020-07-29 17:22:57 -03:00
Luna 2ad3cd6ad7 ignore unknown guilds when deleting read states 2020-07-29 17:18:47 -03:00
Luna b965532621 handle Permissions being initialized with a str 2020-07-29 16:17:15 -03:00
Luna fa4a4138f0 assert proper overwrite target data is set 2020-07-29 16:15:15 -03:00
Luna 154400a23e add "_new" fields on overwrites and roles 2020-07-29 16:02:26 -03:00
Luna 227c42c27b permissions: add view_guild_insights
the last permission bit

bigint time

o7
2020-07-28 23:26:12 -03:00
Luna 64498ba3f2 only dispatch to states with websockets 2020-06-26 22:21:26 -03:00
Alex Liu b099681dee Updated websocket.py to fix official client errors 2020-06-19 18:57:38 +00:00
Luna 918a20f274 demote unecessary fstrings 2020-06-10 16:02:46 -03:00
Cadence Ember d3cf67c660
Add no-op /users/@me/devices, used by Android 2020-06-10 23:27:36 +12:00
Luna e00888ebb5 gateway: add max_concurrency field
no idea what it means, since it isn't documented.
2020-05-23 12:39:08 -03:00
Luna 1a28fbdf36 remove uneeded webhook_id from sys messages 2020-05-14 17:41:57 -03:00
abc641 96b4a6e60f Fix of gateway mass updating 2020-05-14 20:22:49 +00:00
Keons 96ac9134f0 Update schemas.py 2020-05-13 13:36:43 +00:00
Luna b9e0682a05 Add mypy trick 2020-05-02 01:30:06 -03:00
Luna aac0fd10ea Disallow unsupported guild channel types 2020-05-02 01:28:34 -03:00
Luna 6cf971ac1b Unsub invalid states from guild dispatcher 2020-05-02 01:19:33 -03:00
Luna 373b727084 Add helper bool magic method for state validity
Reported in #102
2020-05-01 11:39:21 -03:00
Luna 82d793ae07 Ignore states without websocket 2020-05-01 11:37:56 -03:00
Luna 1bb0bd2649 Assert roleperms can't be none 2020-04-30 23:46:11 -03:00
Luna c0c759c31e Fix missing argument change on dispatch()
Closes #102
2020-04-30 23:42:51 -03:00
Luna 7b6b696717 Change remove() declaration
Allow Session IDs to be passed, instead of full state objects.
2020-04-05 15:08:18 -03:00
Luna 5b0f4f01d8 Remove double-relationship between state and WS 2020-04-05 14:46:30 -03:00
Luna 6a45da01b8 Handle conn closed when dispatching events 2020-04-05 14:41:49 -03:00
Luna 1cbc4541a8 Handle connection closed when sending RECONNECT 2020-04-05 01:27:29 -03:00
Luna 24ff453c6b Plug state resume into deletion unschedule 2020-04-04 22:50:00 -03:00
Luna 720417d14d Add basic functions for scheduled state removal 2020-04-04 16:12:03 -03:00
Luna b67de9a62d Return None if region isn't set 2020-04-01 20:28:58 -03:00
Luna 6a74a7f990 Fix mypy not catching non-nullability of conn 2020-04-01 20:01:44 -03:00
Luna 29091293f5 black fmt pass 2020-03-31 16:34:41 -03:00
George Tsatsis 82eb6345d1
Coerce snowflakes into int 2020-03-31 22:17:51 +03:00
George Tsatsis 49ff11da48
Looking back, it wasn't a dash, but rather, an underscore. 2020-03-31 04:18:28 +03:00
George Tsatsis 6b3d3c881a
Copy-paste fail (Change func name) 2020-03-31 04:10:05 +03:00
George Tsatsis 6b14d41c93
Possibly fix discovery-splashes icon get 2020-03-31 04:08:56 +03:00
George Tsatsis bdc576b777
Remove splash as a field 2020-03-31 03:50:34 +03:00
George Tsatsis 45b4431c4c
Add discovery_splash to sql definitions for image uploading 2020-03-31 03:35:00 +03:00
George Tsatsis d786edffec
Add discovery_splash 2020-03-31 01:11:57 +03:00
George Tsatsis 4ff1916ebe
Add preferred_locale field 2020-03-31 01:04:58 +03:00
George Tsatsis be089fe4dc
Add PUBLIC to guild enums 2020-03-31 00:31:50 +03:00
George Tsatsis 2aadcc2360
When server has no features, it would not submit changes. 2020-03-30 22:49:58 +03:00
George Tsatsis 92489d0f43
Add public updates channel (to server, not channel type) 2020-03-30 22:19:12 +03:00
George Tsatsis 93958a0943
add rules_channel_id to schemas 2020-03-30 21:02:20 +03:00
George Tsatsis 324cf6d4fa
Create rules channel 2020-03-30 20:57:29 +03:00
George Tsatsis 83721d4525
Fix server update problems (string where supposed to be int) 2020-03-30 20:33:08 +03:00
Visual fdb2afcd36 Fixed broken check & query 2020-03-30 17:16:43 +00:00
Visual 0eccf15750 Fixed broken check 2020-03-30 17:14:43 +00:00
Visual 261753e399 Removed and fixed broken checks 2020-03-30 17:13:39 +00:00
Visual b098044a4b Fixed lazy role position updating due to not making sure that blacklisted id exists in state 2020-03-30 15:26:04 +00:00
Visual 8b1e3fb06e Fixed lazy channel reloading due to missing .bits. attribute 2020-03-30 15:07:48 +00:00
Luna 794fc37033 Merge branch 'master' into feature/validate-error 2020-03-14 17:06:04 -03:00
Luna b1d1f4f228 add better docstring to update_status
- simplify logic to fetch game
 - safer getting when making final status
2020-03-14 20:05:14 +00:00
Luna 2fd86ec1d1 schemas: remove raise_err kwarg 2020-03-14 17:00:39 -03:00
Luna 8dc27ae9de replace more typos for dispatch calls 2020-02-26 14:05:59 -03:00
Luna f69d0aa724 ignore KeyErrors when removing flags 2020-02-26 14:01:22 -03:00
Luna b015cce7a9 fix typo 2020-02-26 13:58:58 -03:00
Luna b1aef75bb2 presence: remove TODO
that function is already shard-aware since we started subscribing at the
websocket start instead of fetching session ids for every single
dispatch.
2020-02-17 22:36:56 -03:00
Luna b0eb3247fd remove code from dispatcher
leftovers are TBD.

 - constrict Dispatcher.dispatch() to arity 3
 - add helper methods to Dispatcher
 - add EventType to Dispatcher

While fixing things, it was discovered that many of the things inside
LazyGuildDispatcher were just interfaces to GuildMemberList, in a very
weird way, just so it could be fitted inside the main Dispatcher. it was
decided to remove those unecessary interfaces, clients shall use the
manager directly.
2020-02-09 21:20:08 +00:00
Luna 39e8a1ad7e images: force-cast to bool inside Icon
reported in #86
2020-02-08 13:28:29 -03:00
Luna e0e59f8b63 fix types (big)
varied fixes across many, many files.
2020-02-06 21:10:51 +00:00
Luna e42aadb6d0 migration.command: dont split on migration 0
(it's a hack)
2020-02-04 20:50:40 +00:00
Luna 7db5ce62c1 presence: fix removed shard field
closes #80
2020-02-03 18:29:11 -03:00
Luna 20bc174ea1 impl: deprecated regions 2020-02-03 20:01:22 +00:00
Luna 41b877fcd0 admin_api.voice: fix path to fix_region_server route
related to #79
2020-02-03 16:21:59 -03:00
Luna fac82d3a6c Merge branch 'master' of https://gitlab.com/litecord/litecord 2020-02-03 06:41:17 -03:00
Luna 9998092db4 admin_api.users: allow PUT method to create user
PUT was the wanted method. POST serves as a fallback.

closes !56
2020-02-03 06:40:34 -03:00
Hampus Kraft a666ca4fc0
feat: adding remaining user flags 2020-01-31 19:15:42 +01:00
Luna 0f600543e8 Refactor GatewayState with proper types
Make websocket loop be inside app context
2020-01-30 01:50:50 +00:00
Luna 9567bf0a85 admin_api.voice: refresh lvsp regions on insert
closes #76
2020-01-29 19:52:44 +00:00
Luna b53a96bc0f common.users: use logbook 2020-01-29 16:29:59 -03:00
Luna cc45500637 Merge branch 'master' of https://gitlab.com/litecord/litecord 2020-01-27 17:25:25 -03:00
Luna c416f01244 schemas: add GUILD_UPDATE.features
closes #75
2020-01-27 17:23:23 -03:00
Hampus Kraft 5a3f927c69
fix: updating vanity URL length 2020-01-26 19:36:35 +01:00
Luna 65069eb668 Merge branch 'master' into multiple-embeds 2020-01-25 14:12:10 -03:00
Luna c8d37019a9 gateway.websocket: ignore compression when encoding=etf 2020-01-25 00:07:31 -03:00
Luna d8a24ad052 embeds: make mediaproxy functions return list of embeds
- embeds: make mediaproxy functions check their types
2020-01-24 21:13:34 -03:00
Luna a76460bea1 varied fixes due to sed fuckups 2020-01-06 22:55:20 -03:00
Luna 3481165bc5 everything: use winter 2020-01-06 21:38:29 -03:00
Luna bc3fa37d63 guild.members: use context manager for pool conn acquire 2019-11-15 20:37:10 -03:00
Luna e917982f6d guilds: remove unused import 2019-10-26 12:00:31 -03:00
Luna 44315b0845 move add_member to common.guilds
this decreases copy-pasting of the 'INSERT INTO members' line, and
add_member gets a `basic` kwarg to remove gateway side-effects

 - errors: add 40007 error code to ERR_MSG_MAP
 - invites: use 40007 and 10006 error codes
2019-10-26 11:57:43 -03:00
Luna 27b5836132 invites: check maximum invite count 2019-10-26 11:52:26 -03:00
Luna 23034aadbd errors: add 30016 err code to ERR_MSG_MAP 2019-10-26 11:49:54 -03:00
Luna 6dc591e853 allow presences boolean on request guild members
see 5454bdf4e0 for source
2019-10-26 11:47:12 -03:00
Luna ca7f1eae6b user.billing: fix import 2019-10-25 16:44:39 -03:00
Luna 7c3e9ec2c7 move create_guild_settings to common.guilds 2019-10-25 16:19:18 -03:00
Luna c765cd7fe0 fix imports 2019-10-25 16:01:48 -03:00
Luna 91d70d2c41 fix imports to common.users 2019-10-25 13:52:33 -03:00
Luna f1e6baffd2 move user functions to common.users 2019-10-25 13:48:22 -03:00
Luna ffa244173c messages: remove double import 2019-10-25 13:41:11 -03:00
Luna b41d3b6f36 guilds: use common, remove delete_guild() from it 2019-10-25 13:39:22 -03:00
Luna 2ebb94f476 messages: use common/utils functions 2019-10-25 13:36:02 -03:00
Luna a67b6580ba make other blueprints use common, etc 2019-10-25 13:33:52 -03:00
Luna 1efc65511c create litecord.common 2019-10-25 13:31:47 -03:00
Luna 71a058e542 Merge branch 'master' into enhance/refactor-and-move-internals 2019-10-25 12:00:47 -03:00
Luna ccf79c9186 fix op code 23 handler name 2019-10-25 12:00:31 -03:00
Luna ab89b70ddc fix create_user call 2019-10-25 11:33:19 -03:00
Luna 2bc7bb3924 fix some calls not needing app 2019-10-25 11:31:12 -03:00
Luna f6f50a1cff remove app param from billing functions 2019-10-25 11:23:40 -03:00
Luna ce04ac5c5f remove app param from guild_region_check() 2019-10-25 10:52:46 -03:00
Luna e0a849fa6a fix callers of embed functions due to param changes 2019-10-25 10:49:35 -03:00
Luna 2024c4bdf8 remove app parameters from embed functions 2019-10-25 10:40:26 -03:00
Luna 2780ca4175 guilds: remove app_ param from delete_guild() 2019-10-25 10:24:20 -03:00
Luna 420646e76f revamp how Flags works
instead of pulling a hack and injecting from_int() in `__init_subclass__`, we
just make an actual function, and cache the wanted attributes in the subclass
at its creation

this fixes statis analyzers claiming from_int() doesn't exist on
subclasses, for good reason, as they'd be turing-complete to do so, lol

 - auth: fix some mypy issues about reusing same variable
2019-10-25 10:00:35 -03:00
Luna 7278c15d9c gateway.websocket: remove WebsocketObjects
we can just use the app object directly.
2019-10-25 09:41:52 -03:00
Luna 7c878515e9 make JobManager.spawn copy current app context 2019-10-25 09:38:48 -03:00
Luna 2674e76e62 blueprints.auth: fix create_user call 2019-10-25 09:00:21 -03:00
Luna a3f793a211 remove some app and db params/kwargs from auth functions 2019-10-25 08:56:07 -03:00
Luna b0ef3c4d0c tests.conftest: use app_context for delete_user call
- admin_api.users: remove app arg passing
2019-10-25 08:51:52 -03:00
Luna f54c002a31 remove app kwargs from delete_user and mass_user_update
- manage.cmd.users: don't send updates when deleting users

the rationale for this is that while we have an app.dispatcher, it is
fully empty since we created a mock just for manage.py operations. to
have proper side-effects occouring on the actual main app, we'd need to
implement some kind of IPC, and i'm not up for that task, yet.
2019-10-25 08:47:04 -03:00
Luna 0cc1062c52 flake8 pass
- fix test_empty_embed not actually reporting on empty embeds
2019-10-25 08:06:26 -03:00
Luna 83a1c1ae29 black fmt pass 2019-10-25 07:27:50 -03:00
Luna 586256ed65 users: make delete_user receive app instance 2019-09-30 10:53:42 -03:00
Luna f6a5dfe3d9 users: change area of concern for the gw side-effects 2019-09-30 10:49:02 -03:00
Luna 3e15f9a518 users: send user and presence updates for deleted user 2019-09-30 10:43:30 -03:00
Luna 9c2e04a17c gateway.websocket: add placeholder handler for opcode 23 2019-09-29 22:53:07 -03:00
Luna 4d7b8f519f users: properly close underlying websocket when disconnecting 2019-09-13 21:45:08 -03:00
Luna 9346c5c52c embed.sanitizer: check for MEDIA_PROXY being None 2019-09-13 18:52:20 -03:00
Luna 3973ca863c gateway.websocket: cast user_ids to List[Union[int, Any]]
this finishes the implementation, as before it was simply List[Any]
(List[str] on well-formed requests), which means Any was always being
passed to get_member_multi, which only works with ints.
2019-09-07 12:13:21 -03:00
Luna f1ca177118 storage: add guild.preffered_locale hardcoded field 2019-09-02 16:18:23 -03:00
Luna ef6361dbda channels: update local message var when changing flags
- embed.messages: propagate payload.flags when updating msg embeds
 - enums: fix typo
 - channels: fix flag helper functions
 - storage: only fill res.member when user_id is given
 - storage: sentinel value is 0 instead of none for flags removal
2019-09-01 19:18:54 -03:00
Luna e0d253f36f add message flags updating on suppress embeds 2019-09-01 18:03:29 -03:00
Luna 63ab8ea064 add messages.flags column 2019-09-01 17:31:24 -03:00
Luna 9b1f5cbb60 channels: use a set for message_ids
- channels: check result of db call on bulk delete
2019-09-01 15:30:21 -03:00
Luna 1b4c39fe23 errors: check args[0] for integer values and convert to ERR_MSG_MAP
- channels: s/weeks/days
 - schemas: handle reqjson being None on validate()
2019-09-01 15:25:28 -03:00
Luna 00f7e076ac channels: add checking of message id's age in bulk delete 2019-08-28 15:22:34 -03:00
Luna e4386e8656 channels: add bulk delete sql query
- schemas: add minlength, maxlength to BULK_DELETE
2019-08-27 22:32:38 -03:00
Luna 93237e34f8 add bulk delete endpoint
- schemas: add BULK_DELETE
2019-08-27 22:14:38 -03:00
Luna b8a4125482 permissions: add stream permission 2019-08-13 12:11:01 -03:00
Luna 27ec018bf5 guild.mod: use request.args on guild prune
- schemas.GUILD_PRUNE: add default parameter to days, add compute_prune_count
2019-08-02 11:59:46 -03:00
Luna fa1151c759 fix spawn_embed's app and remove where clauses for conflict row 2019-07-23 16:22:38 -03:00
Luna 2086ee2849 channels: fix inferred constraint name 2019-07-23 15:46:00 -03:00
Luna db00724379 fix channel overwrite creation and constraints 2019-07-23 15:40:23 -03:00
Luna 39fd7577b8 channel.messages: add checks for Embed Links permission 2019-07-23 14:52:26 -03:00
Luna 13b2bfe242 Merge branch 'impl/suppress-embeds' into 'master'
Implementation for embed suppressing

See merge request litecord/litecord!41
2019-07-21 03:27:28 +00:00
Luna c5020f202e quickfixes 2019-07-21 00:15:48 -03:00
Luna 80a54e8b8d ignore when flags.presence isn't given 2019-07-20 14:39:22 -03:00
Luna f99ad7a207 pubsub.guild: drop presence flags when passing it to channels 2019-07-20 13:22:56 -03:00
Luna ad751cdad7 pubsub.guild: only pass flags when required 2019-07-20 13:21:32 -03:00
Luna fb18662af4 dispatcher: fix typo 2019-07-20 13:16:41 -03:00
Luna 91679c3aee fix import 2019-07-20 13:08:08 -03:00
Luna 49ed61438c pubsub: add indirection layer to access flags 2019-07-20 13:05:47 -03:00
Luna 29d13c53b8 pubsub.channel: add flags to ChannelDispatcher 2019-07-20 13:00:19 -03:00