93 Commits

Author SHA1 Message Date
Twentysix
7028ca9df3 [Docs] Link bot account guide (#2440) 2019-02-11 20:17:39 +01:00
Toby Harradine
8f8c52d8c4
[Docs] Add note about pyenv optimisation flag (#2428)
Signed-off-by: Toby <tobyharradine@gmail.com>
2019-02-07 21:54:14 +11:00
Toby Harradine
c56fa5a320
Minor changes to install docs (#2427)
- 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>
2019-02-07 10:51:17 +11:00
Toby Harradine
7d5bae5a50
Use V2 of RTD's configuration file (#2418)
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-02-07 10:30:01 +11:00
Toby Harradine
016a6d3aa6
Bump minimum python version to 3.7.0 (#2394)
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>
2019-01-30 14:07:53 +11:00
Toby Harradine
b82756087a
Merge V3/release/3.0.0 into V3/develop 2019-01-28 15:30:30 +11:00
Toby Harradine
05bef917ae
Vendor discord.py (#2387)
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-01-28 14:14:36 +11:00
El Laggron
3b62572c89 Graceful shutdown when SIGTERM is received (#2286)
Only works on Unix.
2019-01-23 10:28:30 +11:00
Michael H
3dba09d19d [Docs] Chocolately/PowerShell install instructions for Windows (#2364) 2019-01-19 11:45:22 +11:00
Michael H
30c3a4c7c1 [Docs] CentOS correct git version (#2309)
Resolves #2260.
2018-11-24 10:06:59 +11:00
bobloy
d6cd959a2b [Docs] Update example cog to include base cog class (#2256) 2018-11-06 08:41:34 +11:00
Toby Harradine
ce25011f0d
[Config] Cast keys to str on get/set/clear (#2217)
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>
2018-10-11 11:18:57 +11:00
Toby Harradine
fb839084fe
Merge branch V3/feature/predicates into V3/develop (#1986)
Predicate utility to replace common boilerplate predicates for event waiting.
2018-10-06 08:15:25 +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
zephyrkul
ebc657dcc6 [Config] Add Group.clear_raw method (#2178)
Adds a `clear_raw` method to Group objects, similar to the existing `get_raw` and `set_raw` methods.
Documentation included.
2018-10-05 13:03:27 +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
1a9216b522
Set 3.6.6 as minimum python version on Windows (#2117)
* 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>
2018-09-14 21:22:43 +10:00
aikaterna
af220e497f [Docs] Update sample cog (#2072)
* [V3 Docs] Update sample cog

* Remove self.bot assignment

We don't really do this any more unless we need to
2018-09-09 23:35:22 +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
Michael H
aa8cc90ad0 Update minimum Python version to 3.6.2 (#2093)
* 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
2018-09-04 11:38:56 +10:00
Toby Harradine
ce031cf7bd
[Docs] Add virtualenv guide and compress install guides (#2029)
* [Docs] Add virtualenv guide and compress install guides

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

* [Docs] Better cross-referencing

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

* Fix pyenv-installer link

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

* Use sudo -e instead of sudo nano

* Add note about launcher for linux/mac

* Include launcher notes in Windows guide

* Add missing colon
2018-08-26 23:44:56 +10:00
Michael H
77944e195a Output sanitisation (#1942)
* 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
2018-08-24 23:50:38 +10:00
Caleb Johnson
1329fa1b09 [CogManager, Utils] Handle missing cogs correctly, add some helpful algorithms (#1989)
* 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.
2018-08-21 11:26:04 +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
6082eb21e3 [V3] Enforce use of redbot.core.commands (#1971)
* 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.
2018-08-13 11:10:13 +10:00
Toby Harradine
aec3ad382a
[CI] Re-enable and fix linkchecking for docs build (#1990) 2018-08-07 18:24:44 +10:00
Michael H
6c1ee096a1 [V3 permissions] command usage consistency (#1905)
* make the default rule settings consistent with the rest

* update docs to match new behavior
2018-07-12 04:09:28 +02:00
Toby Harradine
83a0459b6a [V3] Remove all mentions of Python 3.5 (#1896)
We don't speak of him any more.
2018-07-12 02:23:18 +02:00
El Laggron
c1bcca4432 [V3 Downloader] Allow use of prefix in install message (#1869)
* [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
2018-06-25 12:42:47 +10:00
Will
7b64f10fc7
[V3] Pin discord.py for beta 16 release (#1848)
* Update main requirements

* Update docs requirements

* Black reformat after version update

* Pin dpy  in docs
2018-06-10 19:01:58 -04:00
Will
b041d59fc7
[V3 Downloader] Make hidden hidden and add disabled (#1828)
* Make hidden hidden and add disabled

* Add documentation
2018-06-08 20:39:07 -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
Tobotimus
0dfd8b6453 [V3 Docs] Add intersphinx link to discord.ext.commands api reference (#1764) 2018-06-03 17:32:25 -08:00
Tobotimus
fb4f921159 [V3 Docs] Pin RTD yarl version (#1744) 2018-05-29 18:42:30 -08:00
Michael H
9eb6bb7738 [V3 permissions] more docs + minor addition. (#1737)
* more info

* docstring
2018-05-28 12:02:42 -08:00
palmtree5
f01d48f9ae [V3 Docs] allow [p]shutdown to actually shut the bot down (#1668) 2018-05-28 06:51:31 +02:00
Michael H
54975eb812 [V3] Permissions (#1548)
* 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...)
2018-05-28 00:17:17 +02:00
El Laggron
1de3251127 [V3 Docs] Reference 3.6 docs (#1715) 2018-05-27 12:05:35 -08:00
palmtree5
7e98076e4a [V3 Docs] expand info.json docs (#1699) 2018-05-25 12:38:32 +02:00
palmtree5
c58c55b752
[V3 Docs] Move the install docs to install Python 3.6 (#1685)
* [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
2018-05-24 11:09:08 -08: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
palmtree5
1ecaf6f8d5 Black formatting for generate_strings.py and docs/conf.py (#1658)
* Black formatting for generate_strings.py

* Also add docs/conf.py
2018-05-15 09:27:06 +10:00
Will
cbbeb412f9 [V3 Docs] Fix makefile and add dpy back in to the requirements (#1646) 2018-05-14 15:30:42 +10:00
Will
f544890f00 [V3 Docs] Modify RTD config to (hopefully) make it build (#1644)
* Fix docs requirements

* Modify RTD config
2018-05-14 15:03:43 +10:00
Tobotimus
4637ff78c0 [V3 Docs] Remove all build warnings (#1640)
* 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
2018-05-13 20:06:52 -08:00
Leo Garcia
a7d7b90ae8 [V3] Removed py 3.6 warning for Windows (#1622)
I believe we've fixed this awhile ago.
2018-05-14 09:32:41 +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
Bakersbakebread
53650aefa6 [Docs] Added self (#1608) 2018-05-08 19:47:11 +02:00
Wyn
f71aa9dd21 [V3 Docs] Autostart (#1599)
Moved note to the top, added how to access red log.
2018-05-05 15:43:26 -08:00