1059 Commits

Author SHA1 Message Date
Toby Harradine
1d2980f8fa [Permissions] Send help on missing argument (#2865)
* [Permissions] Send help on missing argument

Resolves #2851.

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

* [Permissions] Use varargs instead of Greedy converter

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-07-13 21:52:28 -04:00
jack1142
3e80edcdfd [Docs] Add awaits and missing imports in usage examples (#2860)
Well, the modlog examples had to be changed a lot, because `await` obviously won't work in regular method.
2019-07-14 11:30:10 +10:00
aikaterna
be184b57dd [Audio] Update equalizer permissions (#2813)
* [Audio] Update equalizer permissions

* Reformat header on eq list for i18n

* Style
2019-07-13 20:48:13 -04:00
Toby Harradine
f83f378528 [Core] Make Requires.verify() wait until rules are loaded (#2857)
* Make Requires.verify() wait until rules are loaded

Also ensures `Requires` objects are reset when unloaded, particularly in case a `Command` object manages to stay in memory between cog unload and load, and its permissions rules change between those events.

Also, this PR re-ordered some of the event loop policy stuff, because it was required that the event loop policy be set before creating any `Requires` objects. This may or may not have an effect on other `get_event_loop()` calls elsewhere (either in our code, a dependency's, or asyncio's). Either way, these effects would be a *correction*, and any bugs that arise from it are likely to have been occurring silently beforehand.

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

* Remove calls to `remove_listener()` in permissions

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

* Fix adding rules for permissions cog/commands itself

Also addresses feedback

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

* Clean up indentation when setting uvloop policy

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

* Use `set(walk_commands())` to traverse `Group` subcommands

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-07-13 20:47:40 -04:00
Michael H
21a6384ebf [Modlog] Fix get_case for missing cases (#2858)
Due to the modlog redesign, the detection for a missing case changed. This fixes `get_case` for this.

This resolves #2844.
2019-07-14 10:47:16 +10:00
Toby Harradine
03e0683dd7 [ModLog] Actually prevent duplicate kwarg error
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-07-13 14:39:50 +10:00
Michael H
ac2813012a
[Core] Cog load fixes (#2854)
* split out some fixes from red#2853

* address feedback

* feedback
2019-07-12 22:11:06 -04:00
Toby Harradine
e34eca557b [ModLog] Prevent duplicate kwarg error (#2848)
* [ModLog] Prevent duplicate kwarg error

The `name` key used to be set in the Config for casetypes.

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

* Don't mutate `data` argument

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-07-12 20:17:00 -04:00
Flame442
687b88ca6f Added some periods to some strings (#2852) 2019-07-12 18:29:27 -04:00
DevilXD
776c75ba86 Fixed [p] not being replaced in code blocks (#2846) 2019-07-09 03:22:52 -04:00
aikaterna
55ff9bedb7 [Audio] Check for player when not connected (#2842) 2019-07-08 13:17:50 +10:00
Toby Harradine
2bdc3ac10c [General] Fix KeyError in [p]urban
Resolves #2841.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-07-07 18:51:36 +10:00
Toby Harradine
f2039300c2 [Mongo] Use escaped identifiers to extract inner value (#2832)
This was causing a KeyError to be raised whenever a key containing $ or . was part of the identifiers path, even if the value was actually in the dict.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-07-05 18:02:18 -04:00
Cog-Creators Bot
03e59ea9d3 Update Crowdin configuration file 2019-07-05 20:21:25 +02:00
Draper
a89a156f8e [Context] Adds react_quietly method to context (#2834)
* [Context] Adds react_quietly method to context

This allows developers to emojis to command messages
This is a modified version of tick()

It accepts True/False for Tick/Cross emoji and in addition to that any other emoji the bot can see

* Removed True/False support from react quietly

* Stopped catching InvalidArgument on react_quietly so that is propagated to devs
2019-07-03 15:26:22 -04:00
Michael H
0eb22c84ff [Bank API] Add cost decorator (#2761) 2019-07-03 10:07:19 +10:00
aikaterna
d1593b8069 [Audio] Catch unhandled internal folder types (#2824)
The `folder:` and `localfolder:` prefixes are used internally with some localtracks strings to define what to do with the item when it's cycled through the search function. Users theoretically should have never seen this issue as [p]search is used on the user side for YouTube and Soundcloud searching and not local searching, but this handles the issue where a folder is being passed to these functions that doesn't exist.
2019-07-02 13:15:34 +10:00
aikaterna
93391d028c [Audio] _enqueue_tracks clarification/fix (#2822)
Resolves #2820.

Added some comments to clear up a little of the mystery in a couple places.
2019-07-02 13:11:44 +10:00
Flame442
142fb0ad08 [Trivia] Car list fixes (#2825) 2019-07-02 12:03:12 +10:00
jack1142
942dca43d3 [Downloader]: RepoManager: don't load repos in __init__ (#2829)
Loading repos is already done in initialize() method.
This could actually turn out badly
if both
of git processes would touch the same repo at the same time.

This also fixes create_backup in
setup.py - now it properly generates repos.json
2019-07-02 11:57:30 +10:00
jack1142
081bf663a4 test(core): ignore pylint's ImportErrors for distro package (#2830) 2019-07-01 21:54:56 -04:00
Toby Harradine
55e309125e
Add uvloop as Posix+CPython dependency and tweak new Make recipes (#2819)
- uvloop is now a dependency on non-Windows CPython systems
- `make setupenv` renamed to `make newenv`
- `make syncenv` added to sync local venv to current dependencies
- `dev-requirements.txt` moved into `tools` directory
2019-07-02 11:53:38 +10:00
Flame442
7323e8eb67 [Trivia] Beethoven corrections for entertainment list (#2823) 2019-07-01 09:29:26 +10:00
Michael H
098540b9e5
[Core] Fix user output on cog load/reload (#2767)
* [Core] Fix user output on cog load/reload

  - Properly fixes the load/reload exception handling
  - Fixes some i18n use here to not make assumptions about other
  languages pluralization rules.

* Fix some typos

* Address Flame's Feedback

* It's important to save before committing ...

* formatting

* Fix some formats...
2019-06-29 12:16:28 -04:00
Elizabeth Sherrock
10412c4f51 Fix broken link in set color docstring (#2803) 2019-06-30 01:35:47 +10:00
PredaaA
2f8b1a21c7 [Audio] Fix config set in shuffle and repeat commands (#2812)
Resolves #2811 and also the same thing in repeat command.
2019-06-30 01:28:29 +10:00
PredaaA
03fe3ee720 [i18n] Fix some missing i18n strings in the whole bot (#2633) 2019-06-30 01:13:53 +10:00
Michael H
8a72840de0 [Utils] Modify chmod use in safe_delete (#2701)
- Takes a pessmisitc approach that it's possible chmod succeeds, but
 deletion fails and does not make the entire dir world writeable
2019-06-30 00:45:44 +10:00
Ryan
8bf86f33a3 [Readme] Update RTD and d.py URLs (#2771) 2019-06-30 00:33:41 +10:00
Michael H
8637f8a852 [Filter] Fix cache invalidation (#2810) 2019-06-30 00:30:09 +10:00
Toby Harradine
bff7e214ab Kill JsonIO and fix JSON driver caching issues (#2796)
* Kill JsonIO and fix JSON driver caching issues

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

* Ensure lock covers critical region in set()

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

* Make tests pass

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

* Use pickle over deepcopy in Config

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

* Fix temp instance creation

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

* Serialise value before doing anything in set()

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-06-27 14:49:45 -04: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
Toby Harradine
461f56bca1
Kill Pipfile, update dependencies, and add dep bumping tools (#2806)
### Replacement for pipenv's environment setup
First of all, there's a new Make recipe for all devs and contributors on both Windows and Posix, `make setupenv`, which is kind of a replacement for `pipenv install --dev`. It creates a virtual environment in `.venv` using the inbuilt `venv` module, clearing out any existing virtual environment if needed first. Then it installs all dev dependencies using our new `dev-requirements.txt` file. `CONTRIBUTING.md` has been updated to reflect all of this.

### Dependency version bumping tool
Secondly, I've added a python script, `tools/bumpdeps.py` to help with bumping dependency versions. It has its own Make recipe too, `make bumpdeps`. This script won't work on Windows (yet). It reads the `tools/primary_deps.ini` file, which contains the primary requirements of Red and its extras with loose version specifiers, and outputs all pinned dependencies, in `setup.cfg` format. It's not a foolproof dependency resolver, it's quite simple, but it's bound to help out a lot. It'll try to give warnings if there might be a version conflict, but updating `setup.cfg` with its output and then doing `pip install -r dev-requirements.txt` will allow pip to issue warnings if something is conflicting.

So to add a new dependency, add it to `tools/primary_deps.ini` in the appropriate place, and either use `make bumpdeps` to completely update all dependencies, or simply add it to `setup.cfg` manually with its sub-dependencies, and all versions pinned.

### Sphinx 2.1.2 (docs changes)
The sphinx update brought along the ability to disable type annotations being rendered in function and method signatures, and I have gladly gone and done that. Type annotations should already be specified under the "Parameters" section, and the way sphinx renders them in function signatures makes them much harder to read.

Also, documented classes will now display what classes they inherit from.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-06-28 00:16:14 +10:00
aikaterna
d1d4ec3e38 [Audio] No capitalization needed (#2801) 2019-06-27 08:13:01 -04:00
aikaterna
a0f34bbbd9 [Audio] Move DJ role check in [p]summon (#2799) 2019-06-27 10:48:06 +10:00
Toby Harradine
49819a2eeb
[ModLog] Fix get_all_casetypes() (#2807)
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-06-26 20:39:22 +10:00
Toby Harradine
f91d8610ae
[ModLog] Use custom scopes for ModLog Config (#2766)
Modlog was the biggest culprit for seriously large documents in the MongoDB backend, since it stored all cases as nested dicts in the guild scope. So, for example, on the Fortnite server, the guild document for Kowlin's bot had exceeded 8MB. 

This commit gives each case its own document. It also does the same for casetypes. Not only does it remove the possibility of the document exceeding the maximum size in MongoDB, it's also just more efficient for all backends.

Other misc changes: Fixed a bunch of type-hints, and also added more support for when an object related to a case (user, moderator, channel etc.) can't be found (because it was deleted or something rather)

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-06-26 00:52:33 +10:00
kennnyshiwa
52f5d5cd6a [Mod] add role mentions to userinfo and reverse role sorting (#2759)
* add role mentions to userinfo and reverse role sorting

This small PR adds the role mentions to userinfo and reverses the sorting so that the top most role of a user is at the left of the embed

* Remove sorting as it's handled by d.py
2019-06-24 02:39:03 -04:00
aikaterna
870b615364 [Audio] Queue & misc cleanup (#2784)
* [Audio] Queue & misc cleanup
2019-06-24 01:09:04 -04:00
aikaterna
25ccc11dc4 [Audio] Add [p]summon (#2786) 2019-06-24 01:05:01 -04:00
aikaterna
f2b7ce9546 [Audio] Add equalizer (#2787)
* [Audio] Add equalizer

* [Audio] Add equalizer
2019-06-24 00:58:20 -04:00
DiscordLiz
6bdc9606f6 [Core] Multiple mod admin roles (#2783)
* Adds Schema versioning
  - Adds Migration tool
  - Adds tool to migrate to allow multiple admin and mod roles
  - Supports Multiple mod and admin roles

* Ensures migration is run prior to cog load and connection to discord

* Updates to not rely on singular mod/admin role id

* Update requires logic for multiple mod/admin roles

* Add new commands for managing mod/admin roles

* Feedback

Update strings
Update docstrings
Add aliases

* Use snowflakelist

* paginate

* Change variable name

* Fix mistake

* handle settings view fix

* Fix name error

* I'm bad at Ux

* style fix
2019-06-23 23:36:00 -04:00
Toby Harradine
71d0bd0d07
Various Config and Mongo Driver fixes (#2795)
- Fixes defaults being mixed into custom groups above the document level when doing `Group.all()`
- Fixes `Config.clear_all()` with Mongo driver
- Fixes `Group.set()` with Mongo driver on custom groups above the document level
- Fixes `IdentifierData.custom_group_data` being set to the wrong thing in `BaseDriver.import/export_data` (although this was an inconsequential bug)

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-06-24 12:55:49 +10:00
Michael H
6ae3040aac [Filter] Make name filtering behavior consistent (#2794)
- Uses the updated filter check
  - This is also a performance gain on large servers with filter names
  enabled.
2019-06-23 16:39:24 +10:00
aikaterna
065396abab [Audio] Change Lavalink.jar version checking (#2785) 2019-06-23 14:10:31 +10:00
Toby Harradine
1804314f45
[Audio] Improve Lavalink download/connection exception handling (#2764)
- More errors will be logged to the console with clearer messages when something goes wrong
- Downloading the Lavalink Jar will abort after 5 failed attempts. The connect task will also abort if an unhandled exception occurs whilst downloading or connecting to Lavalink. After this occurs, instead of responding "Connection to Lavalink has not yet been established" to commands, the bot will respond "Connection to Lavalink has failed". This has no effect on other commands which don't involve connecting to Lavalink (e.g. settings commands).
- Logs this message when Lavalink jar is successfully downloaded: `Successfully downloaded Lavalink.jar (<x> bytes written)`
- Uses [`tqdm`](https://github.com/tqdm/tqdm/) to display a progress bar whilst downloading Lavalink.jar.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-06-23 14:09:59 +10:00
DevilXD
ff894ecbe7 [Docs] Add warning about PATH on Windows (#2791) 2019-06-23 13:55:48 +10:00
jack1142
0bf54fae52 [Admin] Convert set to list because set is not JSON serializable (#2792) 2019-06-23 13:33:27 +10:00
MeatyChunks
3c66c602f6 [Help] Prevent spamming when a user blocks the bot (#2790)
Currently the bot sends an error message for each page of help, this should make it only send once.
2019-06-22 01:41:11 -04:00
aikaterna
e854716236 [Audio] Fix for escape character prefixes (#2789) 2019-06-21 22:19:57 -04:00