aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
| | | * | | | | | | Fix relay race condition in duckpond using a lockGravatar Sebastiaan Zeeff2020-09-20-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our duckpond suffered from a race condition: If multiple raw reaction events were received in quick succession and a message had enough ducks to take it over the duckpond threshold, the message would be relayed multiple times. The reason this happened is because the green checkmark emoji that stops a message from being relayed multiple times is only added after the message has been relayed. This means that multiple event triggers can make it past the green checkmark check before any of them has a chance to add a green checkmark. The solution was to create a relay lock that needs to be acquired before checking for the presence of a green checkmark and is only released after adding a green checkmark. This prevents multiple events from making it past the sentinel check. As our Cogs are potentially initialized before the event loop is created, the lock is load lazily when needed. Signed-off-by: Sebastiaan Zeeff <[email protected]>
| | | * | | | | | | Add channel blacklist for duckpondGravatar Sebastiaan Zeeff2020-09-20-4/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As announcements already get a lot of exposure and have a high risk of getting "ducked", duckpond will now ignore those channels and never relay those announcements to our duckpond. Signed-off-by: Sebastiaan Zeeff <[email protected]>
| | | * | | | | | | Ignore non-staff messages for our duckpondGravatar Sebastiaan Zeeff2020-09-20-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of our members have expressed concern that their messages would be "ducked" by staff members and relayed to the staff-only duckpond. Since duckpond is supposed to be a funny, staff-only affair, I've made duckpond ignore messages from non-staff members. Signed-off-by: Sebastiaan Zeeff <[email protected]>
| | | * | | | | | | Determine eligible duckpond emojis dynamicallyGravatar Sebastiaan Zeeff2020-09-20-70/+27
| | |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of maintaining a list of duckpond IDs manually, it's a much better idea to detect ducky emojis dynamically using the new emoji name grouping we've introduced: All emojis that start with `ducky_` will now be counted as a duckpond ducky. The unicode duck emoji obviously still counts in addition to custom emojis with the `ducky_` prefix. Signed-off-by: Sebastiaan Zeeff <[email protected]>
| | | * | | | | | Use global namespace `bot` for our RedisSessionGravatar Sebastiaan Zeeff2020-09-19-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As we're now planning on using Redis in multiple applications, it's important to minimize the risk of namespace collisions between different applications. The `async-rediscache` packages allows us to set a global namespace on an application level. I've chosen "bot" as the namespace for this application, which means all individual namespaces will automatically be prefixed by `bot.` whenever they are accessed. Signed-off-by: Sebastiaan Zeeff <[email protected]>
| | | * | | | | | Remove vestigial RedisCache class definitionGravatar Sebastiaan Zeeff2020-09-19-681/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As we're now using the `async-rediscache` package, it's no longer necessary to keep the `RedisCache` defined in `bot.utils.redis_cache` around. I've removed the file containing it and the tests written for it. Signed-off-by: Sebastiaan Zeeff <[email protected]>
| | | * | | | | | Use async-rediscache package for our redis cachesGravatar Sebastiaan Zeeff2020-09-19-163/+167
| | |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've migrated our redis caches over to the async-rediscache package that we've recently released (https://git.pydis.com/async-rediscache). The main functionality remains the same, although the package handles some things, like getting the active session, differently internally. The main changes you'll note for our bot are: - We create a RedisSession instance and ensure that it connects before we even create a Bot instance in `__main__.py`. - We are now actually using a connection pool instead of a single connection. - Our Bot subclass now has a new required kwarg: `redis_session`. - Bool values are now properly converted to and from typestrings. In addition, I've made sure that our MockBot passes a MagicMock for the new `redis_session` kwarg when creating a Bot instance for the spec_set. Signed-off-by: Sebastiaan Zeeff <[email protected]>
| | | * | | | | Updated dependencies to match with master and include aioping.Gravatar Xithrius2020-09-22-6/+17
| | | | | | | |
| | | * | | | | Whitelisted the bot_commands channel and all staff for other channels.Gravatar Xithrius2020-09-22-1/+3
| | | | | | | |
| | | * | | | | Replacing the round function with a format specifier.Gravatar Xithrius2020-09-21-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Dennis Pham <[email protected]>
| | | * | | | | Replacing the round function with a format specifier.Gravatar Xithrius2020-09-21-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Dennis Pham <[email protected]>
| | | * | | | | Replacing the round function with a format specifier.Gravatar Xithrius2020-09-21-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Dennis Pham <[email protected]>
| | | * | | | | Comment updated from "microseconds" to "seconds"Gravatar Xithrius2020-09-21-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Dennis Pham <[email protected]>
| | | * | | | | Description renamed to avoid verbosity.Gravatar Xithrius2020-09-21-1/+1
| | | | | | | |
| | | * | | | | Added period to docstring.Gravatar Xithrius2020-09-21-1/+1
| | | | | | | |
| | | * | | | | Created the Latency cog to measure ping in milliseconds.Gravatar Xithrius2020-09-21-0/+57
| | | | | | | |
| | | * | | | | Updated dependencies to include aioping.Gravatar Xithrius2020-09-21-114/+133
| |_|/ / / / / |/| | | | | |
* | | | | | | Merge pull request #1167 from Numerlor/eval-escape-pasteGravatar Mark2020-09-21-2/+3
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Upload eval output with codeblock escapes to pastebin
| * | | | | | | Accommodate new upload behaviour in testsGravatar Numerlor2020-09-21-2/+2
| | | | | | | |
| * | | | | | | Upload output with codeblock escapes to pastebinGravatar Numerlor2020-09-21-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The output can't be sent to discord, but it won't affect anything in the paste service and can safely be uploaded to it.
* | | | | | | | Merge pull request #1150 from python-discord/feat/backend/217/has_any_roleGravatar Mark2020-09-21-180/+173
|\ \ \ \ \ \ \ \ | |_|_|_|_|_|/ / |/| | | | | | | Implement with(out)_role checks and decorators using has_any_role
| * | | | | | | Fix conflicts caused by #1103Gravatar MarkKoz2020-09-21-526/+1662
| |\ \ \ \ \ \ \ | |/ / / / / / / |/| | | | | | | | | | | | | | | Bunch of things were renamed, which mainly caused import conflicts.
* | | | | | | | Merge PR #817: Write tests for moderation utilsGravatar kwzrd2020-09-21-12/+384
|\ \ \ \ \ \ \ \ | |_|/ / / / / / |/| | | | | | |
| * | | | | | | Fix mod utils tests patch locationsGravatar ks1292020-09-21-4/+4
| | | | | | | |
| * | | | | | | Fix import order of mod utils testsGravatar ks1292020-09-21-1/+1
| | | | | | | |
| * | | | | | | Fix import path of mod utilsGravatar ks1292020-09-21-1/+1
| | | | | | | |
| * | | | | | | Fix end of file of mod utils testsGravatar ks1292020-09-21-1/+1
| | | | | | | |
| * | | | | | | Merge branch 'master' into mod-utils-testsGravatar ks1292020-09-21-3062/+6783
| |\ \ \ \ \ \ \ | |/ / / / / / / |/| | | | | | |
* | | | | | | | Merge pull request #1103 from python-discord/feat/backend/160/cog-subdirsGravatar Kieran Siek2020-09-21-257/+301
|\ \ \ \ \ \ \ \ | |_|_|_|/ / / / |/| | | | | | | Move cogs to subdirectories
| * | | | | | | Merge branch 'master' into feat/backend/160/cog-subdirsGravatar kosayoda2020-09-21-811/+1257
| |\ \ \ \ \ \ \ | |/ / / / / / / |/| | | | | | |
* | | | | | | | Merge pull request #1158 from python-discord/config-updateGravatar Senjan212020-09-16-3/+4
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Updated the names of reddit emotes
| * | | | | | | | remove random space in `upvotes` valueGravatar Senjan212020-09-16-1/+1
| | | | | | | | |
| * | | | | | | | update the reddit emojis to actual emojis'Gravatar Senjan212020-09-16-3/+3
| | | | | | | | |
| * | | | | | | | Updating names of reddit emotes.Gravatar Senjan212020-09-16-3/+4
| | | | | | | | |
* | | | | | | | | Merge pull request #927 from Numerlor/truncate-internal-evalGravatar Kieran Siek2020-09-16-62/+186
|\ \ \ \ \ \ \ \ \ | |/ / / / / / / / |/| | | | | | | | Truncate internal eval.
| * | | | | | | | Merge branch 'master' into truncate-internal-evalGravatar Kieran Siek2020-09-16-1923/+4960
| |\ \ \ \ \ \ \ \ | |/ / / / / / / / |/| | | | | | | |
* | | | | | | | | Verification: update & improve docstringsGravatar kwzrd2020-09-11-12/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After moving constants to config, the docstring references were not updated accordingly, and remained uppercase. This commit also removed the redundant list indentation.
* | | | | | | | | Merge pull request #1077 from python-discord/kwzrd/verificationGravatar Daniel Brown2020-09-10-21/+617
|\ \ \ \ \ \ \ \ \ | |_|_|_|_|_|_|_|/ |/| | | | | | | | Take steps to increase verification rate
| * | | | | | | | Merge branch 'master' into kwzrd/verificationGravatar Daniel Brown2020-09-10-800/+529
| |\ \ \ \ \ \ \ \ | |/ / / / / / / / |/| | | | | | | |
| * | | | | | | | Verification: move constants to configGravatar kwzrd2020-09-10-25/+43
| | | | | | | | |
| * | | | | | | | Verification: set 'tasks_running' to 0 on suspicious 403sGravatar kwzrd2020-08-29-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prevent the tasks from starting again if the bot restarts.
| * | | | | | | | Verification: denote `_maybe_start_tasks` as privateGravatar kwzrd2020-08-29-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consistency with the new `_stop_tasks` method.
| * | | | | | | | Verification: stop tasks on suspicious 403Gravatar kwzrd2020-08-29-1/+4
| | | | | | | | |
| * | | | | | | | Verification: add helper for stopping tasksGravatar kwzrd2020-08-29-5/+17
| | | | | | | | |
| * | | | | | | | Verification: improve allowed mentions handlingGravatar kwzrd2020-08-27-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I really didn't like the constants, but the construction of allowed mentions instances is syntactically noisy, so I prefer to keep it out of the important logic. Abstracting it behind a function seems to be the best approach yet.
| * | | | | | | | Verification: document StopExecution handlingGravatar kwzrd2020-08-27-0/+3
| | | | | | | | |
| * | | | | | | | Verification: stop kicking members on suspicious 403Gravatar kwzrd2020-08-26-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A Discord error code 50_0007 signifies that the DM dispatch failed because the target user does not accept DMs from the bot. Such errors are ignored as before. Any other 403s will however cause the bot to stop making requests. This is in case the bot gets caught by an anti-spam filter and should immediately stop.
| * | | | | | | | Verification: add helper for alerting adminsGravatar kwzrd2020-08-26-0/+18
| | | | | | | | |
| * | | | | | | | Verification: retain ping in edited confirmation msgGravatar kwzrd2020-08-26-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prevent a ghost ping from occurring upon reaction. Co-authored-by: Senjan21 <[email protected]>
| * | | | | | | | Verification: remove explicit everyones from allowed mentionsGravatar kwzrd2020-08-26-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the kwarg isn't passed, it uses the value that was given to the bot on init (False), despite the kwarg defaulting to True. Thanks to Mark and Senjan for helping me understand this. Co-authored-by: MarkKoz <[email protected]> Co-authored-by: Senjan21 <[email protected]>