Commit Graph

247 Commits

Author SHA1 Message Date
Ske
bd8fb40bc7 Handle systems with (too) many linked accounts 2019-12-22 13:53:38 +01:00
Ske
992a37dd1b Lower logging level of proxy cache messages 2019-12-22 12:50:56 +01:00
Ske
b81eda47aa Expand pk;stats functionality 2019-12-22 12:50:47 +01:00
Ske
93a52ff95a Add exception logging for dropped connections 2019-12-22 12:08:52 +01:00
Ske
6a55555e48 Attempt a few memory/connection optimizations 2019-12-22 01:08:14 +01:00
Ske
9c9e48a799 Upgrade to .NET Core 3.1 2019-12-22 00:40:57 +01:00
Ske
7b55abaacd Properly register command statistics 2019-12-21 21:51:41 +01:00
Ske
3b72fa720b Add warning when setting proxy tags conflicting with another member's 2019-12-21 21:42:06 +01:00
Ske
d42dea9e9f Allow multiple proxy attachments 2019-12-21 20:07:51 +01:00
Ske
474d561c54 Execute webhooks directly rather than through D.NET 2019-12-21 18:50:28 +01:00
Ske
378cba09e5 Add channel blacklists for logging and proxying
Necessary database migrations for this commit:
    alter table servers add column log_blacklist bigint[] not null default array[]::bigint[];
    alter table servers add column blacklist bigint[] not null default array[]::bigint[];
2019-11-03 19:15:50 +01:00
Ske
0cdd99d195 Error when given an invalid image file 2019-11-03 13:56:05 +01:00
Ske
8d003da091 Remove chunk of commented-out outdated code 2019-11-03 13:37:48 +01:00
Ske
03dd91ee9e Update tag change message with more information 2019-11-03 13:37:36 +01:00
Ske
520e6f140c Fix front history lookup with very long switches 2019-11-03 00:46:38 +01:00
Ske
0226e73d88 Improve in-bot command documentation
Adds command descriptions, changes formatting on
command listings, and adds more direct command
listing commands.
2019-11-03 00:29:11 +01:00
Ske
7c3b4b9af9 Add command to delete all switches 2019-11-02 22:46:51 +01:00
Ske
6aa72f68b3 Add syntax error if pk;m proxy is missing arguments 2019-11-02 02:57:55 +01:00
Ske
6c39b7549b Fix message querying actually for real 2019-10-31 21:14:01 +01:00
Ske
0f48c6879b Attempt to fix slow/timeout-y bot startup
I've noticed the bot's CPU spiking for a few minutes as it's
just connecting, and a lot of shard connections are timing out.

I suspect it might be the overload of messages as the shards
connect and Discord sends it the entire backlog at once. So,
as an interim solution, I'm making it simply discard every
message before the socket is fully connected. Hopefully this
should help reduce the pressure.
2019-10-31 17:21:12 +01:00
Ske
f4a5b409c3 Fix message querying for real this time 2019-10-31 16:36:33 +01:00
Ske
1a79d52bfb Add importing of Tupperbox multibrackets 2019-10-30 14:11:24 +01:00
Ske
49dc25ee02 Allow keeping proxy tags when proxying messages.
Required database migration:

Closes #75.
2019-10-30 09:26:50 +01:00
Ske
acadad2a43 Add forgotten conditional to proxy tag clear disclaimer 2019-10-30 08:44:17 +01:00
Ske
b50c123ad4 Properly sort proxies before matching 2019-10-30 08:30:58 +01:00
Ske
393ee16c1b Add support for multiple proxy tags
Tangentially closes #103.
2019-10-30 08:18:59 +01:00
Ske
8f60377d63 Add support for iOS-style quotation marks 2019-10-28 20:17:20 +01:00
Ske
3c7afbfdaa Lower log level of an unnecessary webhook logging message 2019-10-28 17:03:16 +01:00
Ske
c639e9ba1e Include attachment image in message card 2019-10-28 17:02:59 +01:00
Ske
3369a06c4e Fix message querying on accounts with no roles 2019-10-28 16:50:41 +01:00
Ske
bfafdbe2bf Invalidate proxy cache when clearing proxy tags 2019-10-28 00:38:06 +01:00
Noko
eb5fe7d6a4 Allow frontpercent to accept time patterns in system timezone (#135)
The frontpercent command already accepted time patterns (e.g. 9pm), but these were always being interpreted as UTC regardless of the system's configured zone. Furthermore, the time wasn't being nudged to the previous day, so if you tried to do pk;s fp 6pm at 5pm UTC, it would complain about the date being in the future instead of just showing you since 6pm yesterday.

The system zone is now respected and nudging enabled in the same manner as pk;sw move.
2019-10-28 00:21:55 +01:00
Ske
545e8df6a7 Reduce the log level of various common events 2019-10-27 23:44:27 +01:00
Ske
823688e63d Add pk;flash command 2019-10-27 23:03:20 +01:00
Ske
fbb5dbbf5d Don't embed support server link in error message 2019-10-27 23:01:38 +01:00
Ske
46672d264c Refactor log channel storage 2019-10-27 23:01:20 +01:00
Ske
4e98a51363 Fix PermCheck permissions and no-guild invocation syntax 2019-10-27 21:58:04 +01:00
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