* 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
* 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>
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>
* 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
* Added co-owners to potentially DMd users
* Fetch the cached of every guild, see comments of #2664
* Ensure owners can be DM'd.
* Refactoring try block.
* Dependency update
discord.py==1.0.1
websockets<7
[style]
black==19.3b0
[Docs]
jinja==2.10.1
urllib3==1.24.2
Changes related to breaking changes from discord.py have also been made
to match
As of this commit, help formatter is back to discord.py's default
* Logging enhancements and cleanup
- Removed debug log messages every time `Config.get_conf` is used or a JSON file is read/saved. The basic configuration is now logged once with DEBUG when the bot starts up instead.
- Changed logging output format to reverse date order, include seconds, and use the logger's name instead of the module, function and line number.
- Log files are now kept in the `DATAPATH/core/logs` directory. Each time Red is restarted, a new log is created, and the old ones renamed in a rotating fashion. There can be a maximum of 9 logs in total.
- Each log file now has a smaller max size of 500KB before it will be split into multiple parts. There are also a maximum of 9 parts of each log.
- Discord.py logger now uses the same output formatter as red's loggers
- Moved logging setup code into `redbot.logging` module.
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Reformat
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Implement discussed changes
- We maintain a red.log over multiple runtimes, alongside a latest.log and previous.log for individual runtimes.
- Naming convention changed a bit. E.g. when latest.log is just one part, it will be named latest.log. When it becomes two parts, they will both be named latest-part1.log and latest-part2.log.
- Rotation direction is reversed. This means as the files end up being named in chronological order.
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Use ProactorEventLoop on Windows
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Set the actual loop instead of the policy
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Ability to run Red with token without instance
* --no-instance flag
* Reformatted cli with black
* Fix changes requested by @Tobotimus
- Use "system reboot" to be clearer
- save_default_config renamed to create_temp_config
- More documentation for the create_temp_config function
* Update create_temp_config call
* Fix up imports
* Switch RPC libs for websockets support
* Implement RPC handling for core
* Black reformat
* Fix docs for build on travis
* Modify RPC to use a Cog base class
* Refactor rpc server reference as global
* Handle cogbase unload method
* Add an init call to handle mutable base attributes
* Move RPC server reference back to the bot object
* Remove unused import
* Add tests for rpc method add/removal
* Add tests for rpc method add/removal and cog base unloading
* Add one more test
* Black reformat
* Add RPC mixin...fix MRO
* Correct internal rpc method names
* Add rpc test html file for debugging/example purposes
* Add documentation
* Add get_method_info
* Update docs with an example RPC call specifying parameter formatting
* Make rpc methods UPPER
* Black reformat
* Fix doc example
* Modify this to match new method naming convention
* Add more tests
* Extract load/unload/reload
* Add a few more commands
* Refactor load/unload signature
* Add invite URL and version info
* Black fixes
* Split the incoming cog names in reload correctly
* Reformat
* Remove meta.bot
* Add basic RPC functionality
* Add load/unload/reload rpc commands
* Reorganize without rpc_ready event
* Remove rpc ready event
* Removed bot reference from rpc module
* Close RPC server cleanly
* refactor bot
* Refactor a bit and make RPC server initialization based on a cli flag
* Fix version resolver
* standardize version getters
* Pick a new port number
Ya'll are gonna hate me.
* Initial modifications
* Add initial setup.py
* working setup py help
* Modify setup file to package stuff
* Move a bunch of shit and fix imports
* Fix or skip tests
* Must add init files for find_packages to work
* Move main to scripts folder and rename
* Add shebangs
* Copy over translation files
* WORKING PIP INSTALL
* add dependency information
* Hardcoded version for now, will need to figure out a better way to do this
* OKAY ITS FINALLY FUCKING WORKING
* Add this guy
* Fix stuff
* Change readme to rst
* Remove double sentry opt in
* Oopsie
* Fix this thing
* Aaaand fix test
* Aaaand fix test
* Fix core cog importing and default cog install path
* Adjust readme
* change instance name from optional to required
* Ayyy let's do more dependency injection