91 Commits

Author SHA1 Message Date
Rory&
c41c3c068e Include full AJV error on api 2025-10-17 03:44:08 +02:00
Rory&
e52c237326 Reorganise schemas a little bit 2025-10-15 08:04:23 +02:00
Rory&
62016a8043 Try to fix sending messages with discord-go 2025-10-06 03:25:11 +02:00
Rory&
a25393e806 Clean up array extensions 2025-10-04 19:09:26 +02:00
Rory&
7d2fd7b4f8 Add dotnet-ish Random class 2025-10-04 19:09:25 +02:00
Rory&
b681ae7522 Drop dependency on missing-native-js-functions 2025-10-04 19:09:25 +02:00
Rory&
efba3f245d Fix ignored request schemas 2025-10-04 19:09:25 +02:00
Rory&
c6d763a905 Log schema name on error 2025-10-01 20:37:42 +02:00
Rory&
0c3d8a792f Drop @sentry/node (Sentry support) - untested and unused 2025-09-29 22:08:03 +02:00
Rory&
697b599eb5 Maybe this tie 2025-09-29 18:38:06 +02:00
Rory&
61c3b537ad Include attachments 2025-09-29 18:38:06 +02:00
Rory&
b6cfb32d5a More relations 2025-09-29 18:38:06 +02:00
Rory&
871880996b Actually set the referenced_message relation on new messages 2025-09-29 18:38:06 +02:00
Rory&
f20dff80ef Make cloud uploads work 2025-09-29 18:38:06 +02:00
Rory&
d007acc64e Logging of empty messages 2025-09-29 18:38:06 +02:00
Rory&
c3fa8d3b1f meow??? 2025-09-29 18:38:06 +02:00
Rory&
d166c9a69a Log validation errors 2025-09-29 18:38:06 +02:00
Rory&
3bba7882fa Try to handle new attachment style in message handler 2025-09-29 18:38:06 +02:00
Rory&
1e6ed06da1 Add first half of cloud attachment uploads 2025-09-29 18:38:06 +02:00
Puyodead1
9347a3ec6f
Merge pull request #1305 from ZaneH/feat/handle-github-webhook
Implement GitHub-compatible webhook
2025-07-12 12:56:00 -04:00
Emma [it/its]@Rory&
3e549dae28 Fix typeorm queries no longer allowing empty where clauses 2025-07-06 09:18:22 +02:00
Zane Helton
9143c1d408 Refactor /github endpoint into it's own file 2025-06-29 10:46:16 -04:00
Zane Helton
4f75919651 Add OP to message.mentions when replied to
The `message.message_reference` stores:

1. `message_id`
2. `channel_id`
3. `guild_id`

We use the `message_id` and `channel_id` to `.findOne(...)` Message, and
find the author. If the author is the same as OP, we skip (so replying
to yourself doesn't add you to the mentions array) otherwise, it adds
the author_id to the mentions array.

Resolves: #1247
2025-06-29 09:14:58 +10:00
Zane Helton
e8d3f655a3 Preserve reactions when a message is edited
Resolves #1241
2025-06-29 08:44:47 +10:00
Zane Helton
81d4313631 Properly filter existing embed links
In a previous PR, I was checking if the `.url` property existed, the
correct fix is to remove any embed that isn't a rich embed
type (non-link).

See also: #1296
2025-06-29 08:39:42 +10:00
Zane Helton
184433b078 Start fresh when updating embeds for links
In a previous commit I was attempting to be clever by only
replacing/removing embeds if necessary. This not only made the logic
more confusing but introduced a bug that would allow for orphaned
embeds when updating the search params of a URL.

This commit will remove all embeds that have a `.url` property and start
fresh. This simplifies the code and eliminates the aforementioned bug.
2025-06-28 18:30:52 +10:00
Zane Helton
f9cfb46e73 Fix various issues with embeds on message updates
The `postHandleMessage` function is parsing links and adding them to the
EmbedCache table if necessary. In the previous implementation, message
updates would push to the embeds unconditionally.

This commit parses links from the message and:

1. Normalizes the URLs
  - Useful for deduplicating similar URLs
2. Remove embeds with matching normalized URLs
  - Leaves all embeds except for ones with a `.url` property matching
  the updated message
  - This allows embeds to be re-ordered if the URL is moved
3. If no normalized URLs are found, remove all embeds
4. Take the deduplicated + normalized URLs and add an embed to the message and
insert into the EmbedCache table (if necessary)

This enables:

1. Embeds to be re-ordered by re-ordering links
2. Embeds to be removed by removing links

and fixes:

1. Duplicate embeds being attached to a message when edited
2025-06-28 18:30:52 +10:00
MathMan05
5488874476 delete the null eater 2025-05-28 08:46:35 +02:00
MathMan05
664b71f463
acatually fix the embed issue
This one added the line in the right spot, sorry about the previous one lol
2025-03-23 23:29:19 -05:00
Emma [it/its]@Rory&
168758924c Update some patches, switch to node-fetch-commonjs, more updates 2024-10-28 00:32:15 +01:00
TomatoCake
873107f90d Perms for GET webhook, url property 2024-07-18 15:16:50 +02:00
TomatoCake
15a2e57b05 Prettier & fix merge util/handlers/Message 2024-07-18 14:42:22 +02:00
TomatoCake
128b81bc6a Merge branch 'master' of https://github.com/DEVTomatoCake/spacebar-server into feat/webhooks-3 2024-07-18 14:41:14 +02:00
TomatoCake
6be3714593 Fix ESLint & prettier 2024-07-18 12:52:00 +02:00
TomatoCake
e7a98b6c46 webhook fixes & username/avatar property for msg 2024-07-18 12:42:07 +02:00
TomatoCake
d3ece937e6 Make channel ID optional when replying 2024-07-17 20:34:09 +10:00
Cyber
7698a15f03 fix: check for message components 2024-07-09 17:19:28 +02:00
Cyber
21579b11cd fix: poll message is not an empty message 2024-07-09 16:02:11 +02:00
TomatoCake
9b02e82614 Make poll a single object instead of an array 2024-07-09 22:58:10 +10:00
Madeline
35c9a09ea5
fix poll in msg create schema 2024-07-09 15:27:24 +10:00
TomatoCake
0ac8888d41 Don't embed links in <> 2024-07-04 09:41:46 +10:00
TomatoCake
9e1ec8a673
Ban API compat & Bulk Ban endpoint (#1120)
Co-authored-by: Madeline <46743919+MaddyUnderStars@users.noreply.github.com>
2024-06-05 15:19:30 +10:00
Madeline
c802bb9747
Embeds: handle og:sitename 2023-09-16 23:47:32 +10:00
Madeline
e355be8ea3
Fix regression where generic embed handler wouldn't properly send image results 2023-09-16 23:43:23 +10:00
Puyodead1
8a35664ae6
[fb] remove provider obj, add color 2023-09-03 15:48:55 -04:00
Puyodead1
1612832fc4
add facebook, and add steam fields 2023-09-03 15:28:33 -04:00
Madeline
e64c34adea
Rewrite thumbnail/image generation for embeds 2023-09-03 14:17:11 +10:00
Madeline
fb7409947c
Fix bug in embed handler where getMeta would not return undefined 2023-09-03 13:41:45 +10:00
Madeline
c64a115729
xkcd embed handler and improved generic handler 2023-09-02 23:47:40 +10:00
Zert3x
6306c5e725
Update ipAddress.ts 2023-05-28 21:39:50 -04:00