Commit Graph

138 Commits

Author SHA1 Message Date
Roardom
f6917de1cc fix: chatbox receiver_id message validation
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).
2026-03-11 11:24:40 +00:00
Roardom
4e3f605ecf fix: use system user id constant in chatbox 2026-03-11 09:35:21 +00:00
Roardom
124cce2a0e fix: audible status using wrong property name 2026-03-09 05:38:59 +00:00
HDVinnie
dfd6620486 refactor: replace instances of Carbon::now() with Laravel's now() helper
- per contribution guide and for consistency
2026-02-11 16:10:07 -05:00
Roardom
3ff816de3f refactor: combine chatbox audibles and echoes into conversations 2026-02-05 11:27:40 +00:00
Roardom
976fc9422b Merge pull request #5260 from Roardom/add-foreign-keys-echoes-audibles-messages
(Update) Add foreign keys to echoes, audibles, and messages tables
2026-02-04 23:26:47 +00:00
Roardom
169e25312a update: add foreign keys to echoes, audibles, and messages tables 2026-02-02 22:17:23 +00:00
PRguy
c99ba3cc23 fix: Accept all 2xx responses in external IRC announce bot
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.
2026-02-01 11:45:51 -05:00
Roardom
419a823892 fix: phpstan irc announce bot external meta match types 2026-01-22 09:39:49 +00:00
Roardom
d128cd5236 refactor: prefer ::query() over laravel eloquent magic
Significantly improves DX with LSP compatibility. Now it's possible to navigate to the definition of these functions in laravel and get ide autocomplete.
2026-01-10 10:10:03 +00:00
Roardom
544e63ee59 refactor: user audible and echo cache
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.
2026-01-02 07:05:36 +00:00
ze0s
30cd78535a (Add) Implement support for external IRC announce services (#5099) 2025-11-05 06:05:23 +00:00
Roardom
ec9b19ffbf refactor: use boolean for user audible
Instead of int.
2025-09-30 06:58:59 +00:00
HDVinnie
757522038d Merge pull request #5010 from Roardom/fix-bot-audibles 2025-09-28 16:43:01 -04:00
Roardom
41017d4b50 fix: creation of chatbox bot audibles
Regression from 7a71cc7

fixes #4883
2025-09-27 06:42:04 +00:00
Roardom
6ff68b2e20 fix: chatbox gift users command
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.
2025-09-24 07:19:15 +00:00
Roardom
6f7441bc2f refactor: simplify systembot command parsing 2025-09-03 03:32:14 +00:00
Roardom
28c99c9736 refactor: cleanup workaround for creating systembot echoes/audibles
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.
2025-09-03 03:32:14 +00:00
Roardom
94b68d5097 refactor: simplify nerdbot command parsing 2025-09-03 03:32:14 +00:00
Roardom
9093f0d2f8 refactor: remove unused $params, $clone and $y variables in Nerdbot 2025-09-03 03:32:14 +00:00
Roardom
f3bb05a93b fix: eager loading of user for echo and audible eloquent resources 2025-09-03 03:32:14 +00:00
Roardom
27f8f51362 refactor: inline runbot in chat api 2025-09-03 03:32:14 +00:00
Roardom
7cfb4317c2 refactor: remove unused targeted variable in chat api 2025-09-03 03:32:14 +00:00
Roardom
e89690ac0d refactor: simplify adjusting cache in chat api
We don't necessarily need to refresh the cache, we only need to append to it.
2025-09-03 03:32:13 +00:00
Roardom
9cda3e4d71 add: unbanned users in past 24 hours nerdbot stats 2024-10-15 09:25:06 +00:00
HDVinnie
80aea2be31 Merge pull request #4173 from costaht/master
(Add) Allow the use of channel_key to join the announce channel
2024-09-28 21:05:00 -04:00
costaht
20beba1216 add: channelKey to enable bot to join protected IRC channels 2024-09-24 22:24:51 -03:00
Roardom
3923f4c2e3 fix: use booleans for bots 2024-08-26 09:08:02 +00:00
Roardom
64a60089d9 refactor: treat sprintf as native function
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.
2024-08-09 21:08:26 +00:00
HDVinnie
2c0a4794cc Merge pull request #3952 from costaht/master
(FIX) Appending missing colon to the function privmsg
2024-06-29 23:35:51 -04:00
costaht
05759e98c1 Appending colon to the function privmsg instead of the body message 2024-06-27 13:52:41 -03:00
Roardom
12903f64ac fix: strict type issues
Don't pass null into functions that don't accept null.
2024-05-23 17:40:16 +00:00
Roardom
b86475a732 add: strict types to all files 2024-05-23 13:58:29 +00:00
Roardom
2d270ab149 update: clean up nerd bot messages 2024-05-02 03:47:11 +00:00
Roardom
7a71cc7935 refactor: simplify echo/audible creation logic
Refactor the code to be more idiomatic code.
2024-05-01 08:26:09 +00:00
Roardom
d32ae88e86 remove: casino/trivia/bet bots
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.
2024-04-30 07:41:27 +00:00
Roardom
2fbae7f55d refactor: use more fluent syntax for irc bot 2024-03-03 19:36:54 +00:00
Roardom
537ad1e831 refactor: normalize user gifts 2024-02-26 09:33:08 +00:00
HDVinnie
ea0018a862 PHP Style Change (Laravel Pint CI) 2024-01-16 18:05:08 +00:00
Roardom
8b66eaed34 fix: phpstan level 8 Bot errors 2024-01-07 17:13:20 +00:00
HDVinnie
3f03214e39 PHP Style Change (Laravel Pint CI) 2023-11-07 23:54:38 +00:00
HDVinnie
b3f0386149 cleanup: pt.1 2023-10-12 22:30:52 -04:00
Roardom
788fabaf79 fix: irc announce bot parameter order 2023-08-31 05:14:42 +00:00
Roardom
4cdbcb40b5 update: bots
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.
2023-08-28 06:39:10 +00:00
Roardom
1bc31fda9d fix: only use active peers for stats and bon 2023-08-03 07:28:16 +00:00
Roardom
229eed8091 refactor: use _id suffix on bon_transactions foreign keys 2023-07-22 21:30:50 +00:00
Roardom
9d4789ba91 refactor: require whitespace before statements 2023-07-07 00:27:13 +00:00
Roardom
177c59d88d refactor: swap firstOrFail() for sole() to enforce a single result 2023-06-19 23:18:40 +00:00
Roardom
b5493c5642 refactor: swap where('id', '=', ) for find() 2023-06-19 23:18:40 +00:00
HDVinnie
f4ebee885c update: lint 2023-02-03 22:23:00 -05:00