aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/backend (follow)
Commit message (Collapse)AuthorAgeLines
* Branding: improve decorator nameGravatar kwzrd2024-11-23-3/+3
|
* Branding: do not invoke calendar after refreshGravatar kwzrd2024-11-23-2/+0
| | | | | | | We now send a result embed after refresh. It would be noisy to also send the calendar embed. Users can invoke the calendar manually if desired.
* Branding: retry GitHub server errorsGravatar kwzrd2024-11-23-8/+35
| | | | Use the tenacity lib to retry 5xx responses from GitHub.
* Branding: handle repo errors in cogGravatar kwzrd2024-11-23-28/+36
| | | | | | | | | | If we fail to fetch an event, the whole branding sync will now be aborted. This will prevent situations where we fail to fetch the current event due to a 5xx error and the cog resorts to the fallback branding in the middle of an event. Error handling is moved to the cog. The repo abstraction will now propagate errors rather than silence them.
* Use new itertool.batched instead of more_itertools.chunkedGravatar wookie1842024-06-11-3/+3
|
* Support events that span from one year to another (#3065)Gravatar wookie1842024-05-23-1/+11
|
* Move from sentry_sdk.push_scope to sentry_sdk.new_scopeGravatar Joe Banks2024-05-13-2/+2
|
* Correct type hint in the syncer cog.Gravatar Chris Lovering2024-04-01-1/+1
|
* Also sync the user's display_name in the user syncerGravatar Chris Lovering2024-04-01-0/+2
|
* Wait 10 seconds before syncing the guild & usersGravatar Chris Lovering2024-04-01-7/+14
| | | | This will give other cogs a chance to start up
* Make help showable through button on command error message. (#2439)Gravatar wookie1842024-03-25-12/+47
| | | | | | | | | | | | | | | | | * Make help showable through button on command error message. * Improve error message Improve error message for attempting to delete other users' command invocations Co-authored-by: Boris Muratov <[email protected]> * Use double quotes instead of single * Refactor to use `ViewWithUserAndRoleCheck` --------- Co-authored-by: Boris Muratov <[email protected]>
* Replace aliased errors with TimeoutErrorGravatar Chris Lovering2024-02-02-1/+1
|
* Handle adding reactions to messages from users who have blocked the bot (#2580)Gravatar TizzySaurus2024-01-29-1/+7
| | | | | Co-authored-by: Xithrius <[email protected]> Co-authored-by: Xithrius <[email protected]>
* Use async context manager for asyncio timeoutGravatar Chris Lovering2023-11-27-1/+1
| | | | Solves BOT-3P1
* Replace usage of async_timeout with asyncio.timeoutGravatar Chris Lovering2023-11-25-2/+1
| | | | async_timeout was a sub-dep of aiohttp, which was removed in 3.9.0 for Pytohn 3.11+ due to asyncio.timeout being a thing.
* Centralise error handling for commands invoked from error handler (#2436)Gravatar wookie1842023-09-19-24/+26
|
* Fix some test warnings (#2675)Gravatar wookie1842023-07-09-1/+1
| | | | | | | * Fix test warnings * Remove unnecessary event_loop parameters This is not necessary as the current event loop will be used which is the same as self.bot.loop. Removing these should slightly improve test speed as the mock for self.bot.loop doesn't need to be created.
* Migrate code style to ruffGravatar Chris Lovering2023-04-11-59/+59
| | | | | Co-authored-by: Boris Muratov <[email protected]> Co-authored-by: wookie184 <[email protected]>
* Merge #2408: Scaffold server config via a bootstrapping scriptGravatar Amrou Bellalouna2023-03-09-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor configuration into a pydantic-based python constants file, and add a utility to auto-populate guild data. Squashed commits: * use basic config for demo purposes * fix guiding comments * update var names for proper context reflection * fix wront iteration var * add all roles, & channels * load categories * separate sections in env file * ignore .env.server * rename change_log to changelog This also adds a default env file to look for * remove instantiation of webhooks * add most of the default configs These will mostly be fetched from the .env.default file, which won't be bootstrapped * warn when categories/roles/channels are not found * add env file to keep server defaults * fix malformatted value in the .env.default * add default server env variables * update the sections formatting in default env file * fallback to server env when loading constants * add guild basic defaults * update change_log channel name to changelog * add the Guid settings prefix * make _Guild inherit from EnvConfig * add webhook defaults * add python_news defaults to the server env * ad missing webhooks prefix * update bootstrapper logger name * update priority of the env loaded files According to Pydantic's docs: "Later files in the list/tuple will take priority over earlier files." * warn user that default value from PyDis' config will be used * add colours default config * add antispam config * update antispam references * add redis default cfg * add Stats, Cooldowns and CleanMessages consts This also includes their default values * add Metabase to constants This also includes its default values * add URLS to constants This also includes its default values * use the Field class to provide defaults This avoids overriding & changing the `fields` of the `Config` class "dynamically" * add keys constant class * add Guild conf * replace dash with underscore in script * appease linter * transform attributes of AntiSpam to dict when needed This ensures that the application stays backwards compatible * add root_validator for the colours class This enables the conversion from hex to int easily since it's not a supported type by pydantic * reinstate the role & channels combinations * rename URLS to URLs * add emojis & icons constants * add filter constants & their default values * remove all useless spaces * instantiate the keys class * add bot prefix to default env file * fetch Bot constants from env vars instead of the prefix ones * add Miscellaneous config * instantiate poor forgotten Miscellaneous config * add final touches to the constants module This includes removing dups, adding missing channels & fixing type casts * move all default values to constants.py This is done by using the `Field` class. It allows us to 1. Set defaults, in case the variables are not configured 2. Load them from a env variable under a specific name (for backwards comp) 3. load it from any env variable file that contains the right prefix * ignore all .env files * load BOT_TOKEN & GUILD_ID from .env * allow _GUILD to read its id from the `GUILD_ID` env var * base Webhooks settings off of a Webhook model * create necessary webhooks if non existent * appease flake8 docstrings error * make the script idempotent * update type hints * uppercase all consts * make webhook channel optional * add httpx to its own dependency group This group will be optional & only related to the bootstrapper * replace requests with httpx * pass client as param * include raise_for_status as a response hook * rename get_webhook to webhook_exists * update docstring of the constants module * use "." as a separator * update script to account for already created webhooks * make ANTI_SPAM_RULES a module level constant This ensures that flake8 doesn't complain about making a function call in the function's signature * remove the manual resolving of .env paths * update usages of AntiSpam constants * remove forgotten assignment of rule_config * remove useless assignments of env file names * delete default config-default.yml * update docstrings of CodeBlockCog to reference constants.py * add a poetry task that runs the bootstrapping script * add python-dotenv to the config-bootstrap group * update hook name to _raise_for_status * construct site_api in _URLs * remove __name__ == '__main__'guard * Revert "construct site_api in _URLs" This reverts commit 1c555c4280c6a0bdd452319cbd3ffcd0370f5d48. * remove usage of the Field class * update env var keys that the bootstrapping script needs * use API_KEYS.SITE_API as env var in docker compose instead of BOT_API_KEY * use basic config for demo purposes * fix guiding comments * update var names for proper context reflection * fix wront iteration var * add all roles, & channels * load categories * separate sections in env file * ignore .env.server * rename change_log to changelog This also adds a default env file to look for * remove instantiation of webhooks * add most of the default configs These will mostly be fetched from the .env.default file, which won't be bootstrapped * warn when categories/roles/channels are not found * add env file to keep server defaults * fix malformatted value in the .env.default * add default server env variables * update the sections formatting in default env file * fallback to server env when loading constants * add guild basic defaults * update change_log channel name to changelog * add the Guid settings prefix * make _Guild inherit from EnvConfig * add webhook defaults * add python_news defaults to the server env * ad missing webhooks prefix * update bootstrapper logger name * update priority of the env loaded files According to Pydantic's docs: "Later files in the list/tuple will take priority over earlier files." * warn user that default value from PyDis' config will be used * add colours default config * add antispam config * update antispam references * add redis default cfg * add Stats, Cooldowns and CleanMessages consts This also includes their default values * add Metabase to constants This also includes its default values * add URLS to constants This also includes its default values * use the Field class to provide defaults This avoids overriding & changing the `fields` of the `Config` class "dynamically" * add keys constant class * add Guild conf * replace dash with underscore in script * appease linter * transform attributes of AntiSpam to dict when needed This ensures that the application stays backwards compatible * add root_validator for the colours class This enables the conversion from hex to int easily since it's not a supported type by pydantic * reinstate the role & channels combinations * rename URLS to URLs * add emojis & icons constants * add filter constants & their default values * remove all useless spaces * instantiate the keys class * add bot prefix to default env file * fetch Bot constants from env vars instead of the prefix ones * add Miscellaneous config * instantiate poor forgotten Miscellaneous config * add final touches to the constants module This includes removing dups, adding missing channels & fixing type casts * move all default values to constants.py This is done by using the `Field` class. It allows us to 1. Set defaults, in case the variables are not configured 2. Load them from a env variable under a specific name (for backwards comp) 3. load it from any env variable file that contains the right prefix * ignore all .env files * load BOT_TOKEN & GUILD_ID from .env * allow _GUILD to read its id from the `GUILD_ID` env var * base Webhooks settings off of a Webhook model * create necessary webhooks if non existent * appease flake8 docstrings error * make the script idempotent * update type hints * uppercase all consts * make webhook channel optional * add httpx to its own dependency group This group will be optional & only related to the bootstrapper * replace requests with httpx * pass client as param * include raise_for_status as a response hook * rename get_webhook to webhook_exists * update docstring of the constants module * use "." as a separator * update script to account for already created webhooks * make ANTI_SPAM_RULES a module level constant This ensures that flake8 doesn't complain about making a function call in the function's signature * remove the manual resolving of .env paths * update usages of AntiSpam constants * remove forgotten assignment of rule_config * remove useless assignments of env file names * delete default config-default.yml * update docstrings of CodeBlockCog to reference constants.py * add a poetry task that runs the bootstrapping script * add python-dotenv to the config-bootstrap group * update hook name to _raise_for_status * construct site_api in _URLs * remove __name__ == '__main__'guard * Revert "construct site_api in _URLs" This reverts commit 1c555c4280c6a0bdd452319cbd3ffcd0370f5d48. * remove usage of the Field class * update env var keys that the bootstrapping script needs * use API_KEYS.SITE_API as env var in docker compose instead of BOT_API_KEY * relock dependencies * update snekbox's defaults * add support for ot channels * rename help_system_forum to python_help * rename nomination_archive to nomination_voting_archive * rename appeals2 to appeals_2 * yeet sprinters role out * rename all big_brother_logs instances to big_brother The purpose is to adhere to what we have in prod * rename bootstrap_config.py to botstrap.py * update module name of the configure poetry task * update error messages to reflect the new keys needed for env variables * install dotenv as an extra with pydantic * update all prefixes to "_" (underscore) * log tuple of (channel_name, channel_id) in the config verifier * update needed default values for docker compose env var * relock dependencies * update forgotten delimiters & env prefixes
* Merge branch 'main' into migration/tagGravatar wookie1842023-02-27-6/+13
|\
| * Fix timeit commands with backticks after command nameGravatar wookie1842023-02-25-6/+13
| |
* | Implement reviewsGravatar Ibrahim2023-02-26-32/+18
| | | | | | | | | | | | | | | | | | + used both `discord.User` and `discord.Member` in typehinting as `InteractionResponse.user` returns `discord.User` object + removed `ErrorHandler()._can_run` + edited `try_get_tag` to use `bot.can_run` + removed `/tag list` + change `/tag get <name>` to `/tag <name>` + remove redundant `GUILD_ID` in `tags.py` + using `discord.abc.Messageable` because `ctx.channel` returns that instead of `Channel` Object
* | Upadte docstring for `ErrorHandler()._can_run`Gravatar Ibrahim2023-02-23-1/+2
| |
* | Implement all reviewsGravatar Ibrahim2023-02-23-14/+26
| | | | | | | | | | | | | | | | + Remove commented code + Remove unecessarily syncting the bot + Handle direct tag commads + 3.10 type hinting in concerned functions + Add `MockInteractionMessage` + Fix tests for `try_get_tag`
* | Update tests for `/tag` as of migration to slash commandsGravatar Ibrahim2750mi2023-02-14-8/+14
|/
* Update botcore module nameGravatar Chris Lovering2022-11-26-4/+4
|
* Move Security cog to backend extensionGravatar mbaruh2022-10-22-0/+30
|
* Merge branch 'main' into update-autoreview-systemGravatar wookie1842022-10-19-1/+9
|\
| * Return None instead of False in try_get_tagGravatar wookie1842022-09-19-1/+1
| |
| * Check for commands being None in try_get_tag and try_silenceGravatar wookie1842022-09-10-1/+9
| |
* | Merge branch 'main' into update-autoreview-systemGravatar wookie1842022-09-19-2/+2
|\|
| * noqa false-positive B023 instancesGravatar Chris Lovering2022-08-14-2/+2
| | | | | | | | This was a new lint rule added in the latest bugbear.
* | Fix testsGravatar wookie1842022-08-07-1/+1
| |
* | Fix enabling/disabling of task loopGravatar wookie1842022-08-07-1/+1
|/
* Add Explicit Namespaces To Branding CachesGravatar Hassan Abouelela2022-06-03-4/+2
| | | | Signed-off-by: Hassan Abouelela <[email protected]>
* Use MappingProxyType For Asset MapGravatar Hassan Abouelela2022-06-03-2/+3
| | | | Signed-off-by: Hassan Abouelela <[email protected]>
* Merge branch 'main' into multiple-bannersGravatar Hassan Abouelela2022-06-03-2/+32
|\
| * Merge branch 'main' into fix-eval-backticksGravatar wookie1842022-05-29-2/+5
| |\
| | * Use existing ResponseCodeError attrs rather than fetch againGravatar Chris Lovering2022-05-22-2/+5
| | | | | | | | | | | | This also updates the log string to use % based format strings, rather than a mix of f-string and % string which caused the %r to not work.
| * | Copy message instead of modifying originalGravatar wookie1842022-05-28-5/+5
| | |
| * | Add special handling for eval command followed by backticks.Gravatar wookie1842022-05-28-0/+27
| |/
| * Bump malformed API response from debug to error log (#2175)Gravatar wookie1842022-05-21-1/+1
| |
* | Merge branch 'main' into multiple-bannersGravatar Hassan Abouelela2022-05-07-11/+15
|\|
| * Manually chunk guild if not chunked 30s after startupGravatar Chris Lovering2022-04-26-11/+15
| |
* | Remove Explicit Support For Standalone BannersGravatar Hassan Abouelela2022-04-28-10/+5
| | | | | | | | | | | | | | Force all banners to be structured under directories instead of as standalone files. Signed-off-by: Hassan Abouelela <[email protected]>
* | Add Support For Multiple BannersGravatar Hassan Abouelela2022-04-27-71/+76
|/ | | | | | | | | Adds support for having multiple banners which rotate in a single event, much like icons currently do. There are almost no code changes here as most of the required logic was already implemented, and was standardized to work for both icons and banners. Signed-off-by: Hassan Abouelela <[email protected]>
* Add Timeout To The Sync CogGravatar Hassan Abouelela2022-04-25-2/+10
| | | | | | | Adds a 30-minute timeout while waiting for the guild to be chunked in the sync cog, after which the cog is not loaded. Signed-off-by: Hassan Abouelela <[email protected]>
* Speed Up Sync Cog LoadingGravatar Hassan Abouelela2022-04-23-2/+17
| | | | | | | | | | | | The user syncer was blocking the startup of the sync cog due to having to perform thousands of pointless member fetch requests. This speeds up that process by increasing the probability that the cache is up-to-date using `Guild.chunked`, and limiting the fetches to members who were in the guild during the previous sync only. Co-authored-by: ChrisJL <[email protected]> Co-authored-by: wookie184 <[email protected]> Signed-off-by: Hassan Abouelela <[email protected]>
* Remove async stats and site api wrapperGravatar Chris Lovering2022-04-18-3/+3
| | | | We now source them from bot-core, so no need to have them here too.
* Move to async cog loadingGravatar Chris Lovering2022-04-18-19/+16
|