8 Commits

Author SHA1 Message Date
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
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
palmtree5
fb093b7411 [V3 Utils] Menu system (#1566)
* [V3 Utils] start on a menu system

* Fix conflicting names

* [V3 Menus] change order of default controls

* [V3 Menus] add a message check to the react check

* Add a note about original source and who ported

* Compare message ids, not the objects themselves
2018-05-04 05:54:30 +02:00
Michael H
38531bf95c [V3 Tunnel utils] Better handling of tunnel instances (#1538)
* Better handling of tunnel instances

* docs
2018-04-16 19:02:38 -08:00
Michael H
d65f8856f4 [V3] Data Converter (#1293)
* More docstrings

* still not ready...

* push this untested pile of code.

* working, menu needs cleaning up though, modlog converter not here yet

* menu cleanup

* add note about the fact that values are overwritten

* add i18n

* User friendlier quitting

* Better naming of a function

* setup automodule for dataconverter

* More documentation

* use Config.MEMBER (etc) instead of 'MEMBER' (etc)
2018-04-02 21:14:37 -04:00
palmtree5
4e2b83c052 [V3 Docs] Add and update existing features (#1451)
* [V3 Docs] bump version

* Remove removed functions from __all__

* Update docstring format

* Update copyright year

* Add embed utils docs

* Document bot class

* Document RPC

* Update toctree
2018-03-24 17:27:04 -04:00
Tobotimus
5cef3e13e1 [V3 Docs] Docs for utils package (#1085)
* Docstrings for chat formatting

* Docstrings for mod utils

* Type checking

* Override CSS to highlight object name in definition

* More typing

* Utils docs pages

* Fix typo here
2017-11-19 13:14:05 -09:00