Messages to a chatroom should not be possible to set a receiver_id. It's not used anywhere now, but in the past it must have been possible as there are few records in an older database. Unfortunately, mysql doesn't allow adding check constraint to a column that has referential actions, otherwise I would have added a check constraint for (chatroom_id IS NULL XOR receiver_id IS NULL).
Changes `$response->ok()` to `$response->successful()` to handle other 2xx responses.
The previous check only accepted a 200 status code which caused successful calls (such as 204) to be incorrectly logged as errors.
Significantly improves DX with LSP compatibility. Now it's possible to navigate to the definition of these functions in laravel and get ide autocomplete.
Every time a user switches rooms or sends a pm, we need to ensure the sender and recipient have an echo and an audible. Previously, every user's echoes and audibles were cached, and we checked to see if the cached value contained the appropriate recipient, and if not, created the echo/audible and sent the user a new list. Now, we try to create it by default, and if it was created, send the user the new list.
A simple keyed insert doesn't take a lot of compute so it doesn't need to be cached.
There were a few type errors here.
I don't like that I'm casting the $amount to a float, but the only alternatives are not using the query builder, by either using `->update(['seedbonus' => DB::raw("seedbonus + $amount")])` after regex validation, or using `DB::update("update users set seedbonus = seedbonus + ? where id = ?", [$amount, $recipient->id])`. This is an issue in other parts of the code base as well.
I'm open to any feedback.
When the user changes the bot in the front-end (e.g. clicks the systembot button), it calls the bot pm method with an empty string and the pm method creates audibles/echoes but doesn't create the message if it's an empty string. Feels like an awfully hacky method, so I'm making the logic more explicit.
This breaks the pint CI currently. This is probably due to the next version of php (8.4) adding opcache optimizations to sprintf and our config requiring pre-slashing native functions.
These bots don't currently do anything. Exception: the casino bot accepts donations through a nerdbot command but doesn't currently do anything else with it. If any trivia/casino/bet features need to be brought back, it would be easy enough to view the old code through the git history, but there's probably a bunch that can be improved with its interface as well.
Lots were wrong with these files. Updated them to more modern standards, fixed some larastan errors, and fixed some issues with the IRC bot as well. They could still use some further clean up as is.