- When creating a venv, use `python3.7` instead of `python3`
- Remove unnecessary dependency from pyenv pre-requirements on Debian
- Use curl over wget for get-pip on Xenial
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
This is in anticipation of #2246, although I've written that PR to not break on 3.6, the feature itself is not usable on 3.6. So I think the best way forward is to simply require python 3.7. This also allows devs and cog creators to utilise all of the new features in 3.7, and it also updates the docs so all operating systems will have 3.7 installed.
Signed-off-by: Toby <tobyharradine@gmail.com>
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>
* 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>
* Set 3.6.6 as minimum python version on Windows
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Conditional python_requires in setup.py
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Should probably add the comment too
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* [V3 CustomCom] Custom Command Parameters
Allows specifying more parameters for CC's via {0}, {1}, etc. that will be filled by the user invoking the CC. Python-style type hinting and attribute access is also allowed for Discord and builtin types.
> [p]cc add simple greet Hi, {0.mention:Member}!
> ...
> [p]greet zephyrkul
> Hi, @zephyrkul!
The bot will reply with the standard help messages if the cc is incorrectly executed.
> [p]greet me
> Member "me" not found
* black formatting
* check command failure
Only call the custom command if the faked command succeeded.
* misc fixes
1) don't str.strip all the time, it's not family-friendly and doesn't match transform_parameter
2) transform_arg now actually returns strings in every case
3) improve prepare_args parsing security
4) help parameters will show what type they expect
5) make linter less angery
* customcom documentation
I hate rst
* don't require repeated type hinting
If a parameter was type hinted previously, don't require it again.
Ex: `{0.display_name:Member}#{0.discriminator}` is now possible.
* add cog_customcom.rts to index
I despise rst
* don't enforce order
Allow type hinting and attribute access to be in either order.
Ex. `{0:Member.mention}` is now valid.
* clean up on_message
We're building context anyway, may as well use it.
* [doc] correct cog name
Cog class is named CustomCommands, not CustomCom
* minor on_message optimization
only build context if it's needed
* update cc_add docstring
Old one wasn't user-friendly. Replaced with a link to the new docs.
Link will not function until PR is merged and docs refreshed.
* [doc] change repeat to say
repeat is an audio command, use say in the example instead
* compare ctx.prefix to None
allows for null prefixes, which is a bad idea but who am I to judge
* address review
* raise error on conflicting colon notation
bugfix I was working on but failed to actually commit
* Correct minimum version
see #2092
While this is needed because of an import just for typing, I see no reason not to bump the minimum version since this is a minor version difference since this is several minor version behind the latest 3.6, and there have been both security and performance improvements since.
That said, we need to be testing on our lowest supported version to ensure we don't have this happen again, right now our tests run on whatever Travis grabs for 3.6, which I assume is 3.6.6, but could be wrong.
* Update other mentions of min version to 3.6.2
* Add output sanitization defaults to context.send
Add some common regex filters in redbot.core.utils.common_filters
Add a wrapper for ease of use in bot.send_filtered
Sanitize ModLog Case's user field (other's considered trusted as moderator input)
Sanitize Usernames/Nicks in userinfo command.
Santize Usernames in closing of tunnels.
* Add documentation
* 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] Stop `tmp` dir showing up
* [V3] Remove requirements.txt and declare in install_requires
* Remove requirements.txt from tox.ini
* Update and pin all dependencies and sub-dependencies
* Update for breaking changes
* Reformat
* Update docs/requirements.txt and tox.ini requirements
* Add 3.7 to identifiers and travis/tox builds
* Attempt at fixing the travis build matrix
* Attempt #2
* Attempt 3
* aiohttp.ClientSession.close() -> detach() in sync code
* Add raven-aiohttp to requirements
* Fix stuff in setup.py
- Added discord.py back into requirements list
- Fix typo in alabaster extra requirement
Also in the Pipfile:
- Removed allow_prereleases and explicitly pinned black, since this is the only dep we want a prerelease for.
* Update to Rapptz/discord.py@8ccb98d395
* Add proper 3.7 build in Travis
See travis-ci/travis-ci#9815
* Which version of 3.6 does Xenial install then?
* Maybe we should stop pipenv installing useless stuff
* Nevermind, back to specific minor version
* Remove lots of WET dependency stuff
* Fix egg fragment for dependency link
* enforce commands as ours
* clearer user feedback
* No more 'one more tweak' commits without verifying anyway
* more detailed error with docs link + docs update
Resolves#1972.
* [V3 Downloader] Allow to use the prefix in install msg
* Update docs
* Let's do the same for repo addition
* Fix indent
* Use replace instead of format
* Update docs
* 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
* This starts setting up checks.py to handle managed permission overrides
* A decent starting point, more work to come
* missing else fix
* more work on this
* reduce redundant code
* More work on this...
* more progress
* add a debug flag to some things in .resolvers to help with exploring why checks behave in a certain way
* modify this to be a list for ease of showing full resolution order
* more
* don't bypass is_owner, ever
* remove old logic about ownercommands
* better handling of chec validity
* anonymous functions return None for __module__, remove some code as a result
* mutable default bind fix
* Add a caching layer (to be invalidated as needed)
Ensure checks in the chain inserted before the core logic only return None or False
(whitelists then blacklists are checked first in core logic, from most to least specific scope, overriding this with an allow does not make sense)
* more progress, slow work as I have time
* Modifies the predicates so that their inner functions are accesible from cogs without
being a check
* Update checks.py
Safety for existing permissions.py cogs
* This is where I take a change of course on setting this up,
because this would have been the most long winded interactive command ever as
it was starting to progress.
This is going to support individual entry updates, settings from yaml, gettings, and clearing existing settings
as well as printing a settings template out and referring people to what is going to be very well written docs
* block permissions cog from being unblocked by the permissions cog as a safety feature (really, co-owner exists at this point)
* WIP
* Okay, this has the intent of the changes, just to actually test these as working as intended + add corresponding guild functions
* oh nice, missed a couple files, sec...
* WIP, also, something's broken in resolvers or check_overrides >>
* This is working now (still needs docs and more...)
* unmerge changes from other PR
* is_owner still needs to exist in here due to management of non checked commands
* Update this to new style standards
* forgot to commit some local changes earlier
* fix update logic
* fix update logic
* b14 fix, lol
* fix issue with management command name
* this isnt a real fix
* Ok..
* perms
* This is working, but needs docs and more configuration opts now
* more
* Ux functions, need testing
* style
* fix using the obj str rather than the id
* fix CogOrCommand converter
* Return the correct things in the converter
* last fix, needs docs, and possibly some extra Ux utils
* start doc writing
* extra user facing commands
* yaml docs
* yaml fix
* secondary checks-fix
* 3rd party check stuff
* remove warning that this isn't ready yet
* swap ctx.tick for real responses, require emoji perms for interactive menuing, better attr handling for nicknames
* send file to author
* alias to `p`
* more ctx tick removal
(This is a long ass changelog...)
* [V3 Docs] drop ffmpeg from CentOS install guide
* [V3 Install Docs] move all to Python 3.6
* Update the toctree
* Needed a blank line
* drop a .6 that wasn't needed
* Upgrade sphinx version to 1.7+
* Fix title overlines/underlines in autostart_systemd.rst
* Skip trying to document a method from discord.py
* Add escaped space after backtick
* Escape underscores (sphinx tries to interpret a hyperlink)
* Use fully qualified reference for class
* Fix reference in tunnel.py
* Remove python syntax highlighting in data_converter.py
For some reason sphinx couldn't lex these as python. Removing the highlighting seems like the logical solution for now, since if it wasn't being lexed, it wouldn't highlight anyway.
* Comment out static path since we're not using it right now
* Update sphinx version in docs requirements too
Would rather remove this duplication but RTD is a special snowflake
* 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