149 Commits

Author SHA1 Message Date
jack1142
b6ca8f7d2c [Core] Escape markdown in python executable path in `[p]debuginfo` command. (#3254)
* Update core_commands.py

* Create 3254.misc.rst
2020-01-03 22:44:33 -05:00
jack1142
36e2cde04d Move [p]backup command to cli command - redbot-setup backup (#3235)
* refactor: replace backup command with cli command

* chore(changelog): add towncrier entries
2020-01-02 09:03:32 -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
jack1142
aabdabf3bc [Core] Prevent users from locking out themselves or guild owner with localblacklist (#3221)
* Update core_commands.py

* Update core_commands.py

* Create 3207.bugfix.rst

* Update core_commands.py

* Create 3221.bugfix.rst

* Update redbot/core/core_commands.py

Co-Authored-By: Michael H <michael@michaelhall.tech>

* Update bot.py

* Rename 3221.bugfix.rst to 3221.bugfix.1.rst

* Create 3221.bugfix.2.rst

* Update bot.py

Co-authored-by: Michael H <michael@michaelhall.tech>
2019-12-27 17:33:22 -05:00
jack1142
75c4bee8a3 [Core] Tell user that the (local) whitelist/blacklist is empty when using a list command. (#3219)
* Update core_commands.py

* Create 3219.bugfix.rst
2019-12-27 17:07:43 -05:00
Michael H
8b18526f46
[Help] Fix embed size calculation for additional text (#3208)
* Fix size calculation for additional text

* changelog

* ffs

* because of course that's a thing

* *sigh*

* prevent an edge case

* more

* ...

* ...
2019-12-26 16:53:03 -05:00
Michael H
a36e95c286
Remove a large amount of fetch_user calls (#3075)
* Non-audio changes

* address Flame's feedback
2019-12-21 01:15:34 -05:00
jack1142
b457f8d1c1 [Core] Add deprecation warnings about removal of shared libraries. (#3106)
* feat: add deprecation warning when importing shared libs

* enhance(downloader): add shared libs deprecation warns

* enhance: add deprecation warning when (re)loading cogs

* docs(downloader): add deprecation note about shared libs

* chore(changelog): add towncrier entries

* style: split long tuple unpacks in multiple lines

* fix: argument to `humanize_list` has to be a sequence
2019-12-20 02:06:53 -05:00
jack1142
335ded674e [Core] Add Python executable field to [p]debuginfo command (#3184)
* Update core_commands.py

* Create 3184.enhance.rst
2019-12-11 16:40:27 -05:00
Flame442
b4186d6724 Clarifies what [p]backup does (#3172)
* Clarify `[p]backup`

* Create 3172.enhance.rst
2019-12-07 19:24:07 -05:00
PredaaA
77742179c0 [Core] Add [p]listdisabled command (#3118)
* Update core_commands.py

* Create 3115.feature.rst

* Rename 3115.feature.rst to 3118.feature.rst

* Add a message if there's any disabled commands.

* Use the same format as [p]command disable/enable

* Make strings more i18n friendly.

* Flame's requested changes.
2019-11-22 18:54:01 -05:00
Vexed
6aeca83c63 Increased clarity of wording in info command (#3121)
* make branch + preliminary code

* correction

* towncrier

* sinbad's changes
2019-11-14 13:04:00 -05:00
Michael H
6852b7a1d1
License info command (#3090)
* Adds a licenseinfo command

* good enough for now

* changelog

* *sigh* Fine, have it your way Draper

* thanks Flame
2019-11-09 14:06:07 -05:00
Vexed
759ca3ba7e Quotes in helpset tagline for clarity (#3012)
* Add quotes to clarify helpset tagline

Add quotation marks to helpset tagline's response so two consecutive full stops don't appear.

* more commiting

* make travis/black happy

* for review

make no longer repeat tagline
2019-09-29 07:42:44 -04:00
Michael H
e38c08ab12
fix uptime for uptime of less than a second (#3009)
* fix uptime for uptime of less than a second

* changelog

* More conclusive fix
2019-09-28 15:35:26 -04:00
Michael H
25614620db
More privatization, and some error helpers (#2976)
* More privatization, and some error helpers

This makes a lot more things private. Continued from #2967, fixes #2984
Adds public methods for various things.

Below is a brief summary of things available elsewhere, though this
particular set of changes may warrant a detailed section in the release notes.

 - bot.db.locale -> redbot.core.i18n.get_locale
   - Note: This one already existed.
 - bot.db.help -> redbot.core.commands.help.HelpSettings
 - bot db whitelist/blaclist? -> bot.allowed_by_whitelist_blacklist
   - This has also been made a single cannonical function for this
   purpose including check usage
 - bot color? -> bot.get_embed_color/bot.get_embed_colour
 - bot.id.api_tokens? ->

   - bot.get_shared_api_tokens
   - bot.set_shared_api_tokens
   - bot.remove_shared_api_tokens

 -bot.db.prefix -> bot.get_valid_prefixes
   - (Note: This is a wrapper around bot.get_prefix)

 Other changes include
  - removing `bot.counter` as it was never used anywhere
  - Adding properties with helpful error messages for moved and renamed
  things
  - making bot.uptime a property with an error on set
  - adding a migration to the bot config for shared_api_tokens

* Remove overly encompassing message redaction, eval is a risk, dont run in dev if you cant manage it

* address Flame's feedback

* rephrase example

* changelog extras

* You saw nothing
2019-09-26 12:55:05 -04:00
Michael H
ee3be8b633 Extra info (#3008)
* Extra info

* changelog
2019-09-20 16:55:46 +02:00
Flame442
0be3b1acd7 Fixes the strings of [p]set usebotcolor (#2974)
* Fixes the help text of `[p]set usebotcolor`

* Create 2974.bugfix.rst
2019-09-02 09:43:56 -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
Flame442
efcf91e934 Catch discord.errors.Forbidden when DMing a user the invite message (#2948)
* Catch discord.errors.Forbidden when DMing a user the invite message

Uses the same error message as `[p]help`

* Create 2948.bugfix.rst

* You saw nothing
2019-08-29 21:19:19 -04:00
aikaterna
b8a7a66566 [Core] Inviteset public and perms help cleanup (#2963)
* [Core] Inviteset public and perms help cleanup

* Towncrier entry
2019-08-29 21:18:43 -04: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
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
jack1142
081bf663a4 test(core): ignore pylint's ImportErrors for distro package (#2830) 2019-07-01 21:54:56 -04: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
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
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
Neuro Assassin
9d008d587a [V3 Core] Add checks to [p]command (#2770)
* Add checks to [p]command

* Change to privilege level
2019-06-18 21:35:56 -04:00
El Laggron
61b5730c48 [V3 Core] More features for the bot invite URL (#1847)
* Add inviteset group command

* Fix errors

* Fix line break

* Remove user bot support

* Fix docstrings line breaks

* Remove embed specific formatting

* Remove invite redirect

* Add self argument to _can_get_invite_url

* Remove unused import

* fix errors related to classes + double help

* Removed self bot support
2019-06-03 11:46:13 -04:00
Michael H
16443c8cc0 [CI] Improve automated checks (#2702)
* same stuff, but with some more spurious error supression

* fix issue in permissions found in this

* fix a few more spurious errors

* fix another issue

* semi-spurious error fixes

* .

* formatting

* move this to properly log

* distutils import + virtualenv

* more fixes
2019-06-02 19:42:57 +02:00
DiscordLiz
1ccc441aab [Core] Make contact use configured destinations (#2743)
* Make contact use configured destinations
2019-05-31 05:32:26 -04:00
DiscordLiz
8ddc5aa63e [Core] Add commands to manage owner notification destinations. (#2745) 2019-05-31 05:13:36 -04:00
PredaaA
b4f4e080af [core_commands] Using humanize_timedelta for [p]uptime command (#2735)
* Update core_commands.py
2019-05-27 20:39:36 -04:00
Michael H
68590dfdb8 [Core] Improve API token converter (#2692)
* improve api converter

* make usage more clear
2019-05-25 23:58:14 +02:00
Stonedestroyer
cd745d35c2 [Core] Add debug info command (#2728)
Shows useful debug information for debugging.
2019-05-24 17:55:48 -04:00
Michael H
644aaf0c0e
[Help] Continuing work and bug-fixes (#2676)
* [Help] Add settings for various things

  - Fixes a small issue in a previously not-exposed logic path
  - Fixes an issue with denied commands help invocation
  - Adds some global usage settings

* remove outdated comment

* improve intent of strings

* added punctuation

* Add DM forbidden handling

* use a slightly different method for shortening embed width specifically
2019-05-18 06:54:02 -04:00
zephyrkul
7dd3ff7c8d [Core] Strip commas in user input for load, reload, unload (#2693)
rstrip commas, closes #2695
2019-05-16 23:54:17 -04:00
Flame442
7400008384 Adds [p]datapath to print the bot's data path (#2652)
* Add `[p]datapath` to print the bot's datapath

* Adds 2652
2019-05-14 01:05:52 -04:00
Flame442
d1c903f36f Fix grammar mistake by changing "to large" to "too large" (#2646) 2019-05-06 12:18:57 -04:00
James
52433d253f String format failure when set invoked without subcommand (#2638) 2019-05-02 15:44:33 -04:00
Neuro Assassin
c79b5e6179 [Core Commands] Add patch for invalid path with [p]backup (#2626)
* Add patch
2019-04-29 19:38:36 -04:00
PredaaA
e3db3c0341 [Core_commands] Fix some missing i18n strings (#2631)
* Update core_commands.py

* Update core_commands.py
2019-04-29 15:21:58 -04:00
Flame442
22c318fda3 [Core] Adds a check to [p]set locale (#2553)
* Adds a check to [p]set locale

Fixes #2552
I would like a little bit of feedback on this change.
- Right now, `locale_name` is case sensitive. Should that remain case sensitive or should I allow it to accept it case insensitively?
- I made the invalid locale string an i18n string, however I don't know the process for how those are supposed to be made or if that will break anything. Should that remain an i18n string or should I make it a normal string?

* Case insensitivity and explicit en-US

-`[p]set locale` is now case insensitive
-`en-US` added to `[p]listlocales` instead of only existing in `[p]set locale`'s help text

* Remove spacing
2019-04-23 17:43:50 -04:00
Michael H
466b2b82d0 Fix localwhitelist/localblacklist add/remove (#2531) 2019-04-02 22:46:12 -04:00
Flame442
d52b3eaf21 Proper capitalization of [p]blacklist help text (#2511) 2019-03-07 08:57:06 +11:00
TrustyJAID
3f1d416526 Allow central storage of API keys (#2389)
This creates a central location to store external API tokens that can be used between cogs without requiring each cog to be loaded for it to work.

A new set option for `[p]set api` is created to assist in forming bot readable API token locations.

This also updates the Streams cog to utilize the central database.

Tokens are moved from the old data locations in core cogs on load.
2019-02-19 10:22:44 +11:00
zephyrkul
820be2a0ae [Core] Utilize consume rest, Union (#2407) 2019-02-13 14:11:22 +11:00
Twentysix
889fa63aff Sentry removal (#2439)
Resolves #2430.
2019-02-11 11:19:02 +11:00
Twentysix
b350ac38dc Allow [p]info customization (#2417)
* Allow [p]info customization

* Style

* Naming
2019-02-08 02:38:26 +01:00