94 Commits

Author SHA1 Message Date
Flame442
b9ed8b84f5 [CustomCom] Use simple by default (#3013)
* Allow creating simple CCs by default

* Create 3013.rst

* Screwed up the filename
2019-09-28 02:46:40 -04:00
Toby Harradine
3de9d15410
[CustomCom] Set Requires.ready_event before invoking CC (#2876)
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-07-15 20:13:06 +10:00
Toby Harradine
8676dd3ce3 [i18n] Update translation catalogs (#2867)
* [i18n] Update translation catalogs

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

* Install redgettext 3.1 in travis crowdin deployment

Last time the catalog templates were updated, redgettext 3.0 was used. I'd rather Travis didn't upload them after extracting with an older version.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-07-13 23:52:18 -04:00
DevilXD
f894b62bfe [CustomCom] Fixed KeyError on specific message edge-case (#2739)
fixes #2679
2019-05-29 22:36:32 -04:00
Neuro Assassin
2e271d695b Add respectable aliases for consistency (#2731)
* Add respectable aliases for consistency

* General command name for alias.py

* Forgot one for alias

* General command for filter

* General command for warnings

* Whoops

Resolves #1749
2019-05-24 18:22:17 -04:00
Will
c58f566047 [CustomCom] Update command generator to work with dpy update (#2616)
* I think this works?

* Let's do it

Co-Authored-By: tekulvw <tekulvw@users.noreply.github.com>
2019-04-25 12:31:58 -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
Toby Harradine
628073cbe1
Update Translations (#2486)
Also included a Makefile recipe which makes use of the Crowdin CLI's `crowdin download` command. This requires whoever is using it to provide the project's API key in an environment variable, but we may automate this at some point.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-03-04 08:55:01 +11:00
Toby Harradine
e07408161a Merge branch 'V3/release/3.0.0' into V3/develop
# Conflicts:
#	redbot/cogs/mod/mod.py
2019-01-11 16:42:42 +11:00
Toby Harradine
aa854cf1f9 [CustomCom] Insert space before newline separating CC previews (#2350)
Resolves #2295.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-12-29 16:54:32 +01:00
Toby Harradine
8b4e12da81 Merge branch 'V3/release/3.0.0' into V3/develop
# Conflicts:
#	redbot/cogs/customcom/customcom.py
#	redbot/core/errors.py
2018-10-16 09:42:38 +11:00
Toby Harradine
b5fd28ef7c
[CustomCom] Better display for [p]cc list (#2215)
Uses a menu, optionally embedded with respect to the embed settings, for scrolling through the custom command list, each cc with a ~50 character preview. Format is purposefully similar to the help menu.

Resolves #2104.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-10-16 08:39:44 +11:00
Toby Harradine
ad51fa830b
[Cleanup] [p]cleanup bot includes aliases and CCs (#2213)
Resolves #1920.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-10-15 22:29:07 +11:00
Twentysix
c464f5e7dc [CustomCommands] Add [p]cc show (#2204) 2018-10-10 10:27:25 +11:00
Toby Harradine
847f9fc8d1
[CustomCommands] Find default converters properly (#2199)
The new `redbot.core.commands.converter` module was causing default converters to never be found.

Also cleaned up some of the other code (made some methods static, fixed some typing violations)

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-10-07 12:58:08 +11:00
Toby Harradine
fa692ccc0b [i18n] Pass over economy, filter, general, image, mod
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-10-06 09:00:31 +10:00
Toby Harradine
0c3d8af8f4 [i18n] Pass over bank, cleanup, customcom, dataconverter, downloader
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-10-06 08:57:49 +10:00
Michael H
aa8c9c350e [i18n] Start work on named format arguments (#1795) 2018-10-06 08:42:38 +10:00
Toby Harradine
dea9dde637
[Utils] Finish and Refactor Predicate Utility (#2169)
* 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>
2018-10-06 08:07:09 +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
zephyrkul
61652a0306 [V3 CustomCommands] Cooldowns (#2124)
* customcom cooldowns

allows you to set multiple different cooldowns for custom commands

* black formatting

* [docs] cooldowns
2018-09-17 17:47:45 +02:00
Toby Harradine
27b0d606c8
Fix CCs with no args (#2114)
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-09-10 00:35:53 +10:00
zephyrkul
c1d8272b49 [CustomCommands] Show parameter name correctly in help (#2102) 2018-09-09 23:05:33 +10:00
zephyrkul
04e97f3516 [CustomCom] Custom Command Parameters (#2051)
* [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
2018-09-07 00:14:02 +10:00
Toby Harradine
1b196bf0fb
[i18n] Use redgettext over pygettext (#2023)
* [i18n] Use redgettext over pygettext

* Clear out autogenerated `messages.pot` files

* Remove redundant `regen_messages.py` files

* Refactor `generate_strings.py` to use redgettext

* Install redgettext in Travis Crowdin job

* Clean up some problematic usages of gettext function

* Reformat

* Replace generate_strings.py with Makefile argument

* Update to redgettext 2.1, use exclusion pattern

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-08-26 23:35:42 +10:00
Michael H
1c2196f78f autohelp changes. (#1836) 2018-07-12 01:23:18 +02: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
Eslyium
60a72b2ba4 [V3] Cleanup quotes in cogs (#1782)
* 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
2018-06-07 00:42:59 -04:00
Redjumpman
1fd5dffdc7 [V3/Misc] Spelling, Grammar, and doc string fixes. (#1747)
* Update streams.py

* Update filter.py

* Update permissions.py

* Update customcom.py

* Update image.py

* Update trivia.py

* Update warnings.py
2018-06-01 19:20:12 +10: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
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
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
Michael H
e86698cfeb [V3] Update some user facing info (remove old, outdated info) (#1613)
* remove outdated link in favor of in docstring docsumentation

* Update default Downloader repo url to org repo url (don't rely on github redirect)
2018-05-08 22:27:38 +02:00
palmtree5
efdf69552f
[V3] Beta 12 release (#1525)
* [V3] update translations from Crowdin

* [V3] bump version to 3.0.0b12
2018-04-16 19:05:21 -08:00
bobloy
705d9b8238 [V3] guild->server (#1529)
Mostly string renames
customcom now recognized {guild} and {server}
2018-04-16 11:32:51 -08:00
palmtree5
d60fc06379 [V3] Update translations from Crowdin (#1490) 2018-04-02 19:39:07 -04:00
Will
64af7800dc [V3 Config] Adjust functionality of get_attr (#1342)
* Intermediate commit

* Add defaulting stuff to config

* Remove set_attr in favor of set_raw

* Modify get_attr

* Fix issue with clearing data
2018-02-26 11:13:01 -09:00
palmtree5
0593bb9c53 [V3 i18n] Update translations from Crowdin (#1350) 2018-02-25 21:57:14 -05:00
palmtree5
86b5932c8f [V3] add a script for regenerating all strings (#1318)
* [V3] add a script for regenerating all strings

* Edits to the yml files

* Fix up deploy section

* Make generate_strings upload to Crowdin
2018-02-19 03:02:22 +01:00
aikaterna
0a0f2a9dcc [V3 CustomCom] Update cc list for V3 (#1149)
Fix for #1087.
2017-12-09 19:55:09 -05:00
palmtree5
edabd07719 [V3 Customcom] i18n support (fix Cog-Creators/Red-DiscordBot/issues/1018) (#1065) 2017-10-29 11:32:05 -04:00
Tobotimus
86b18c702c [V3] Custom context class (#988)
* Create custom context class

* Documentation

* Remove old help method, replace with new

* Update from rebase
2017-10-15 21:02:50 -04:00
palmtree5
36b3fbd5bc [V3 CustomCom] Initial V3 implementation (#1003) 2017-10-15 20:50:55 -04:00