* More privatization, and some error helpers
This makes a lot more things private. Continued from #2967, fixes#2984
Adds public methods for various things.
Below is a brief summary of things available elsewhere, though this
particular set of changes may warrant a detailed section in the release notes.
- bot.db.locale -> redbot.core.i18n.get_locale
- Note: This one already existed.
- bot.db.help -> redbot.core.commands.help.HelpSettings
- bot db whitelist/blaclist? -> bot.allowed_by_whitelist_blacklist
- This has also been made a single cannonical function for this
purpose including check usage
- bot color? -> bot.get_embed_color/bot.get_embed_colour
- bot.id.api_tokens? ->
- bot.get_shared_api_tokens
- bot.set_shared_api_tokens
- bot.remove_shared_api_tokens
-bot.db.prefix -> bot.get_valid_prefixes
- (Note: This is a wrapper around bot.get_prefix)
Other changes include
- removing `bot.counter` as it was never used anywhere
- Adding properties with helpful error messages for moved and renamed
things
- making bot.uptime a property with an error on set
- adding a migration to the bot config for shared_api_tokens
* Remove overly encompassing message redaction, eval is a risk, dont run in dev if you cant manage it
* address Flame's feedback
* rephrase example
* changelog extras
* You saw nothing
* Rename `bot.db` as `bot._config`
- Continues work towards strong version guarantees
- Added methods for cog use for a few things which were previously
only accessible via direct access.
- Retained private use in a few internal use locations, though most
methods were updated away from this.
- Updated documentation for shared api token users
* changelog
* more detail
* docstring fixes
* Apparently, I forgot to commit something I had locally
- + a copy/paste failue in the changelog
* *sigh*:
* *sigh*
Allows for non-coroutine awaitables (such as config's `_ValueCtxManager`) to be awaited from debug.
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Uses classmethods to create predicates
* Classmethods allow using a combination of different parameters to describe context
* Some predicates assign a captured `result` to the predicate object on success
* Added `ReactionPredicate` equivalent to `MessagePredicate`
* Added `utils.menus.start_adding_reactions`, a non-blocking method for adding reactions asynchronously
* Added documentation
* Uses these new utils throughout the core bot
Happened to also find some bugs in places, and places where we were waiting for events without catching `asyncio.TimeoutError`
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>
* Cleanup quotes in cogs
* More quote cleanup that I missed
fixed a little bit of grammar here and there as well.
* [V3 Warnings] Change allowcustomreasons docstring
To help not confuse users who would believe that the command would use allow or disallow.
* Run black reformat
* Framework for internationalised command help
* Translator for class docstring of cog
* Remove references to old context module
* Use CogManagerUI as PoC
* Replace all references to RedContext
* Rename CogI18n object to avoid confusion
* Update docs
* Update i18n docs.
* Store translators in list instead of dict
* Change commands module to package, updated refs in cogs
* Updated docs and more references in cogs
* Resolve syntax error
* Update from merge
* Include discord in [p]debug env
* Typecast eval output to string
* Use globals instead of locals for debug
* Fix up storing last result and non-string results
* Cleanup code and better help messages
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