57 Commits

Author SHA1 Message Date
jack1142
cdb7a02cb8 [Core] Fix infinite typing for commands with cooldown (#2987)
* fix(core): cooldown error can't reinvoke command (infinite typing issue)

* chore(changelog): add towncrier entry
2019-09-07 19:25:02 -04:00
Michael H
6075c5bde0
Rename bot.db as bot._config (#2967)
* 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*
2019-09-01 15:42:28 -04:00
Michael H
0eb22c84ff [Bank API] Add cost decorator (#2761) 2019-07-03 10:07:19 +10:00
Toby Harradine
f3bbfdc64d Fix duplicate commands in fuzzy help (#2798)
* Fix duplicate commands in fuzzy help

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

* Use help command's filter for all fuzzy

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-06-27 13:31:44 -04:00
DiscordLiz
56161c0a88 Send to owners (#2738)
* Add bot.send_to_owner

resolves #2665

Adds some basic methods and config entries.

Does not add commands for modifying this yet.

* Use send_to_owners in events

* handle feedback
2019-05-28 12:37:02 -04:00
Fixator10
1ffb79f852 [events] send help on BadUnionArgument exception (#2707)
* [events] send help on BadUnionArgument exception

* Update redbot/core/events.py

Co-Authored-By: Michael H <michael@michaelhall.tech>
2019-05-19 06:14:12 -04:00
Michael H
f2858ea48c [Core] Fix update notification (#2677)
removes a problematic await
2019-05-15 16:31:00 +02:00
Kowlin
3de1a265ea [Core] Added co-owners to outdated message warnings (#2664)
* Added co-owners to potentially DMd users

* Fetch the cached of every guild, see comments of #2664

* Ensure owners can be DM'd.

* Refactoring try block.
2019-05-14 00:33:05 -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
Will
ba19179e4f
[V3 Config] Record custom group information using cog_add event (#2550)
* Do things differently

* Uncomment critical lines

* Reduce, reuse, recycle

* Check groups on all new config objects after a cog loads

* I don't know why this is failing now or why we need the global keyword

* gotta fix this too
2019-04-09 22:02:50 -04:00
PredaaA
82cda4b57a Delete cooldown messages when expired (#2469) 2019-04-02 23:06:30 -04: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
Michael H
722aaa225b Improve Cooldown UX (#2412)
This improves the feedback given on `command_on_cool_down`, as well as automatically handling cooldowns under 1 second for the user.
2019-02-19 10:19:49 +11:00
Twentysix
889fa63aff Sentry removal (#2439)
Resolves #2430.
2019-02-11 11:19:02 +11:00
Toby Harradine
dae75521d3
[Audio] Enable logging on Lavalink V3 (#2438)
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-02-10 18:36:02 +11:00
Toby Harradine
dc8e61cbe5
Always tick Voice requirements on startup screen (#2413)
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-02-04 22:33:48 +11:00
Toby Harradine
0607f5552a
Use python-Levenshtein-wheels (#2393)
This removes the compiler detection logic in setup.py. python-Levenshtein-wheels includes pre-built wheels for virtually all operating systems and architectures we support.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-01-30 16:52:36 +11:00
Toby Harradine
8eb8848898
[Mod] Context-based voice checks (#2351)
- Removed `redbot.cogs.mod.checks` module
- Moved logic for formatting a user-friendly list of permissions to `redbot.core.utils.chat_formatting`
- `[p]voice(un)ban` and `[p](un)mute voice` now check permissions in the user's voice channel

Resolves #2296.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-01-10 11:35:37 +11:00
Toby Harradine
91029b73e5
Use our own redbot.core.VersionInfo over distutils.StrictVersion (#2188)
* 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>
2018-10-06 19:11:05 +10: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
zephyrkul
a3c36d4bde NoneType check for module in should_log_sentry (#2139)
Allows for a lack of module (which returns False) for `should_log_sentry`. This allows for, say, commands to be added by the Dev cog. ( ͡ಠ ʖ̯ ͡ಠ)
2018-09-23 23:42:25 +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
1dbe9537e9
Ignore fuzzywuzzy slow sequence matcher warning (#2096)
* Ignore fuzzywuzzy slow sequence matcher warning

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

* Add log.info call instead

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-09-06 12:50:30 +10:00
Toby Harradine
6c082a10b1 Fix sync check causing errors (#2045)
* Fix sync check causing errors

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

* Import timedelta...

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-08-24 16:23:52 +02:00
Michael H
6ebfdef025 Remove self-bot support (#2008) 2018-08-24 22:51:03 +10:00
Michael H
bda7e08208 Handle time innacuracy by warning owner (#2036)
* handle time innacuracy by warning owner

* Fix typo and add space
2018-08-23 11:28:05 +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
Will
b983d5904b
[V3 RPC] Swap back to initial RPC library and hook into core commands (#1780)
* 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
2018-06-08 20:31:38 -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
741f3cbdcc [V3 CLI] CLI prefix args correctly display in the on_ready print (#1770) 2018-06-02 18:36:13 -04: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
84732a24fa [V3] Drop verbose output on check failure (#1725) 2018-05-27 21:27:44 -08:00
palmtree5
971ccf9df4 [V3 Core] add support for setting a color for embeds (#1707)
* [V3 Core] add support for setting a color for embeds

* Add a guild toggle for whether to use the bot color

* Add a function for getting embed color in Context

* Coroutines need to be awaited lol
2018-05-28 06:28:22 +02:00
palmtree5
4f270f3aab [V3] Start work on fuzzy command search (#1600)
* [V3] Start work on fuzzy command search

* Implement in command error handler

* Something isn't working here, try fixing

* Style compliance

* Add fuzzywuzzy to pipfile

* Dump the short doc part if there is no short doc

* Add fuzzy command search on command not found in help

* Move things around, implement for use of default d.py help formatter

* Formatting compliance

* Undo pipfile changes
2018-05-28 04:57:10 +02:00
Will
73a427f6aa [V3 RPC] Initial RPC library switch (#1634)
* Initial RPC library switch

* Use weak refs to the methods so cog unload works

* Add docs

* Black fixes

* Add jsonrpcserver to Pipfile.lock
2018-05-22 16:29:26 -08:00
Michael H
d3f406a34a [V3 Travis] Update travis to not skip pipfile lock... (#1678)
* 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

* .
2018-05-18 17:48:22 -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
retke
f6d27a0f43 [V3 Parser] Added --load-cogs flag (#1601)
* [V3 Parser] Added --load-cogs flag

* Removed old PR data

* Removed old PR data

* Removed old PR data

* Slightly reword help for flag

* Stick to convention for checking if sequence is empty

* Fix some logic errors

* Don't print packages which failed to load
2018-05-07 15:01:44 +10:00
Wyn
9188e4a7ec [V3 Info] Don't rely on redirect (#1581)
* [V3 Info] Don't rely on redirect

Http -> Https

* Update core_commands.py

Use existing variable instead of new string

* Update events.py

Remove redirect, url only reference
2018-05-02 10:35:48 +02:00
palmtree5
f378ea0d2e [V3 Core] add update check (#1388)
* [V3 Core] add update check

* [V3 Core] have it DM the owner if out of date
2018-03-06 10:21:01 +11:00
Michael H
b4f5c2c0a1 Revert "[V3]Encoding issue fix" (#1392)
* Revert "[V3 Core] Encoding issue fix (#1365)"

This reverts commit f6903cf5820ec93833aced058622cb2f235ac22b.

* Don't let the system encoding screw with things,
specify opens as happening with utf-8 encoding

(cherry picked from commit c10e4dddca32a7a74978f2938359be8a65e7e40f)
2018-03-06 08:18:41 +11:00
Michael H
f6903cf582 [V3 Core] Encoding issue fix (#1365)
* Don't let the system encoding screw with things,
specify opens as happening with utf-8 encoding

* And also deal with encoding issues because windows is a special snowflake
(see: #1366)

* let's just use the encoding param in str() rather than encode/decode...
2018-03-04 13:02:04 -05:00
Will
10cbd4d3c4
[V3 Sentry] Only log errors that come from core code (#1353)
* Do not load core cogs as extensions

* Filter this shit
2018-02-26 15:16:49 -05:00
palmtree5
a388d07f30 [V3 Events] modify CommandInvokeError handler to use the vague message as a fallback if a cog doesn't provide its own __error function (#1279) 2018-02-19 03:59:46 +01:00
Will
b871241eac
[V3 Core] Add optional async setup function (#1314) 2018-02-18 21:12:58 -05:00
Tobotimus
ffea55265d [V3] Fix UnicodeEncodeError on startup (#1248)
Fixes case where encoder can't support border characters
2018-01-14 18:57:28 -09:00
Will
0979231435
[V3 Sentry] Modify error logging cases (#1193)
* Fix duplicate on_

* Make better use of sentry error handler
2017-12-17 21:21:41 -05:00
Will
be591d7c65
[V3 Sentry] Fix sentry logging (#1169) 2017-12-12 22:34:34 -05:00
Will
73469f070c
[V3] Fix Windows start screen issue (#1058)
* Add colorama init

* Remove sqrts in favour of crossed boxes (#3)

* Detect stdout encoder's support for sqrt sign (#4)
2017-11-05 13:13:48 -05:00