This is a step towards a more consistent front-end behaviour of Config, where errors are either circumvented or raised in the same way regardless of the driver being used.
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
This was thrown when the "default" key existed and Permissions tried to iterate over the list mapping keys as ints.
Also fixed some issues with saving config with keys as `int` instead of `str`.
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Implements our required subset of PEP 440 in redbot.core.VersionInfo
* Added unit tests for version string parsing and comparisons
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
API changes:
- Cogs must now inherit from `commands.Cog` (see #2151 for discussion and more details)
- All functions which are not decorators in the `redbot.core.checks` module are now deprecated in favour of their counterparts in `redbot.core.utils.mod`. This is to make this module more consistent and end the confusing naming convention.
- `redbot.core.checks.check_overrides` function is now gone, overrideable checks can now be created with the `@commands.permissions_check` decorator
- Command, Group, Cog and Context have some new attributes and methods, but they are for internal use so shouldn't concern cog creators (unless they're making a permissions cog!).
- `__permissions_check_before` and `__permissions_check_after` have been replaced: A cog method named `__permissions_hook` will be evaluated as permissions hooks in the same way `__permissions_check_before` previously was. Permissions hooks can also be added/removed/verified through the new `*_permissions_hook()` methods on the bot object, and they will be verified even when permissions is unloaded.
- New utility method `redbot.core.utils.chat_formatting.humanize_list`
- New dependency [`schema`](https://github.com/keleshev/schema)
User-facing changes:
- When a `@bot_has_permissions` check fails, the bot will respond saying what permissions were actually missing.
- All YAML-related `[p]permissions` subcommands now reside under the `[p]permissions acl` sub-group (tbh I still think the whole cog has too many top-level commands)
- The YAML schema for these commands has been changed
- A rule cannot be set as allow and deny at the same time (previously this would just default to allow)
Documentation:
- New documentation for `redbot.core.commands.requires` and `redbot.core.checks` modules
- Renewed documentation for the permissions cog
- `sphinx.ext.doctest` is now enabled
Note: standard discord.py checks will still behave exactly the same way, in fact they are checked before `Requires` is looked at, so they are not overrideable.
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
Previously, when downloader was loaded, the RepoManager would spawn a task to load available repos. If one repo failed loading for some reason, the function would raise and the remaining repos would never be loaded, however downloader would still appear to load correctly.
This change handles exceptions better during repo loading, but also, if an unhandled exception is raised, downloader will fail to load as it should.
Also included, as requested in #1968, is the --recurse-submodules flag in cloning/pulling repositories.
This change resolves#1950.
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* [Downloader] Parse tree URLs when cloning repos
Signed-off-by: Toby <tobyharradine@gmail.com>
* Only match GitHub and GitLab URLs
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* [Trivia] Move trivia lists back home
Removes red-trivia as a dependency.
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Include package data in distribution
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Add test from red-trivia repo, and fix package data setup
* The distribution will now include all files under any data/ sub-directory of a package, as well as all *.po files under any locales/ sub-directory (as it should have been before).
* MANIFEST.in has been simplified to comply with these changes and redbot/cogs/audio/application.yml has been moved to the data/ sub-directory to maintain consistency in how we declare package data.
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Make calling groups useful
This makes config.Group.__call__ effectively an alias for Group.all(),
with the added bonus of becoming a context manager.
get_raw has been updated as well to reflect the new behaviour of
__call__.
* Fix unintended side-effects of new behaviour
* Add tests
* Add test for get_raw mixing in defaults
* Another cleanup for relying on old behaviour internally
* Fix bank relying on old behaviour
* Reformat
* Handle missing cogs correctly, add some helpful algorithms
For cog loading, only show "cog not found" if the module in question was the one
that failed to import. ImportErrors within cogs will show an error as they should.
- deduplicator, benchmarked to be the fastest
- bounded gather and bounded async as_completed
- tests for all additions
* Requested changes + wrap as_completed instead
So I went source diving and realized as_completed works the way I want it to,
and I don't need to reinvent the wheel for cancelling tasks that remain
if the generator is `break`ed out of. So there's that.
* [V3 JSON] Return deepcopy in JSON driver
* Add a test
* foo not bar
* Add a test for setting and then mutating
* Resolve issue for setting and mutating as well
* Reformat
* Switch RPC libs for websockets support
* Implement RPC handling for core
* Black reformat
* Fix docs for build on travis
* Modify RPC to use a Cog base class
* Refactor rpc server reference as global
* Handle cogbase unload method
* Add an init call to handle mutable base attributes
* Move RPC server reference back to the bot object
* Remove unused import
* Add tests for rpc method add/removal
* Add tests for rpc method add/removal and cog base unloading
* Add one more test
* Black reformat
* Add RPC mixin...fix MRO
* Correct internal rpc method names
* Add rpc test html file for debugging/example purposes
* Add documentation
* Add get_method_info
* Update docs with an example RPC call specifying parameter formatting
* Make rpc methods UPPER
* Black reformat
* Fix doc example
* Modify this to match new method naming convention
* Add more tests
* [V3 Core] Enhance [p]backup to exclude some files
* Backup the repo list too
* Lol Sinbad's pre-commit hook
* Add option of sending the backup to the owner via DM
* Drop an unnecessary config object in RepoManager
* Move the backup functionality in redbot-setup to the new stuff
* More work on implementation, including backing up the instance data
* Update travis to not sip pipfile lock
update pipfile dependencies
additional black formatting pass to conform to black 18.5b
* .
* pin async timeout until further discussion of 3.5 support
* .
* Add the identifier as an initialization parameter
* Remove config object singleton and opt for a shared JSON datastore
* Fix bot unloading to deal with memory leaks
* Fix tests
* Fix clear all bug
* [V3 CogManagerUI] implement text-only support in [p]cogs
* Change page length to 1800 + workaround for pages starting with delim
* [V3 Core] text mode support for [p]contact and [p]dm
* Implement text-only support in modlog and fix everything that broke because of it
* Fix modlog stuff in filter too
* Fix tests
* Implement optional embed support in [p]help
* move to .format
* Remove get_driver
* Rename self.driver to self._driver
* Do not unnecessarily pass the cog identifier
* Remove unused import
* Fix type annotation
* Missed a keyword rename
* Modify signature of get/set methods in drivers
* Readd work due to redoing branch
* [modlog] Move to core and start work on separating it from cogs
* More work on modlog separation
* [Core] Finish logic for modlog, do docstrings, async getters
* [Core] Add stuff to dunder all
* [Docs] Add mod log docs
* [Core] Move away from dunder str for Case class
* [Docs] don't need to doc special members in modlog docs
* More on mod log to implement commands
* More work on Mod
* [Mod] compatibility with async getters
* [Tests] start tests for mod
* [Tests] attempted fix
* [Tests] mod tests passing now!
* [ModLog] update for i18n
* modlog.pot -> messages.pot
* [Mod] i18n
* fix getting admin/mod roles
* Fix doc building
* [Mod/Modlog] redo imports
* [Tests] fix imports in mod tests
* [Mod] fix logger problem
* [Mod] cleanup errors
* A couple of bug fixes
Async getters, some old `config.set` syntax
* Filter ignores private channels
* Fix softban
Was still relying on default channels
* Actually ignore private channels
* Add check for ignored channels
* Fix logic for ignore check
* Send confirm messages before making case
* Pass in guild when setting modlog
* Thanks autocomplete
* Maintain all data for case
* Properly ignore softbans in events
* [Mod] bugfixes
* [Mod] more changes
* [ModLog] timestamp change
* [Mod] split filter and cleanup to their own cogs + regen messages.pot
* [Cleanup] change logic
* [Cleanup] increase limit for channel.history
* [Mod] await getter in modset banmentionspam
* [Mod] attempt duplicate modlog message fix
* [Mod] get_user -> get_user_info
* [Modlog] change reason command so the case author can edit their cases (#806)
* [Modlog] make reason command guild only
* [Modlog] clarify the reason command's help
* [Mod] package path changes + numpy style docstrings for modlog
* [Mod] change ban and unban events to need view audit log perms to find/create a case
* [Modlog] refactoring
* [Filter] add autoban feature
* [Mod] update case types + event changes
* [Mod/Modlog] fix tests, fix permissions things
* [Docs] fix up modlog docs
* Regenerate messages.pot
* Added alternative to all_from_kind
* Returned dicts include default values
Also added docstrings
Also removed all_globals since it's kind of redundant and it wasn't working out for me
* Refactored clear_all
* Tests
* Tests again..
* Make all new methods coroutines
Ya'll are gonna hate me.
* Initial modifications
* Add initial setup.py
* working setup py help
* Modify setup file to package stuff
* Move a bunch of shit and fix imports
* Fix or skip tests
* Must add init files for find_packages to work
* Move main to scripts folder and rename
* Add shebangs
* Copy over translation files
* WORKING PIP INSTALL
* add dependency information
* Hardcoded version for now, will need to figure out a better way to do this
* OKAY ITS FINALLY FUCKING WORKING
* Add this guy
* Fix stuff
* Change readme to rst
* Remove double sentry opt in
* Oopsie
* Fix this thing
* Aaaand fix test
* Aaaand fix test
* Fix core cog importing and default cog install path
* Adjust readme
* change instance name from optional to required
* Ayyy let's do more dependency injection
* Initial commit
* Fix sentry
* Make cog manager install path work relative to the bot's dir
* Fix downloader to save data relative to the defined data folder
* Fix sentry test
* Fix downloader tests
* Change logfile location
* Add another line to codeowners
* Basic tests
* Fix versioning
* Add in FutureWarning for config file changes
* Add reference to issue
* WIP cog path manager
* Initial working state
* Get real reloading working
* Type error thingy
* And fix the tests
* Start UI shit
* path reordering
* Add install path getter/setter and fix config syntax
* Determine bot directory at runtime
* Add UI commands for install path
* Update downloader to use install path
* Add sane install path default
* Make evaluation of cog install path lazy
* Some typing fixes
* Add another line to codeowners
* Conditionally put install path in paths
* Always put install path first
* Dont allow people to add the installdir as an additional path, guarantee install dir isn't shown with paths command
* Make shit update loaded cogs
* Add tests
* Another one
* [Economy][Bank] redo branch
* WIP
WIP
* Implement all current bank commands API calls
* Set dunder all and put into bot
* make core change to economy
* Add is_global method to bank
WIP
* Add extra bank API commands
* Update bank UI
Update some imports
Remove bank UI errors file
Typing thing
* Update bank get_global_accounts and touch up economy some more
Do some more economy updates
* Remove bank from bot
* Another passing test
FINALLY
* Fixy type things
Last fixes for now
Fix arg to toggle global
RJM
Invalid bid amount handler
cooldown msg
currency name fix
Fix fun bug
ANother bug
And payday limit
* PEP8 stuff
* Docstring change
* Fix this thing
* [Economy][Bank] redo branch
* [Economy][Bank] modify guild owner or bot owner check, add admin or bot owner check for global vs local bank
* [Economy] apply admin or bot owner check to [p]economyset
* Make some public things private
* [Economy] lots of refactoring for conditional permission checks and guild checks + supporting global economy
* And working stuff
* Fix Kowlin's bug
* Fix slot bugs