Commit Graph

372 Commits (4a548dc2612a71c356db272f260adc2d204ce076)

Author SHA1 Message Date
Dragory d05672a2dc
Expose the display roles module to plugins 2020-10-22 00:53:13 +03:00
Dragory f4ced372ba
Fix SQL syntax error when using snippets 2020-10-22 00:47:59 +03:00
Dragory 371c49981c
Fix missing -v/-s options for !loglink, add same options for !logs 2020-10-22 00:40:04 +03:00
Dragory bbca6a873f
Allow setting a default display role
Same command as for threads, !role, but used outside a thread.
2020-10-22 00:17:14 +03:00
Dragory 2d13f88ccc
Add `fallbackRoleName` option. Don't include "Moderator" in role-less anonymous replies unless `fallbackRoleName` is set. 2020-10-21 23:24:45 +03:00
Dragory 0e2135943f
Add !role command to change the role displayed in your replies 2020-10-21 23:15:41 +03:00
Dragory 5815157190
Refuse to send replies with an unknown inline snippet
This behavior can be disabled by setting the following option:
errorOnUnknownInlineSnippet = off
2020-10-21 22:33:17 +03:00
Dragory 3e44416077
Only consider single words as inline snippets
Optionally surrounded by whitespace.
This mirrors the restrictions on !!snippets.
2020-10-21 22:30:41 +03:00
Dragory 9a88a6ef89
Fix multiple inline snippets breaking 2020-10-21 22:26:43 +03:00
Dragory ddb759f6ae
Add !s as an alias for !snippets 2020-10-21 22:21:46 +03:00
Dragory db40c39dfa
Snippets are now case-insensitive everywhere 2020-10-21 22:21:04 +03:00
Dragory 90dd35194c
Add support for inline snippets. Fixes #464 2020-10-21 22:07:35 +03:00
Dragory ccd56a1d88
Handle error 1006 (Connection reset by peer) gracefully 2020-10-21 21:41:38 +03:00
Dragory 012bd5b9b2
Fix faulty chunking for received user messages
The chunks now properly handle code blocks and prefer to split
at a newline rather than arbitrarily within the text.
2020-10-21 21:36:50 +03:00
Dragory 0a98b5cb49
Don't remove !edit command if it fails 2020-10-21 21:29:20 +03:00
Dragory 4ecea31fd8
Fix 'undefined' message numbers 2020-10-21 21:28:06 +03:00
Dragory d5ea95d9e9
Limit replies to fit within one message
This applies to both the DM to be sent to the user, and the message
created in the thread channel.

This is because edits (via !edit) could change the amount of messages
a reply takes (based on message formatting), leading to either being
unable to post the full edit if it goes over the message limits, or
having to edit a previous message to be 'empty' if the result of the
edit would take fewer messages to post than the original reply.

This also fixes an issue where !edit/!delete would not apply to more
than the first message created by a reply - whether in user DMs or in
the thread channel.
2020-10-21 21:09:50 +03:00
Dragory 42f6e79df8
Remove faulty message chunking logic in user DMs
The logic could cause things like code blocks get cut in the middle
without being handled gracefully. With this change, messages sent
to the user can take, at most, 1 message. This does not affect
messages in the thread channel.
2020-10-21 21:01:40 +03:00
Dragory 192fec6952
Fix rounding in thread messages that only contain an ID
Internally, the thread_messages table's body column's type was
undefined in sqlite. This is because it was set to mediumtext, but
sqlite doesn't have that type. Because of that, sqlite treated the
column as a numeric column. Sqlite also allows storing text data in
numeric columns (because reasons), so in most cases everything worked
fine. It was only when storing an actual number, like an ID, that it
was also *treated* as a number. And since snowflake IDs are larger
than the maximum safe integer in JavaScript, the stored ID could get
rounded when retrieving data from the database.
2020-10-19 01:50:12 +03:00
Dragory 5b0f9d31b7
Create new message types for staff reply edits/deletions
This has backwards-compatibility-breaking changes to the formatters
of staff reply edits/deletions, which now only receive the
thread message for the edit/deletion with the original data in
the thread message's metadata.
2020-10-12 20:54:54 +03:00
Dragory 5de750bc3e
Add metadata field for thread messages 2020-10-12 20:53:53 +03:00
Dragory f9671c385d
Add formatters for system messages
This has backwards-compatibility-breaking changes to the signature
of thread.postSystemMessage() and thread.sendSystemMessageToUser().
2020-10-12 20:33:49 +03:00
Dragory c9e0dbf040
Handle unhandled rejections the same way as uncaught exceptions 2020-10-12 20:00:55 +03:00
Dragory f5caa80c4c
Allow plugins to access the 'threads' module for creating new threads 2020-10-12 20:00:25 +03:00
Dragory a3c1ed0a28
Include DM message in beforeNewThread hook data. Allow specifying categoryId in createNewThreadForUser(). 2020-10-12 19:59:47 +03:00
Dragory aadda31069
Add metadata field for threads
Useful for e.g. storing plugin-specific data about a thread.
2020-10-12 19:57:39 +03:00
Dragory d8c531cb4d
Add support for different plugin sources; add support for installing plugins from npm 2020-10-04 16:46:43 +03:00
Dragory 9048942ce9
Expose web server express application to plugins 2020-10-04 02:10:13 +03:00
Dragory e99352e2ac
Use Express as the web server for logs/attachments 2020-10-03 16:40:05 +03:00
Dragory 0d2202d38c
Allow log storage handlers to store data. Add shouldSave() function to log storage handlers. 2020-10-03 16:10:27 +03:00
Dragory 3937c0a838
Start expiredBlockLoop() directly, not on "ready" event
This is because the client is already ready by this point, as plugins
are only loaded after the ready event.
2020-10-03 15:18:27 +03:00
Dragory 19b9d4db61
Fix missing await when removing blocks 2020-10-03 15:17:30 +03:00
Dragory 454ab75fec
Fix !newthread failing with uncached users 2020-09-25 01:42:37 +03:00
Dragory 3a7f7ffc90
Add support for alternative log storage types 2020-09-23 03:16:26 +03:00
Dragory a7e863da6a
Move migration files within src
This means that the db folder no longer contains any code required
for the bot to run.
2020-09-23 02:34:40 +03:00
Dragory 0d29859dd8
Remove Feb 2018 legacy migrator
This is to allow other features to use the /logs folder.

Going forward, updating from a pre-Feb 2018 version of the bot
will require first updating the bot to version v2.30.1 and running it
once. After that, updating to newer versions is possible.
2020-09-23 02:30:17 +03:00
Dragory 5c6df913bf
beforeNewThread hook type fixes 2020-09-23 02:29:09 +03:00
Dragory f5b6e46040
Add afterThreadClose plugin hook 2020-09-23 02:28:41 +03:00
Dragory 9be6b2aa1f
Don't allow opening threads with bots with !newthread, fixes #452 2020-09-23 01:04:40 +03:00
Dragory 0c9302b41b
Add statusType option 2020-09-23 00:58:18 +03:00
Dragory 4ea5650289
Consider an empty value for mentionRole as 'none' 2020-09-23 00:39:56 +03:00
Dragory bf47fb7406
Add 'none' option for mentionRole 2020-09-23 00:38:46 +03:00
Dragory 180f936bc4
Update config jsdoc 2020-09-23 00:26:36 +03:00
Dragory 171ad403d9
Add updateNotificationsForBetaVersions option 2020-09-23 00:25:50 +03:00
Dragory f46d719f4c
Code clean-up 2020-09-23 00:21:44 +03:00
Nils 96e8eae188
Fully functioning built-in plugin to send system messages on join/leave (#437)
Co-authored-by: Miikka <2606411+Dragory@users.noreply.github.com>
2020-09-23 00:19:34 +03:00
funkyhippo 3af5a67c1b Added anonymizeChannelName configuration option. 2020-09-23 00:17:31 +03:00
Dragory 8d151c1800
Fix null values in entity getSQLProps()
Fixes 'null' role name when staff member has no hoisted roles
2020-09-22 23:47:04 +03:00
Dragory aea216f289
Fix crash when using newThreadCategoryId without categoryAutomation 2020-08-24 19:35:01 +03:00
Dragory 8930e5dde8
Fix crash when greetingMessage is used instead of serverGreetings 2020-08-24 19:31:53 +03:00
Dragory b992b49c5c
Clean up bot mention notification styles 2020-08-21 05:16:23 +03:00
Dragory 581b09a8ae
Fix thread header ping not working, utilize allowed_mentions 2020-08-21 05:13:24 +03:00
Dragory fdabf65882
Fix thread alert_id being limited to 20 chars on MySQL 2020-08-18 22:43:08 +03:00
Dragory 47125fd7fd
Fix rare crash in typingProxy 2020-08-18 21:43:30 +03:00
Dragory 883d8adf93
Fix crash when a user sends an attachment
Also added an eslint rule to catch similar errors caused by shadowed
variables in the future.
2020-08-17 11:26:06 +03:00
Dragory 958db5135d
Use releases instead of tags in update check, ignore prereleases/drafts 2020-08-17 02:07:03 +03:00
Dragory 4d42656c24
Delete command message after !edit/!delete
Consistency with !reply
2020-08-17 02:02:22 +03:00
Dragory aff119549e
Removed some leftover brackets around message numbers 2020-08-17 01:58:20 +03:00
Dragory adc54909fa
Tidy up edit/deletion styles 2020-08-17 01:53:21 +03:00
Dragory 6a8ecfed8a
Small extra tweak to thread message numbers 2020-08-17 01:46:51 +03:00
Dragory 3aa74f2cbf
Hide message numbers from non-verbose logs 2020-08-17 01:45:45 +03:00
Dragory c7b49b5484
Tweaks to default message number formatting 2020-08-17 01:43:36 +03:00
Dragory ac2548b6cc
Request GUILD_MEMBERS intent for server greetings. Emphasize new intent requirement in the changelog. 2020-08-17 01:24:30 +03:00
Dragory 4fbf2a1769
Rename guildGreetings to serverGreetings
The original name (guildGreetings) is now an alias for the new option
name, so old configs will still work after this change.
2020-08-17 01:21:07 +03:00
Dragory 900a14d8a1
Rename categoryAutomation.newThreadFromGuild to categoryAutomation.newThreadFromServer
The original name (categoryAutomation.newThreadFromGuild) is now
an alias for the new option name, so old configs still work after
this change.
2020-08-17 01:04:05 +03:00
Dragory c177be8920
Fix categoryAutomation type 2020-08-17 00:55:18 +03:00
Dragory 099b5f9616
Enable !edit and !delete by default 2020-08-17 00:55:05 +03:00
Dragory d85a2dad5d
Add !message 2020-08-17 00:39:39 +03:00
Dragory 16a3af07ef
Hide ajv warning about ignored keywords
This was showing up when using $ref with $comment in the JSON Schema
2020-08-17 00:20:43 +03:00
Dragory a327160ed9
Improve CLI feedback for 'Waiting for servers', always continue after a delay 2020-08-17 00:19:51 +03:00
Dragory be7f172b62
Rename mainGuildId to mainServerId, mailGuildId to inboxServerId
The original names (mainGuildId, mailGuildId) are now aliases for
the new option names, so old configs still work after this change.
2020-08-16 23:53:35 +03:00
Dragory d5219556a7
Add full JSDocs for the plugin API 2020-08-16 23:26:04 +03:00
Dragory f61b1cc397
Require new text arg in !edit_snippet. Fixes #413 2020-08-16 22:14:49 +03:00
Dragory 034a9172c4
Update config JSDoc 2020-08-16 19:22:50 +03:00
Dragory cb6a9c2703
Merge #373 2020-08-16 18:58:25 +03:00
Dragory 0540ac3b90
Merge #358 2020-08-16 18:51:20 +03:00
Dragory 7a671eab1f
Ignore errors from adding a reaction with reactOnSeen 2020-08-16 18:45:11 +03:00
Dragory 51df75e641
Set dm_channel_id directly from the message object
Allows us to set the channel id correctly for non-DM messages,
such as mentions that create a thread with createThreadOnMention
where the initial message is forwarded to the thread.
2020-08-16 18:42:22 +03:00
Dragory c7bf059220
When creating a new thread from a mention, include a note and the initial message in the thread 2020-08-16 18:41:58 +03:00
Dragory 78a1cc34be
threadOnMention -> createThreadOnMention 2020-08-16 18:36:51 +03:00
Dragory e0aa3a73ae
Merge #397 2020-08-16 18:34:51 +03:00
Dragory 041e095950
Merge #398 2020-08-16 18:27:51 +03:00
Dragory 25998fa8a2
Show a small note if a user messages the bot with e.g. a Spotify invite 2020-08-16 18:18:32 +03:00
Dragory 31a5fb55b8
Remove debug console.log 2020-08-14 01:23:49 +03:00
Dragory 7c96d71efe
Tweak edit/delete formatting 2020-08-14 01:19:01 +03:00
Dragory a4c7b84616
Add next_message_number to threads, use it for reply numbers 2020-08-14 01:18:45 +03:00
Dragory 538a14338c
Update mysqlOptions schema 2020-08-14 01:01:40 +03:00
Dragory 296d1304a7
Reproducible formatters, add full log formatter
Format-specific parts of replies, including the role name and
attachments, are now stored in separate columns. This allows us to
store only one version of the actual message body and, by keeping
format-specific data separate, reproduce formatter results regardless
of when they are called. This cleans up code around message formats
significantly and was required to support !edit/!delete properly.
2020-08-14 00:42:32 +03:00
Dragory 77cb19e70c
Fix inconsistency between knexfile and runtime knex config 2020-08-13 23:55:29 +03:00
Dragory 8ba25d9504
Update Node.js version ranges in package.json and index.js 2020-08-13 03:40:34 +03:00
Dragory 98b8a05d5c
Remove several deprecated config options 2020-08-13 03:32:04 +03:00
Dragory ab6b84e6de
Add official MySQL support. Simplify database options. 2020-08-13 03:31:48 +03:00
Dragory 1f5faaab5b
Fix unnecessary warning about migrations from knex 2020-08-13 02:44:42 +03:00
Dragory 37c523cd04
Band-aid fix for import in move.js 2020-08-13 02:36:52 +03:00
Dragory 6d16daea0d
Add new attachment storage option: "original" 2020-08-13 02:36:15 +03:00
Dragory ff89ab557c
Remove debug process.exit() 2020-08-13 00:26:54 +03:00
Dragory b30e615200
Use gateway intents, add extraIntents config option 2020-08-13 00:23:59 +03:00
Dragory 2beadbe924
Disable getAllUsers from the client
We can lazy-load members instead.
2020-08-13 00:18:11 +03:00
Dragory 86a060410f
Apply code style from .eslintrc 2020-08-13 00:08:37 +03:00
Dragory bd8dcc6129
Fixes and tweaks to new config validation 2020-08-13 00:03:01 +03:00