aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
* Deseasonify: add 'task' alias to daemon groupGravatar kwzrd2020-03-25-1/+1
| | | | | | Suggested by Scrags. Co-authored-by: scragly <[email protected]>
* Deseasonify: remove outdated `devtest` channel constantGravatar kwzrd2020-03-24-2/+0
| | | | | | | This channel no longer exists and creeps into error messages as #deleted-channel. Fixes: #335
* Deseasonify: clean up `constants` moduleGravatar kwzrd2020-03-24-27/+45
| | | | | | | Order config classes and constants alphabetically (within groups). Add missing classes to `__all__`, and style it as a vertical list. This will make it easier to maintain, and allows it to serve as a summary of the module's contents.
* Deseasonify: move bookmark icon under `Icons` constantsGravatar kwzrd2020-03-24-8/+6
|
* Deseasonify: use 't-dot' notation for type annotationsGravatar kwzrd2020-03-24-19/+19
| | | | | The module is full of complicated annotations, and the full `typing` takes up annoyingly much visual space.
* Deseasonify: re-lock seasonal listeners with new `in_month`Gravatar kwzrd2020-03-24-5/+5
|
* Deseasonify: add generic `in_month` decoratorGravatar kwzrd2020-03-24-1/+34
| | | | | | | | | | See docstring for further details. This serves as a convenience wrapper around `in_month_command` and `in_month_listener` to allow a consistent API. Proposed by lemon. Co-authored-by: Leon Sandøy <[email protected]>
* Deseasonify: rename `in_month` decoratorGravatar kwzrd2020-03-24-1/+1
| | | | | | Indicate that the decorator shall only be applied to commands. The `in_month` name will be used for a universal decorator that can season-lock both listeners and commands.
* Deseasonify: mock expensive API calls in debug modeGravatar kwzrd2020-03-24-1/+17
| | | | | | The methods will pretend that the selected asset was uploaded successfully. This allows extensive testing of the branding manager without API abuse.
* Deseasonify: add `mock_in_debug` decoratorGravatar kwzrd2020-03-23-1/+21
| | | | This should be very useful for testing. See docstring.
* Deseasonify: abdicate responsibility to wait until bot is readyGravatar kwzrd2020-03-23-7/+7
| | | | | | | | | | | | | | | | The wrapper will no longer wait for the bot to be ready before it calls the wrapped function for the first time. If the function requires the bot's cache to be ready, it is responsible for awaiting the method itself. This removes the need to acquire a reference to the bot instance inside the decorator, which seems to be difficult to do cleanly. As Mark adds, this may in fact be safer as the bot may temporarily disconnect while the task is active, and awaiting the bot's ready status every time will prevent issues in such a situation. Co-authored-by: MarkKoz <[email protected]>
* Deseasonify: remove `load_extensions` methodGravatar kwzrd2020-03-23-19/+1
| | | | | This is unused and no longer necessary, as all extensions load only once: on start-up, in `__main__.py`.
* Deseasonify: extend BrandingManager documentationGravatar kwzrd2020-03-23-11/+50
|
* Deseasonify: use BrandingError for negative responsesGravatar kwzrd2020-03-23-22/+18
| | | | | This allows more flat code as raising will short-circuit, plus we do not need to build negative response embeds manually.
* Deseasonify: handle BrandingErrorGravatar kwzrd2020-03-22-0/+5
|
* Deseasonify: add exceptions moduleGravatar kwzrd2020-03-22-0/+4
| | | | | | | | | | | | | When loading extensions, d.py circumvents the import cache by force-reloading the target module. As a consequence, exception class declaration get re-executed, which may cause the error handler to not recognize the exception via its `isinstance` checks - the raised exception may not be an instance of the class that the error handler originally imported. For this reason, it is safer to declare the exceptions on the side, in a module that will not be reloaded by d.py.
* Deseasonify: short-circuit on non-200 response statusGravatar kwzrd2020-03-22-1/+9
| | | | | | If Github API responds with a non-200 status, we simply return an empty dict. This is a safe value - the `refresh` function will handle this as if the directory was empty.
* Deseasonify: improve response messagesGravatar kwzrd2020-03-22-3/+16
| | | | | All responses now come in the form of an embed. When we fail to apply assets, the list of failed assets is shown to the user.
* Deseasonify: load bool env var properlyGravatar kwzrd2020-03-22-1/+1
| | | | | | | Fixes a bug where the `autostart` boolean constant wasn't being loaded properly and would always be set to True, as `bool("False") is True`. The constant now defaults to False.
* Deseasonify: await coroutineGravatar kwzrd2020-03-22-1/+1
| | | | | Fixed a bug where the `cycle` coroutine wasn't being awaited when called via a command.
* Deseasonify: return failed assetsGravatar kwzrd2020-03-22-5/+16
| | | | | | | | As the `apply` method attempts to apply all 4 types of assets, it is useful to know which (if any) have failed. As all the methods that we delegate to already return a bool denoting whether the operation has succeeded, we can simply collect this information and return it to the caller.
* Deseasonify: uncomment API callsGravatar kwzrd2020-03-22-10/+5
| | | | | | | Previously, all actual calls to the API were commented and replaced by logging so that the API doesn't get spammed during development. This is no longer necessary - we can begin using the cog!
* Deseasonify: propagate success value of `set_icon`Gravatar kwzrd2020-03-22-3/+8
| | | | | | The `set_icon` will return False if the application fails. Sine the `cycle` function wraps it, it should allow for the value to propagate out.
* Deseasonify: guard bot nickname setterGravatar kwzrd2020-03-22-2/+3
| | | | | | | Previously we'd always set the nickname, as the BaseSeason class provides a default. However, it feels cleaner to also guard this, in case a specific season decides to override the attr to something falsey.
* Deseasonify: do not automatically `apply` after `set`Gravatar kwzrd2020-03-22-2/+14
| | | | | | | | | | The previous design was such that calling `set` with a new season will automatically apply the branding. This meant 'previewing' a season would require a separate command. Since `apply` is an expensive operation with consequences, it appears logical to require that the user invokes it separately & explicitly. See docstring for further details.
* Deseasonify: add daemon command groupGravatar kwzrd2020-03-22-1/+39
| | | | | | | | | | This allows manually starting and stopping the daemon if necessary. Enables introspection in the sense that we can check whether the daemon is currently running, and for when is the next refresh scheduled. In the case that the daemon dies due to an unhandled exception, the start command is able to revive it. The daemon currently does not alert us when it dies.
* Deseasonify: return timedelta rather than raw secondsGravatar kwzrd2020-03-22-4/+5
| | | | | This will allow more introspection in the sense of displaying the remaining time until midnight in a human-readable format.
* Deseasonify: add ok_hand emoji constantGravatar kwzrd2020-03-22-0/+1
|
* Deseasonify: add property to check daemon statusGravatar kwzrd2020-03-22-0/+5
|
* Deseasonify: respect autostart env varGravatar kwzrd2020-03-22-3/+7
|
* Deseasonify: add autostart env varGravatar kwzrd2020-03-22-0/+1
| | | | | During development it may be useful to not have the branding daemon start automatically - this env var will make that possible.
* Deseasonify: add class for branding configGravatar kwzrd2020-03-21-8/+11
| | | | | | Since we'll be adding more env vars to control the branding manager, let's add a new config category. As a result, the cycle frequency constant name can be made shorter.
* Deseasonify: remove `season_override` env varGravatar kwzrd2020-03-21-2/+0
| | | | Unused and no longer relevant.
* Deseasonify: simplify `get_extensions` convenience functionGravatar kwzrd2020-03-21-10/+4
| | | | | | | | | | | | This is a little tricky, as we only want to walk the modules in each season's package. The pkgutil module provides a convenient function called `walk_packages` which can walk recursively, but this isn't desirable as not all modules are cogs - for example, the modules nested under `evergreen.snakes` are only helpers, and the `setup` function is instead present in the package's `__init__.py`. As we no longer have modules directly in the seasons package, we can remove the `ispkg` check.
* Deseasonify: improve `get_seasons` convenience functionGravatar kwzrd2020-03-21-9/+10
|
* Merge master into seasonal-purgeGravatar kwzrd2020-03-21-51/+454
|\ | | | | | | | | Most importantly this adds the Python 3.8 bump, plus unrelated features merged in the meantime.
| * Merge pull request #380 from python-discord/gitignore-dataGravatar scragly2020-03-21-0/+1
| |\ | | | | | | Add `data` persistence directory to .gitignore
| | * Add `data` persistence directory to .gitignoreGravatar kwzrd2020-03-21-0/+1
| |/
| * Merge pull request #250 from Suhail6inkling/battleshipsGravatar S. Co12020-03-20-0/+444
| |\ | | | | | | Battleships Game
| | * Merge branch 'master' into battleshipsGravatar S. Co12020-03-20-541/+1897
| | |\ | | |/ | |/|
| * | Merge pull request #373 from python-discord/python38Gravatar Sebastiaan Zeeff2020-03-19-51/+9
| |\ \ | | | | | | | | Bump Python version to 3.8
| | * \ Merge branch 'master' into python38Gravatar Sebastiaan Zeeff2020-03-19-1/+555
| | |\ \ | | |/ / | |/| |
| | * | CI: bump Ubuntu image to 18.04Gravatar kwzrd2020-03-08-1/+1
| | | |
| | * | CI: bump Python to 3.8Gravatar kwzrd2020-03-08-1/+1
| | | |
| | * | Docker: bump Python to 3.8Gravatar kwzrd2020-03-08-1/+1
| | | |
| | * | Pipenv: bump Python to 3.8 & re-lockGravatar kwzrd2020-03-08-48/+6
| | | |
| | | * Battleships - change hard-coded strings in subcommandGravatar Suhail6inkling2020-03-20-2/+2
| | | | | | | | | | | | Co-Authored-By: Karlis S. <[email protected]>
| | | * Battleships - alter positioning of some commentsGravatar Suhail2020-03-05-5/+10
| | | |
| | | * Applied suggestions from code review for BattleshipsGravatar Suhail2020-03-01-18/+60
| | | |
| | | * Applied suggestions from code review for BattleshipsGravatar Suhail2020-02-07-199/+209
| | | |