159 Commits

Author SHA1 Message Date
bobloy
632840384b
Add discord.com to supported domains in INVITE_URL_RE (#4012)
* Support for discord.com

* Modified to support discord.com requiring `/invite`

* Non-capturing
2020-06-24 20:06:11 +02:00
jack1142
b49b53934d
Update deprecation warnings (#3608)
* Make deprecation notice specify minor release based on soonest date

* Stop specifying a specific release in shared libs deprecation notice

* Add actual deprecation warning for `APIToken` (OMG, this is so cool)

* Add dates (2020-08-05 for all)

* address review

* improve consistency

* Add __dir__ and show APIToken in docs (or maybe I want to annoy Flame)

* fix module name when importing non-existent name from parent package

* Fix stack level used by depr warn in `redbot.core.commands`
2020-06-22 03:25:33 +02:00
Draper
477186d09d
Add map(), find() and next() methods to AsyncIter (#3921)
* properly handle prefixes

* Docsss and typehinting

* aaaaaaaaaaa

* Apply suggestions from code review

* ffs

* docs

* docs

* Apply suggestions from code review

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* skip await if map is none

* implement `.next()`

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-06-21 19:47:48 +02:00
Draper
175fbebd73
Move logic for fetching latest Red version info to internal util (#3904)
* Only Send out of date message to Final builds available on PyPi

* Only Send out of date message to Final builds available on PyPi

* sorted the resulting list so that the newest build is first in the list

* forgot about this one

* well jack is a bitch but we love him.

* simplify logic

* Add the new function to `__all__`

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-06-18 22:21:59 +02:00
github-actions[bot]
0358473af5
Automated Crowdin downstream (#3984)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-06-18 14:33:59 +02:00
jack1142
ed89f70f98
Fix uses of re.sub() (#3826)
* Fix uses of `re.sub()` (pt. 1)

* Fix uses of `re.sub()` (pt. 2)

* Fix uses of `re.sub()` (pt. 3)

* Fix uses of `re.sub()` (pt. 4)

* Revert commands.py
2020-05-28 23:51:53 +02:00
Draper
4f25e6c1ad
Add information on how to update to out of date message (#3744)
* add a more detailed update help

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* ...

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* a bit more clarity

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* sure thing Jack

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* add a disclaimer to the update command saying if the user faces any difficulties to check the system appropriate docs and/or support server

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* add translation support

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* better translation support for these

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Update redbot/core/events.py

Co-Authored-By: Flame442 <34169552+Flame442@users.noreply.github.com>

* Apply suggestions from code review

Co-Authored-By: Flame442 <34169552+Flame442@users.noreply.github.com>

* review

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Revert black fuckery

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* aaaaaaaaaaaaaaaaaaaaaaaaaaa

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* address jacks review

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* black

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/core/events.py

* Update redbot/core/events.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/core/utils/_internal_utils.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-05-27 08:39:53 +02:00
github-actions[bot]
480c3129bd
Automated Crowdin downstream (#3830)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-05-07 16:37:33 +02:00
TrustyJAID
6f6c536236
[Alias] Create caching to call config less frequently (#3788) 2020-04-27 02:25:41 +02:00
PredaaA
c760b43e5a
Allow to disable escaping in chat formatting utils (#3742)
Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-04-24 18:17:19 +02:00
jack1142
b1fe807b47
Don't run command checks on each message starting with a prefix (#3718) 2020-04-24 18:12:25 +02:00
github-actions[bot]
61db89e89d
Automated Crowdin downstream (#3785)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-04-23 14:44:20 +02:00
Draper
a2c0e4ca2e
Fix sleeping and improve documentation for AsyncIter (#3776)
* welp

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* moar docs

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* moar docs

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Remove unnecessary items in `:exclude-members:`

* Make whitespace in docstrings consistent

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-04-21 13:45:03 +02:00
Draper
ad979180e5
Make the largest loops lazier and async to avoid blocking (#3767)
* lets reduce config calls here

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Lets normalize how we name config attributes across the bot.

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* ....

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Just a tiny PR improving config call in a lot of places (Specially events and Help)

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* stop using `bot.guilds` in `on_command_add`

* Just a tiny PR improving config call in a lot of places (Specially events and Help)

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* missed this one

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* nothing to see here

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* lets reduce config calls here

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Just a tiny PR improving config call in a lot of places (Specially events and Help)

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* stop using `bot.guilds` in `on_command_add`

* missed this one

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* welp

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* welp

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* welp

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* jack

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Update redbot/cogs/mod/kickban.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/cogs/filter/filter.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* jack

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* make all large loops async to avoid blocking larger bots

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* ...

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* okay now working AsyncGen

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* may or may not have forgotten black

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Apply suggestions from code review

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* jack's review

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* DOCS

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* DOCS

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Apply suggestions from code review

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* jack

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Apply suggestions from code review

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/core/utils/__init__.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/core/utils/__init__.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* avoid loop if possible and if not only iterate once

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-04-20 19:56:28 +02:00
github-actions[bot]
36a0eabf4a
Automated Crowdin downstream (#3739)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-04-09 21:27:35 +02:00
kennnyshiwa
60e954634d
Include domains added in #3717 in filter_invites's docstring (#3721) 2020-04-02 20:17:46 +02:00
kennnyshiwa
ffecf1ed15
Fix redbot.core.utils.common_filters.INVITE_URL_RE regex (#3717)
* Fix invite_url_re

Found that the regex used previously could falsely catch strings such as discord member and discord gggggg which aren't invites and shouldn't be caught, testing with this regex string still catches all invite url variations while allowing these other previously caught strings to keep working

* Update redbot/core/utils/common_filters.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-04-02 09:11:12 +02:00
jack1142
fce8186759
Add [p]set regionalformat command to set regional formatting (#3677)
* Add `[p]set region` command to set regional formatting

* Add Babel to intersphinx

* rename 'region' to 'regional format`
2020-03-28 23:23:02 +01:00
jack1142
c1a96c83fb
Update _internal_utils.py (#3673) 2020-03-28 01:37:59 +01:00
jack1142
eebea59fe3
Remove usage of loop arg in calls to start_adding_reactions (#3644)
* fix stacklevels of warnings

* stop using loop arg when calling start_adding_reactions

* [Audio] Stop using loop arg when calling start_adding_reactions
2020-03-20 20:44:57 +01:00
jack1142
4afe1ff569
Use correct prefixes when sending messages to owners (#3632)
* use correct prefixes when sending messages to owners

* make internal util for this instead

* oops

* fix circular import

* let's add back the actual fix I made this PR for...

* fix wrong logger name

* improve log message
2020-03-12 17:31:33 +01:00
Kowlin
3ff127d514
Automated Crowdin downstream (#3640) 2020-03-05 22:01:26 +01:00
jack1142
d6f9ddc3af
Check permissions before trying to clear reactions (#3589) 2020-02-29 16:00:19 +01:00
jack1142
227009733e
Revert "new mention behavior, new filter behavior (#3553)" (#3619)
* Revert "new mention behavior, new filter behavior (#3553)"

This reverts commit 066bf516d9b1ac27b1f7459a5f42aea56fffa4b1.

* keep invalid escape fix
2020-02-28 20:34:51 +01:00
jack1142
5ee73cdf63
Add clearer error when pages isn't made of embeds nor strings in menu() (#3571)
* Update menus.py

* Update menus.py
2020-02-20 22:25:14 -05:00
Michael H
066bf516d9
new mention behavior, new filter behavior (#3553)
* new mention behavior, new filter behavior

* and here too, ffs

* docs and reformat

* review handling
2020-02-14 09:07:16 -05:00
github-actions[bot]
0913b68a1e
Automated Crowdin downstream (#3543) 2020-02-13 12:54:28 -05:00
Cog-Creators Bot
4370ec922b
Automated Crowdin downstream (#3531)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-02-08 19:49:30 +01:00
Michael H
00cf395483
Handle deprecations in asyncio (#3509)
* passing loop to certain things was deprecated. additionally, `asyncio.get_event_loop()` is being deprecated

* awesome, checks are functioning as intended

* fun with fixtures

* we can just stop misuing that anyhow

* Update redbot/pytest/downloader.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-02-05 17:16:13 -05:00
Michael H
a8450580e8
[Commands Module] Improve usability of type hints (#3410)
* [Commands Module] Better Typehint Support

  We now do a lot more with type hints

  - No more rexporting d.py commands submodules
  - New type aliases for GuildContext & DMContext
  - More things are typehinted

  Note: Some things are still not typed, others are still incorrectly
  typed, This is progress.

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-01-26 17:54:39 -05:00
Stonedestroyer
e1a110b1bf [Misc] Typo fixes (#3427)
* [Misc] Typo fixes

* Changelog

* Trivia list

* Update 3427.misc.rst

* Changelog
2020-01-22 10:00:52 +00:00
Flame442
8f04fd436f Catches discord.NotFound in utils.mod.mass_purge (#3414)
* Catches `discord.NotFound` in `mass_purge`

* Create 3378.bugfix.rst
2020-01-20 17:09:17 -05:00
Michael H
9698baf6e7 [3.2.0 Docs] Some clarifications (#3292)
* docs

*  changelog

* Fix python for choco

* k

* little more
2020-01-09 16:16:10 +01:00
Michael H
a73b174d9f
update translation catalogs (#3280) 2020-01-07 17:16:21 -05:00
jack1142
ab747d2432 [Utils] Privatize internal utils (#3240)
* refactor(utils): privatize some utils

* chore(changelog): add towncrier entry

* refactor: update internal utils imports
2020-01-02 08:44:55 -05:00
Draper
f7e2617911 Fix an attribute error that can be raised in humanize_timedelta if seconds = 0 (#3231)
* Migrate Playlist to DB 3 TODO
1 Migrate Config to Schema 3 without playlists
and update get_playlist methods

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Revert "Migrate Playlist to DB 3 TODO 1 Migrate Config to Schema 3 without playlists and update get_playlist methods"

This reverts commit 4af33cff

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Allow removing tracks from queue by URL

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Words matter

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* *sigh*

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* chore

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Fix an attribute error that can be raised here is seconds = 0

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Fix an attribute error that can be raised here is seconds = 0

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* go away

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* *sigh*

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>
2019-12-29 09:37:50 -05:00
Michael H
bf6297aaf2
Add a small wrapper for APSW use (#3202)
* Add a small wrapper for APSW use

* changelog
2019-12-22 13:18:31 -05:00
jack1142
9d027747d1 [Backup] Fix generation of repos.json file in backup process (#3114)
* fix: generation of `repos.json` file in backup process

* chore(changelog): add towncrier entry
2019-12-20 02:03:46 -05:00
jack1142
59e7d063a0 [Tunnel] Add use_cached and images_only kwargs to files_from_attach (#2887)
* feat(tunnel): add `use_cached` kwarg

re #2885

* feat(tunnel): add `images_only` kwarg

re #2885

* chore(changelog): add towncrier entry
2019-09-28 17:28:14 -04:00
Flame442
7f22d27d51 Fixes the logic of MessagePredicate.greater and MessagePredicate.less (#3004)
* Fixes the logic of MessagePredicate.greater and MessagePredicate.less

* Create 3004.bugfix.rst
2019-09-18 17:15:24 -04:00
Michael H
4546ca9ba6
Clarify usage of humanize_timedelta (#3000)
- resolves #2986
2019-09-15 19:32:07 -04:00
Michael H
6075c5bde0
Rename bot.db as bot._config (#2967)
* Rename `bot.db` as `bot._config`

  - Continues work towards strong version guarantees
  - Added methods for cog use for a few things which were previously
  only accessible via direct access.
  - Retained private use in a few internal use locations, though most
  methods were updated away from this.
  - Updated documentation for shared api token users

* changelog

* more detail

* docstring fixes

* Apparently, I forgot to commit something I had locally

  - + a copy/paste failue in the changelog

* *sigh*:

* *sigh*
2019-09-01 15:42:28 -04:00
jack1142
26cc85806e [Utils] Stop using : in backup's filename - Windows doesn't accept it (#2957) 2019-08-28 12:01:02 +10:00
Draper
3c1b6ae4cf [Utils] Add humanize_number() function to chat formatting (#2836)
This adds babel as a dependency, and also includes `redbot.core.i18n.get_babel_locale()`
2019-08-28 08:44:52 +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
El Laggron
43da727a9f [Utils] Text to file (#2849) 2019-08-26 10:13:21 +10:00
Flame442
dfb4212d43 [Docs] Fix user parameter to predicates being typed as discord.TextChannel (#2914) 2019-08-18 09:05:22 +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
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
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