1392 Commits

Author SHA1 Message Date
Toby Harradine
326c53d6c4
Quick fix for postgres config details prompt (#2951)
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-08-27 14:25:05 +10:00
Toby Harradine
d1a46acc9a PostgreSQL driver, tests against DB backends, and general drivers cleanup (#2723)
* PostgreSQL driver and general drivers cleanup

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

* Make tests pass

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

* Add black --target-version flag in make.bat

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

* Rewrite postgres driver

Most of the logic is now in PL/pgSQL.

This completely avoids the use of Python f-strings to format identifiers into queries. Although an SQL-injection attack would have been impossible anyway (only the owner would have ever had the ability to do that), using PostgreSQL's format() is more reliable for unusual identifiers. Performance-wise, I'm not sure whether this is an improvement, but I highly doubt that it's worse.

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

* Reformat

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

* Fix PostgresDriver.delete_all_data()

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

* Clean up PL/pgSQL code

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

* More PL/pgSQL cleanup

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

* PL/pgSQL function optimisations

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

* Ensure compatibility with PostgreSQL 10 and below

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

* More/better docstrings for PG functions

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

* Fix typo in docstring

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

* Return correct value on toggle()

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

* Use composite type for PG function parameters

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

* Fix JSON driver's Config.clear_all()

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

* Correct description for Mongo tox recipe

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

* Fix linting errors

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

* Update dep specification after merging bumpdeps

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

* Add towncrier entries

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

* Update from merge

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

* Mention [postgres] extra in install docs

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

* Support more connection options and use better defaults

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

* Actually pass PG env vars in tox

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

* Replace event trigger with manual DELETE queries

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-08-26 22:02:26 -04:00
Flame442
57fa29dd64 Rename two changelog files from fix to bugfix (#2949) 2019-08-27 11:42:31 +10:00
Michael H
bfa55922cf Add note for using towncrier with standalone PRs (#2915) 2019-08-27 11:39:51 +10:00
El Laggron
43da727a9f [Utils] Text to file (#2849) 2019-08-26 10:13:21 +10:00
jack1142
580c4429e8 Add pip-wheel-metadata folder to .gitignore (#2941) 2019-08-20 10:37:23 +10:00
PredaaA
3498f8ccb6 Remove commas for explanations about how to set API keys (#2905)
This removes commas in explanations about how to set API keys in streams, image and audio cogs, since it has been changed in #2692.
2019-08-18 09:50:48 +10:00
Aurorum
5e9b3d9190 [Trivia] Michael Jackson & Prince Lyrics (#2894)
I thought it'd be fun to offer lyrics as a trivia, but it can be tricky selecting songs which are known widely enough that a significant number of people have a reasonable chance of answering the questions correctly.

As such, to narrow down the scope, these add trivia questions for Michael Jackson and Prince, two of the most well-known artists across the world whose musical collections are extensive and popular enough to dedicate an entire trivia too.

They're comprised of a variety of lyrics, two lyrics for each song. Players need to name the song from the lyric. Most of the songs are well-known songs from the artist, but there are plenty of challenges too.
2019-08-18 09:31:32 +10:00
Flame442
dfb4212d43 [Docs] Fix user parameter to predicates being typed as discord.TextChannel (#2914) 2019-08-18 09:05:22 +10:00
Ianardo DiCaprio
b1ccfab6d2 [Mod] BugFix (#2932)
* Initial Commit

* Add files via upload
2019-08-13 14:33:03 -04:00
Michael H
984a97d958
[Core Commands] remove set owner and set token (#2928)
* remove set-owner and set token

* whoops, wrong number on the changelog

* whoops, git didnt detect the rename cause I didnt add the file
2019-08-13 13:57:16 -04:00
DevilXD
463546f102
Added changelog entry 2019-08-08 17:12:58 +02:00
DevilXD
477a17d0b9
Fixed docs inconsistency 2019-08-08 17:06:11 +02:00
Draper
556af32bb5 Stop saving JSON files with indents (#2921)
Stop saving json files with 4 indents, this will significantly reduce file size and improve `.set()` performance for config saves when using the JSON driver.

Signed-off-by: Draper <guyreis96@gmail.com>
2019-08-07 10:13:31 +10:00
Toby Harradine
ef8b9b81c3 [ModLog] Optimise get_next_case_number() (#2908)
* [ModLog] Optimise get_next_case_number()

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

* Address reviews

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

* Add changelog entry

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

* Delete get_next_case_number

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

* Add modlog.get_latest_case() and fix `[p]reason`

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-08-02 10:49:22 -04:00
Toby Harradine
9362dd9465
Merge V3/release/3.1.5 into V3/develop 2019-07-31 09:43:35 +10:00
Toby Harradine
6c9c57c14d Bump version to 3.1.5
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
3.1.5
2019-07-31 09:23:18 +10:00
Toby Harradine
404c5f6dc0 [Audio] Bump Lavalink version to 3.2.1_823
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-07-31 09:22:16 +10:00
DiscordLiz
20091cc10a [ModLog API] Add default casetypes, remove need for a specific auditlog action (#2901)
* I know this needs a changelog entry and docs still

* update tests for new behavior

* update docs, filter; add changelog

* Ready for review

* stop fetching the same Audit logs when the bot is the mod

* I forgot to press save

* fix a comprehension

* Fix AttributeError

* And the other place that happens

* timing fixes
2019-07-27 15:37:29 -04:00
Michael H
6280fd9c28
disabled help hideaways (#2892)
* disabled help hideaways

* can_see fix
2019-07-27 02:36:21 -04:00
Toby Harradine
af096bc1cc Config locks (#2654)
* Config locks

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

* Add locks for all_XXX

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

* Remove a word

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

* Add acquire_lock kwarg for value context manager

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

* Add towncrier entry

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

* Fix issues with `get_custom_lock` and `get_members_lock`

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-07-23 16:50:07 -04:00
Michael H
a8091332b8 [Docs] Add version guarantees (#2882)
Make some version guarantees.

We also need to do a pass over the existing things this would cover and decide if any of them should be made private.
2019-07-19 11:50:33 +10:00
DevilXD
7ba50c91a2 Fixed remove_command error when trying to remove a non-existent command (#2889)
* Fixed remove_command error when trying to remove a non-existent command

* Added changelog entry
2019-07-18 05:49:40 -04:00
DevilXD
0ba9eaeccc Slowmode now accepts integer only inputs as seconds (#2884)
* Slowmode now accepts integer only inputs as seconds

* Added changelog entry
2019-07-17 08:47:37 -04:00
Michael H
d4b6fdea92 Add towncrier (#2873)
* Adds towncrier as our changelog system.
* Updates our contributor guidelines for this.

Resolves #2872
2019-07-17 11:12:43 +10:00
Toby Harradine
f0f274e1e1 Bump version to 3.1.4
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
3.1.4
2019-07-16 11:26:25 +10:00
Toby Harradine
e9f014df07
Revert "Update Crowdin configuration file" (#2878)
This reverts commit 03e59ea9.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-07-16 10:44:49 +10:00
Toby Harradine
778eadd418
[ModLog] Fix get_case() and get_casetype() (#2877)
This fixes `[p]reason` and `[p]case` with cases that were created after 3.1.3.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-07-15 20:18:21 +10: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
Michael H
3b0567d261
bump (#2864) 3.1.3 2019-07-14 00:17:44 -04:00
Michael H
49a75b5f19 command translator quick fix (#2870)
* command translator quick fix

* command translator quick fix
2019-07-14 13:55:47 +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
Toby Harradine
d5c412e3df [Permissions] Fix Requires.ready_event.set() on subcommands (#2868)
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-07-13 23:05:07 -04:00
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