Commit Graph

460 Commits

Author SHA1 Message Date
Ske
523469e5e6 Remove preemptive warning messages for unproxyable members
The member length limit is now long enough that it's unlikely to
hit the cap by accident. An error will still be displayed if you
attempt to perform a message proxy.
2019-10-27 21:57:31 +01:00
Ske
c8b4d186d8 Prioritize member lookup by name over ID 2019-10-27 20:48:48 +01:00
Ske
b19b2fbb38 Fix matching multiple consecutive quoted strings 2019-10-27 17:09:15 +01:00
Ske
7f55fca625 Make prefix matching case-insensitive 2019-10-27 15:08:33 +01:00
Ske
6538c5d054 Fix line endings in WebhookCacheService 2019-10-27 13:09:07 +01:00
Ske
aed38f37f7 Allow starting bot before all shards are up 2019-10-27 13:01:33 +01:00
Ske
6a73b3bdd6 Refactor data stores, merging the Store classes 2019-10-26 19:45:44 +02:00
Astrid
029eed3786
Merge pull request #134 from nephanim/feature/member-limit
Add members per system cap & improve import performance
2019-10-22 19:33:30 +02:00
Ske
53ae0e3d70 Improve error handling and reporting after command rewrite 2019-10-22 19:31:40 +02:00
Noko
3d21adeec9 Fix reversal of import response messages
Some of the command rewrite changes resulted in the response messages for importing a system being swapped. When importing without an existing system (ctx.System == null), we want to display the "new system" message. Otherwise, show the count added/modified.
2019-10-20 02:22:22 -05:00
Noko
397da2e1fa Added max member count to limits
A given system can now have up to 1000 members. Within 50 members of that limit, a warning will display whenever a new member is created via the bot. Once the limit is reached, a final warning will appear indicating that no additional members can be created unless members are first deleted. Attempting to create a new member at that point by any method will result in an error message indicating that the limit has been reached.

Respecting this in pk;import required some restructuring to tease apart which members already exist and which ones need to be created prior to creating any members as it seems preferable to fail early and give the user the ability to intervene rather than pushing the system to the member cap and requiring manual deletion of "lower priority" members before others can be created. One consequence of the restructure is that existing members are being read in bulk which is a performance improvement of 25-70% depending on how many switches need to be imported (the more members you have, the more noticeable this is).
2019-10-20 02:16:57 -05:00
Astrid
af4da8fd72
Merge branch 'master' into patch-2 2019-10-18 13:37:09 +02:00
Ske
c4d28f64c7 Display system/member created date in embed footer.
Closes #122.
2019-10-18 13:29:16 +02:00
Astrid
1d7a4d78db
Merge pull request #126 from xBelladonna/feature/messagecard-nickname
Display guild user nickname on message card if set
2019-10-18 13:22:48 +02:00
Ske
83c709b69d Sanitize more inputs 2019-10-18 13:14:36 +02:00
Ske
1988b29fbc Refactor command system 2019-10-05 07:41:00 +02:00
xBelladonna
658bcf1faf Display guild user nickname on message card if set 2019-09-22 02:04:20 +09:30
Ske
0ec522ca0a Display member roles in message query card 2019-09-21 15:19:38 +02:00
Ske
86d0b24758 Include event ID in Sentry dump 2019-09-02 20:37:24 +02:00
Grey Himmel
ad6624ce02
Order members regardless of name case
Add `toLower()` method to the sorting used in system lists, so members are ordered regardless of if the first letter of their name is upper or lowercase
2019-08-25 20:25:37 -04:00
Ske
9b0b8b4353 Fix Clyde, also without an attachment 2019-08-14 07:21:03 +02:00
Ske
74e0508065 Increase webhook name limit to 80 2019-08-14 07:16:48 +02:00
Ske
4e69531103 Ignore invalid colors in member card 2019-08-13 21:49:43 +02:00
Ske
4d2c843442 Handle busy indicator without permission properly 2019-08-12 18:07:29 +02:00
Ske
fb7f31d42d Invalidate proxy caches on more editing commands 2019-08-12 17:49:07 +02:00
Ske
d8503001eb Show an error when a bad import URL is given 2019-08-12 17:47:35 +02:00
Ske
8396e17a87 Attempt to fix webhook invocation errors 2019-08-12 16:38:34 +02:00
Ske
5f79aaf960 Fix API service injection 2019-08-12 06:54:28 +02:00
Ske
5728f94e00 Fix stats command 2019-08-12 06:24:37 +02:00
Ske
a48940476c Eagerly discard messages before shard init 2019-08-12 06:10:55 +02:00
Ske
7945603cdb Include invite link in error message 2019-08-12 06:03:20 +02:00
Ske
d3f821a266 Send a request ID on error 2019-08-12 05:56:05 +02:00
Ske
145ecb91ad Refactor proxy service 2019-08-12 05:47:55 +02:00
Ske
fda98bc25f Lower message cache size 2019-08-12 05:03:18 +02:00
Ske
17c8b7b765 Properly retry client creation on failure 2019-08-12 04:42:16 +02:00
Ske
5b13c1b100 Cache the entire webhook client rather than just the token 2019-08-12 04:32:01 +02:00
Ske
1b32cd8b6d Log webhook send progress 2019-08-12 04:16:17 +02:00
Ske
c68ce1bdd3 Log gateway latency to console 2019-08-12 04:05:22 +02:00
Ske
aa04d2055e Avoid deleting messages from the store if they're not webhooks 2019-08-12 03:51:54 +02:00
Ske
423d23faf7 Cache account lookup in memory when proxying 2019-08-12 03:48:08 +02:00
Ske
99ec3cd355 Instrument and log database queries 2019-08-12 02:05:30 +02:00
Ske
ea476d4051 Yield event handlers to task queue before handling 2019-08-12 01:15:55 +02:00
Ske
a689d61788 Collect webhook response time and shard latency 2019-08-12 00:57:23 +02:00
Ske
90c6869b00 Collect statistics about shard status 2019-08-12 00:35:30 +02:00
Ske
b593c32950 Add more extensive debug-level logging
- Logging of event IDs
- Logging of command invocations (at DEBUG)
2019-08-12 00:07:29 +02:00
Ske
942022d408 Track database handles over metrics 2019-08-11 22:56:20 +02:00
Bella | Nightshade
9f2faeea5a Escape markdown in proxy tags on member card (#118)
* Fix a typo

* Escape markdown in proxy tags on member card

* Whoops hhh

Added API documentation for POST to member endpoint
2019-08-09 12:55:15 +02:00
Ske
3f6a260fac Properly associate trigger events with Sentry errors 2019-08-09 12:47:46 +02:00
Ske
606f48fdb5 Add display name to member card 2019-08-09 10:39:03 +02:00
Ske
200ba6d84c Add member proxy display names 2019-08-09 10:12:38 +02:00
xBelladonna
fabf772085 Return original message ID to log channel
Logs the original (deleted) message's ID in addition to the proxied message's ID to the log channel if configured
2019-08-08 11:01:36 +02:00
Ske
cf263af44c Fix wraparound on paginated lists 2019-08-04 13:52:41 +02:00
Ske
fe22ba4f32 Truncate member profile in long system list 2019-08-04 13:52:41 +02:00
Ske
59dbc5368b Filter everyone/here pings if the proxy sender doesn't have permission 2019-07-28 15:38:41 +02:00
Ske
4eb9ee601d Add command to check channel permissions for proxying 2019-07-26 12:05:09 +02:00
Ske
a9444fa8c6 Update member creation message with website link 2019-07-26 11:20:30 +02:00
Ske
967b4f9ae0 Add redirect message for member help command 2019-07-26 11:17:42 +02:00
Ske
defbf37cfe Fall back to system avatar when no member avatar is set 2019-07-26 11:08:06 +02:00
Ske
b14666aa4f Store the ID of the trigger message in the database 2019-07-24 13:38:54 +02:00
Ske
11eabe2e3d Update D.NET version and add bulk deletion support 2019-07-21 17:16:04 +02:00
Ske
4fe80749c4 Fix compiler warnings CS1998 and CS4014 2019-07-21 16:43:28 +02:00
Ske
a078fcdf47 Add description as a field at the bottom of member and system embed 2019-07-21 16:29:48 +02:00
Ske
45f468fe21 Properly clean up after proxy operations 2019-07-21 04:27:04 +02:00
Ske
2620d2da9c Collect webhook cache statistics 2019-07-21 04:15:47 +02:00
Ske
bb6378df63 Add more complex process performance tracking 2019-07-21 00:01:02 +02:00
Ske
4f33ed84ac Disable message caching
This will potentially fix the memory leaking issues.
2019-07-20 23:10:26 +02:00
Ske
a4f2735c64 Make color set command case-insensitive 2019-07-19 14:54:40 +02:00
Ske
3d073df359 Fix avatar setting by mention 2019-07-19 14:21:16 +02:00
Ske
b85c79c57b Expand logging capability 2019-07-19 02:29:08 +02:00
Ske
52962f1b97 Bounds check proxy tags before extracting inner message 2019-07-19 02:14:46 +02:00
Ske
1577eb7041 Log channel ID rather than name 2019-07-18 17:29:09 +02:00
Ske
0b4335ccaa Add logger to API service setup 2019-07-18 17:26:06 +02:00
Ske
961bfe9094 Add basic logging framework 2019-07-18 17:13:42 +02:00
Ske
dfbb5cd2d6 Add fronter info to system card 2019-07-18 14:05:02 +02:00
Ske
1ad01703b0 Add system tag to embed card 2019-07-18 14:01:28 +02:00
Ske
63cdb43496 Put member name in code block in lookup error message 2019-07-18 14:00:30 +02:00
Ske
a188c64a0e Clean up unused imports 2019-07-17 13:38:23 +02:00
Ske
f53344cd89 Fix front percent returning negative percentages and ranges 2019-07-17 13:37:43 +02:00
Ske
02b41413b3 Add basic InfluxDB reporter 2019-07-16 23:34:22 +02:00
Ske
2d58705e85 Add basic WIP metrics system 2019-07-16 21:59:06 +02:00
Ske
d5da3bf004 Clamp frontpercent range to actual switch range 2019-07-16 21:18:46 +02:00
Ske
003f64abbd Allow setting member avatar by mention 2019-07-16 20:17:04 +02:00
Ske
51b9afddea Properly format Sentry message breadcrumbs 2019-07-16 01:32:08 +02:00
Ske
2aae92406a Remove Sentry scope setup for now 2019-07-16 01:28:55 +02:00
Ske
5599f0a4a8 Add system avatar command (which I totally forgot) 2019-07-15 23:50:32 +02:00
Ske
2f90e7c050 Show sender account in message card 2019-07-15 22:11:08 +02:00
Ske
99919ea6ea Add member color to card 2019-07-15 22:06:08 +02:00
Ske
66690423e8 Allow calling frontpercent with arguments containing spaces
Closes #113 (for real this time).
2019-07-15 21:53:55 +02:00
Ske
b6ba24d171 Show front percent for switches with no fronter
Closes #113.
2019-07-15 21:51:41 +02:00
Ske
05f7ead62e Correctly order members in front percent embed 2019-07-15 21:41:24 +02:00
Ske
206d403526 Ignore proxying messages with no content and no attachment 2019-07-15 21:37:34 +02:00
Ske
6668cd8d2d Swallow 404 when deleting proxied message 2019-07-15 21:36:12 +02:00
Ske
d47e7e7a06 Don't process messages until we're fully connected to shard zero 2019-07-15 21:29:45 +02:00
Ske
18e4d7c9ac Add preliminary Sentry support 2019-07-15 21:02:50 +02:00
Ske
3a6e061e44 Avoid making an extra request to fetch message body in webhooks 2019-07-15 17:53:01 +02:00
Ske
da307c2dc9 Display member count on system card 2019-07-15 17:36:10 +02:00
Ske
7475980bd3 Fix sharding issue hopefully for good 2019-07-15 17:23:27 +02:00
Ske
4198a493e4 Fix references to wrong client type 2019-07-15 17:17:57 +02:00
Ske
1f3b0c6de6 Properly initialize a sharded client 2019-07-15 17:16:14 +02:00
Ske
55aa90b971 Fix member info usage string 2019-07-15 15:28:32 +02:00
Ske
0a8aeebb23 Fix error showing system card with deleted linked account 2019-07-15 00:05:19 +02:00
Ske
382f533dda Pluralize 'fronter' when applicable 2019-07-14 23:49:14 +02:00
Ske
76d757cae1 Show member fronter card on separate lines 2019-07-14 23:18:51 +02:00
Ske
c6d6a728c9 Fix proxying members named 'Clyde' 2019-07-14 21:27:13 +02:00
Ske
1d35838fa4 Hint at 5-char member ID when registering multi-name member 2019-07-14 21:19:48 +02:00
Ske
d78e4c4502 Send export file in DMs 2019-07-14 21:14:16 +02:00
Ske
ebc311ecc3 Remove message query reaction AND open DB connection when obtaining one 2019-07-14 05:23:27 +02:00
Ske
a41e20a0a3 Fix importing with no existing system 2019-07-11 22:46:18 +02:00
Ske
c6905f4ca1 Allow single quotes in command arguments 2019-07-11 22:34:38 +02:00
Ske
d829630a35 Fix database connection pool contention (maybe)
Instead of acquiring a connection per service per request, we
acquire connections more often but at a more granular level, meaning
they're also disposed of more quickly instead of staying for a long time
in case of long-running commands or leaks.
2019-07-11 21:25:23 +02:00
Ske
ca56fd419b Fix various issues with proxying and webhook caching 2019-07-10 23:16:17 +02:00
Ske
8e0e37ed54 Yes. 2019-07-10 13:57:59 +02:00
Ske
31173af87d Add more command aliases 2019-07-10 13:55:48 +02:00
Ske
352940abbd Sanitize user input in response messages 2019-07-10 13:44:03 +02:00
Ske
740ccf6979 Fix sending message attachments 2019-07-10 12:52:02 +02:00
Ske
5bdb229b34 Fix errant dollar sign in log embed 2019-07-10 12:49:09 +02:00
Ske
53b3378901 Fix importing by URL 2019-07-10 12:36:51 +02:00
Ske
305d8f220e Add usage strings to all commands 2019-07-10 12:03:41 +02:00
Ske
1bd5e7e3ca Clarify datetime format in switch move error 2019-07-10 11:09:08 +02:00
Ske
942b620640 Clarify color code format in error 2019-07-10 10:03:26 +02:00
Ske
372a618cbe Bounds check color parameter validation 2019-07-10 10:02:46 +02:00
Ske
9b488d1ab5 Add more lenient prefix parsing 2019-07-10 10:01:06 +02:00
Ske
8dea58437d Add short-hand group aliases 2019-07-10 09:35:37 +02:00
Ske
de9554810a Disallow switching to member in another system 2019-07-10 00:25:47 +02:00
Ske
9a5152a74c Add member routes to API 2019-07-10 00:19:18 +02:00
Ske
4874879979 Add basic API, only with system endpoints 2019-07-09 20:39:29 +02:00
Ske
ce999895c8 Add basic help command 2019-07-01 17:57:43 +02:00
Ske
b5c9793578 Add config file loading 2019-07-01 00:55:41 +02:00
Ske
42147fd9cc Add front percent command 2019-06-30 23:41:01 +02:00
Ske
7eeaea39fe Proxy messages with a mention before tags 2019-06-27 10:38:45 +02:00
Ske
53037f7d52 Add message querying by ? reaction 2019-06-21 14:13:56 +02:00
Ske
93fff14053 Fix skipping proxying of members with no tags 2019-06-21 13:53:19 +02:00
Ske
6e7950722d Fix log channel clearing 2019-06-21 13:52:34 +02:00
Ske
2c3c46002a Add message lookup and log channel setting commands 2019-06-21 13:49:58 +02:00
Ske
06edc9d61e Add API token commands 2019-06-20 21:15:57 +02:00
Ske
5dafc4fbd4 Add front history command 2019-06-15 12:43:35 +02:00
Ske
f4a53ce815 Refactor date/time format constants 2019-06-15 12:33:24 +02:00
Ske
fa5a616716 Add system fronter command 2019-06-15 12:19:44 +02:00
Ske
5d15a973f1 Add customization of invite link client ID. Closes #77. 2019-06-15 12:03:07 +02:00
Ske
e66c815295 Remove unused function 2019-06-15 11:55:40 +02:00
Ske
1e1ef4495f Add Tupperbox importing support 2019-06-15 11:55:11 +02:00
Ske
652afffb8c Add importing and exporting function 2019-06-14 22:48:19 +02:00
Ske
cd9a3e0abd Expand system time selection logic 2019-06-13 23:42:39 +02:00
Ske
72cb838ad7 Add system time zone command 2019-06-13 20:33:17 +02:00
Ske
6cfa4cb2e5 Add usage strings to switch commands 2019-06-13 17:07:49 +02:00
Ske
d109ca7b57 Add switch deletion command 2019-06-13 17:05:50 +02:00
Ske
7e9b7dcc98 Add switch commands for adding and moving 2019-06-13 16:53:04 +02:00
Ske
4c6790432b Add system linking commands 2019-05-21 23:40:26 +02:00
Ske
8b8ec80944 Move database/mapper setup code to Core 2019-05-19 22:03:45 +02:00
Ske
08afa2543b Add member avatar edit command
This also refactors a large portion of the DI toolchain, since
I discovered that you shouldn't be reusing IDbConnection objects.

Instead, most services and stores are now declared transient, and
the webhook cache has been moved to a database-independent storage
singleton by itself.
2019-05-17 01:23:09 +02:00
Ske
1824bfd6bb bot: fix proxy service testing members with no tags set 2019-05-13 23:12:58 +02:00
Ske
72a2fadff8 bot: add member deletion command 2019-05-13 23:08:44 +02:00
Ske
5fc91d895c bot: add proxy tag edit command 2019-05-13 22:56:22 +02:00
Ske
62dc2ce78e bot: add birthday command 2019-05-13 22:44:49 +02:00
Ske
b42e052fee bot: add member lookup command 2019-05-12 00:44:02 +02:00
Ske
c63e20ca50 bot: fix command dispatch 2019-05-12 00:22:48 +02:00
Ske
cf2598baa5 bot: add color change command 2019-05-11 23:56:56 +02:00
Ske
495edc3c5e bot: use MemberStore in member type reader 2019-05-08 20:53:01 +02:00
Ske
9b49f22048 bot: enable .NET configuration management 2019-05-08 20:08:56 +02:00
Ske
c5d2b7c251 refactor project structure 2019-05-08 00:06:27 +02:00