40 Commits

Author SHA1 Message Date
Draper
df7ca65108
Reduce calls to config in the on_command_add event (#3764)
* lets reduce config calls here

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* stop using `bot.guilds` in `on_command_add`

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-04-20 19:10:58 +02:00
Michael H
d4e982faea
Fix Red specific behavior of invoke_without_command (#3614) 2020-02-28 01:40:28 +01:00
Michael H
c2143fdf86
[commands module] functools.partial support (#3542)
* No reason we can't support this

* meh

* there we go...
2020-02-12 09:28:52 -05:00
chasehult
26fdbf63ee string (#3536) 2020-02-10 04:10:59 -05:00
Michael H
a664615a2d shortdoc should be formatted too, + generic replacement method (#3451) 2020-01-27 01:25:58 +01:00
Michael H
a8450580e8
[Commands Module] Improve usability of type hints (#3410)
* [Commands Module] Better Typehint Support

  We now do a lot more with type hints

  - No more rexporting d.py commands submodules
  - New type aliases for GuildContext & DMContext
  - More things are typehinted

  Note: Some things are still not typed, others are still incorrectly
  typed, This is progress.

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-01-26 17:54:39 -05:00
Michael H
2ac4dde729
update for d.py 1.3 (#3445)
* update for d.py 1.3

* Update redbot/core/commands/commands.py

Co-Authored-By: Danny <Rapptz@users.noreply.github.com>

* a few more places we use owner info

* add the cli flag + handling

* set fix

* Handle MaxConcurrencyReached.

* Bump `aiohttp-json-rpc`

Co-authored-by: Danny <Rapptz@users.noreply.github.com>
Co-authored-by: Kowlin <Kowlin@users.noreply.github.com>
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-01-25 18:59:08 -05:00
Michael H
77235f7750 [commands] Implement __call__ to commands.Command (#3241)
* This is technically awesome, but let's not document it for public use rn

* changelog
2020-01-20 23:23:15 +01:00
Michael H
3c53b89040
[Help] formatting additions (#3339)
* formatting additions

* I really need to redo this module later

* fix some casing
2020-01-13 11:50:45 -05:00
Michael H
ef99174585
prevent abuse cases with qualname length (#3223) 2019-12-26 17:20:59 -05:00
Michael H
6852b7a1d1
License info command (#3090)
* Adds a licenseinfo command

* good enough for now

* changelog

* *sigh* Fine, have it your way Draper

* thanks Flame
2019-11-09 14:06:07 -05:00
jack1142
6e3ccc1a21 [Commands] cls parameter can now be passed to group like in d.py (#2881)
* fix(commands): ``cls`` parameter can now be passed like in d.py

* chore: add changelog entry

* Update changelog.d/2881.misc.rst

Co-Authored-By: Toby Harradine <Tobotimus@users.noreply.github.com>

* Rename 2881.misc.rst to 2881.enhance.rst
2019-09-28 17:24:49 -04:00
Michael H
83483abfa5
Reserves command names (#2977)
* Reserves command names

  - Currently, only reserving ``cancel``
  - This should only impact matching command qualified names
  - This also checks aliases
  - This makes cc and alias use the new module constant with info about
  this
  - Module constant is available for use by 3rd party cogs which may
  dynamically create responses.

* Change misleading var name

* style

* Thanks Flame!

* Handles issues with CC
2019-09-28 16:58:40 -04:00
Michael H
af97175839
Fix an issue with clearing permission rules (#3015)
Fixes #3014
2019-09-26 11:41:11 -04:00
Michael H
6280fd9c28
disabled help hideaways (#2892)
* disabled help hideaways

* can_see fix
2019-07-27 02:36:21 -04:00
Michael H
49a75b5f19 command translator quick fix (#2870)
* command translator quick fix

* command translator quick fix
2019-07-14 13:55:47 +10:00
Michael H
682ee1a459 [Docs] Fixes the docs for commands.Command.error (#2760)
* docfix

* inline code for sphinx, not a ref
2019-06-04 20:21:30 +02:00
Michael H
7f1c2b475b [Core] Help Redesign (#2628)
* [Bot] Support new design

* [Context] use the new help in `ctx.send_help`

* [Commands] Update Cog and Group for help compat

- Removes a trap with all_commands, this isn't a good way to check this
- Adds a help property
- Fixes command parsing in invoke

* Redesigns red's help

* handle fuzzy help

* style

* handle a specific ugly hidden interaction

* fix bot-wide help grouping

* changelog

* remove no longer needed -
2019-05-14 20:49:51 -07:00
Will
59115cd1c7 [Commands] Fix built in check decorator order affecting permissions (#2621)
OOOoooooOOOoOOOooOoOOOOoooo
2019-04-25 11:51:02 -04:00
Michael H
ad114295e7
Discord.py dep update 3.1 (#2587)
* Dependency update

discord.py==1.0.1
websockets<7

[style]
black==19.3b0

[Docs]
jinja==2.10.1
urllib3==1.24.2

Changes related to breaking changes from discord.py have also been made
to match

As of this commit, help formatter is back to discord.py's default
2019-04-23 21:40:38 -04:00
DiscordLiz
3637804929 Fix Command.error decorator (#2478)
This shouldn't be a coroutine.
2019-02-23 07:13:22 +11:00
DiscordLiz
c70a44e0fe Make on_command_error recognise custom error handlers (#2458)
Adds detection of custom error handlers to the global error handler.

Adds documentation of the updated behaviour.

Closes #2276.
2019-02-22 20:12:00 +11:00
Toby Harradine
435fc141ae
Default rules for subcommands precede supercommands (#2422)
This incorporates default rules into the same resolution techniques used by concrete rules.

Resolves #2313.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-02-11 14:14:29 +11:00
Toby Harradine
9752a9c719
Bump version to 3.0.0rc3 (#2367)
Also updated some dependencies, including discord.py.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-01-11 11:10:01 +11:00
Toby Harradine
811634a2b0
[Permissions] Help menu respects rules (#2339)
Resolves #2249.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-12-21 13:30:13 +11:00
Toby Harradine
0870403299
Permissions redesign (#2149)
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>
2018-10-01 13:19:25 +10:00
Toby Harradine
f7dbaca340
Refactor fuzzy help and clean up help command (#2122)
What's changed:
- Fixed issues mentioned on #2031
- Fuzzy help displays more like help manual
- Fuzzy help is easier and more flexible to use
- Fuzzy help string-matching ratio lowered to 80
- Help formatter is more extendable
- Help command has been optimized, cleaned up and better incorporates fuzzy help
- Added async_filter and async_enumerate utility functions because I was using them for this PR, then no longer needed them, but decided they might be useful anyway.
- Added `Context.me` property which is a shortcut to `Context.guild.me` or `Context.bot.user`, depending on the channel type.
2018-09-24 10:34:39 +10:00
Toby Harradine
9ee860c3f0
[Core] Command disable feature (#2099)
* [Core] Command disable feature

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>

* [Core] Allow user to set the "command disabled" message

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>

* Reformat

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-09-06 12:52:19 +10:00
Toby Harradine
48a7a21aca
[Commands] Refactor command and group decorators (#1818)
* [V3 Commands] Refactor command and group decorators

* Add some tests

* Fix docs reference

* Tweak Group's MRO
2018-08-26 23:25:25 +10:00
Toby Harradine
ae7b912ac8
Major dependency update (#1974)
* [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
2018-08-15 12:10:55 +10:00
Michael H
1c2196f78f autohelp changes. (#1836) 2018-07-12 01:23:18 +02:00
Michael H
d1f0b59b5d [V3] Verify checks for command groups (#1882) 2018-06-25 21:33:36 +10:00
Tobotimus
033d0113a5 [V3] Send meaningful responses on conversion failure (#1817)
* [V3] Send meaningful responses on conversion failures

* Replace existing `discord.ext.commands` imports

Just to be sure

* Better Permissions converter response
2018-06-08 21:20:40 -04:00
Michael H
17c7dd658d [V3 Core] Command group automatic help (#1790)
* decorator inheritence

* black format

* add autohelp

* modify commands to use autohelp
2018-06-08 20:54:36 -04:00
palmtree5
0b78664792 [V3 Fuzzy search] fix several issues with this feature (#1788)
* [V3 Fuzzy search] fix several issues with this feature

* Make it check if parent commands are hidden

* Check if compiler available in setup.py

* Let's just compile a dummy C file to check compiler availability

* Add a missing import + remove unneeded code
2018-06-05 22:14:11 +02:00
Michael H
40feeff442 [V3 core.commands] decorator inheritence fix (#1786)
* decorator inheritence

* black format
2018-06-02 18:34:30 -08:00
Tobotimus
14cc701b25 [V3] Update black version and reformat (#1745)
* Update black version and reformat

* Pin black in extras_require
2018-05-29 18:37:00 -08:00
Michael H
b88b5a2601 [V3] Update code standards (black code format pass) (#1650)
* ran black: code formatter against `redbot/` with `-l 99`

* badge
2018-05-14 15:33:24 -04:00
Michael H
e7476edd68 [V3] fix help on missing cog and command docstrings (#1645)
* [V3] fix help on missing cog docstrings

* I think this is what you're looking for

* Also do a NoneType check for commands
2018-05-14 20:13:12 +10:00
Tobotimus
15ea5440a3 [V3 i18n] Internationalise help for commands and cogs (#1143)
* 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
2018-05-12 01:47:49 +02:00