* Removes `MAX_BALANCE` from bank, user `bank.get_max_balance()` now
`[p]bankset maxbal` can be used to set the maximum bank balance
Signed-off-by: Guy <guyreis96@gmail.com>
* Pushed the Fix for new issue introduced by #2926
Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com>
* Changelogs
Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com>
* Rename changelog to a misc
Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com>
* Address Flame's review
Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com>
* Correct an outdated reference in the docs
Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com>
* Reword docstring for the RuntimeError
Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com>
* style(permissions): clear out usage of commands with <who_or_what>
* chore(changelog): add towncrier entry
* style(permissions): fix black formatting
* 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*
Also made the Makefile work slightly nicer with other tools, e.g. IDE run configurations, by allowing the python executable to be set as an env var.
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* [Docs] Update linux install docs, redo venv docs
Some of our pre-req installation docs needed updating on Windows - this adds new sections for Fedora Linux and Debian/Raspbian Buster, and also removes some unnecessary pre-requirements from other distributions. These have all been tested on fresh VPSes, installing Red both in venvs and with --user, and they all seem to work.
Also, apparently the venv docs were too scary before. These changes try to make it clear that it's easier to use than users may think.
This also includes a little note to stop users from accidentally installing Python with pyenv after installing pre-requirements on Ubuntu.
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Add changelog entries
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Update officially supported platforms in README.md
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Combine sections and add openSUSE
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Include example of using `--user` flag
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Use `py -3.7` on Windows outside of venv
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Reorganise changelog entries
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Add command to remove dead members from bank
* Add a global check
* Added a FIXME so `bank_local_clean` is updated once bulk-update is implemented
Added a brief warning to warn devs not to use the `_get_base_group` as it can mess up their config files
Removed a redundant existence check
* Updated commit to reflect changes requested in review
* Updated commit to reflect changes requested in review
* 🤦
* Return command to run with user id so we don't worry about safeguarding the command agaisn't invalid formats
* Braaaainnn
Removed aliases that used old naming scheme
* TL:DR Added global bank support, and rework permissions
Renamed `bank_local_clean` to `bank_prune`
Added support for global banks to `bank_prune`
`bank_prune` will now raise `BankPruneError` if trying to prune a local bank and `guild` is not supplied
Renamed `cleanup` subgroup to `prune`
`prune` subgroup will have 3 commands:
`user` : Deletes the bank account for the specified member : Accepts `Union[discord.Member, discord.User, int]`
`global` : Prune global bank accounts for all users who no longer share a server with the bot
`local` : Prune local bank accounts for all users who are no longer in the guild
Changed check for `prune` subgroup to be `@check_global_setting_admin()`
[p]bank prune local : Can be run by Guild owners only
[p]bank prune global : Can be run by Bot Owner only
[p]bank prune user : Can be run by Admins, Guild owners and Bot Owner
* Yikes ... Updated kwarg name
* Fixed unexpected unindent: docstring of redbot.core.bank.bank_prune:14:Field list ends without a blank line
* ...
* 3rd time lucky?
* 4th time lucky?
* Fix Docstring
* Initial commit to address review by Flame
* Updated code to reflect Flame's comments
* Skip pruning of unavailable guilds
* Fixed typo in string
* *sigh* black is the bane of my existence
* addressed Flames commends
Fixed [p]bank prune user, When run via DM it will now return an error message to the user (Thanks jack1142)
* Time to get some sleep
* 'DM' > 'DMs' in string
* Add towncrier entries
Signed-off-by: Draper <guyreis96@gmail.com>
* Update to reflect Flame's review
Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com>
* 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
* Removes `MAX_BALANCE` from bank, user `bank.get_max_balance()` now
`[p]bankset maxbal` can be used to set the maximum bank balance
Signed-off-by: Guy <guyreis96@gmail.com>
* Removes `MAX_BALANCE` from bank, user `bank.get_max_balance()` now
`[p]bankset maxbal` can be used to set the maximum bank balance
Signed-off-by: Guy <guyreis96@gmail.com>
* Removes `MAX_BALANCE` from bank, user `bank.get_max_balance()` now
`[p]bankset maxbal` can be used to set the maximum bank balance
Signed-off-by: Guy <guyreis96@gmail.com>
* Rename method 🤦
Signed-off-by: Guy <guyreis96@gmail.com>
* Updated this to be aware of #2925
Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com>
* Addressed Flames review + Fixed 1 bug in errors.py + `[p]leaderboard` and `[p]bank balance` will set the users balance to max balance if the bank maxbal is lower than the previous user balance
Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com>
* Missed this clarification
Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com>
* address Flames review
Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com>
- ``redbot-setup delete`` no longer errors about "unexpected keyword argument" (fix#2955)
- ``redbot-setup delete`` no longer prompts about backup when user passes ``--no-prompt`` option (fix#2956)
- ``--[no-]backup``, ``--[no-]drop-db`` and ``--[no-]remove-datapath`` in ``redbot-setup delete`` command are now on/off flags. ``--no-prompt`` was changed to flag too, but it doesn't have ``--prompt`` equivalent as there's no much point in having it
- ``redbot-setup`` now uses `click.confirm` for confirmation prompts and thy now also have default values for user convenience
* fix(mod): past names are now properly recorded in `on_user_update` event
* chore(changelog): add towncrier entry
* chore(changelog): specify what commands were affected
* Fixed `[p]local start`
Playlist picker auto selects if theres just 1 playlist found
`[p]queue cleanself` added
Signed-off-by: Guy <guyreis96@gmail.com>
* Black.... you are supposed to trigger before commits
Signed-off-by: Guy <guyreis96@gmail.com>
* Added `BalanceTooHigh` to the docstrings of `bank.transfer_credits()`
Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com>
* Bring this in line with #2926 to reduce conflicts,`is_global()` already is called inside `get_currency_name` and as such it does not need to be called outside
Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com>
* [Economy] House always wins in slots
- Expected payout is negative
- No flat increase payouts, all payouts are multiplicative
* actually do math properly
* UX + Changelog
* How the hell did I mess that up?!
* 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>
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.
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>
* 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