Discord bot for handling Ryujinx moderation tasks and such, (n)ext-(g)en rewrite of Robocop
Go to file
Mark Araujo 8e05468cb7 Log reading capabilities to Ryuko bot (#3)
* Add log reading capabilities
- User hardware specs
- Game info
- Controller configuration
- Last error snippet in log
- Warnings when using macOS or Intel iGPU
- Warning of logs not turned on

* Allowed log reading channels moved to config
This is easier for contributors to change their config file for testing

* Fixes large files not showing error snippet
- Large files are partially downloaded and show header information which
messes with log analysis, this gets stripped.
- Finding error messages function improved

* Default logs enabled shows a green checkmark

* Better feedback with log parsing message
- Bot prints `Log parsing...` and update message once log analysis done
- Added better error logging to console

* Better handling of invalid files warning
- Also fixed typo with bot message edit function

* Refactored embed generation to make more sense
- Embed is now based off a generic json assuming Unknown values at first
- Embed fields moved closer together
- Fields with newlines joined instead of manually separated
- Intel iGPU message changed to show preference for discrete GPU's

* Refactor to be simpler and easier to read.
- Hardware, ryujinx and log analysis split into separate functions
- Regex explicitly defined for each property instead of confusing map
- Added user settings reported, shows PPTC enabled or disabled

* Game notes sorted by order of severity
Notes will appear with most severe warnings first as follows:  ⚠️

* Analyses toggleable settings that appear in log
Currently these are: PPTC, audio backed, docked/handheld and vsync.
- Formatting change so these settings are more visible in bot embed

* Refactored user_settings, rewording of bot embed
- User settings reading handles missing log info for older versions
- `Switch Mode` (docked/handheld info) changed to `Console Mode`
- Missing firmware warning if firmware not installed

* Warning when shader cache collision detected

* Notes time elapsed in log file
- Error handling for no notes to log

* Show values for some user settings: audio, docked, missing services, resolution, shader cache and vsync

* Analyse user changeable settings
- Restructed embed to allow easier settings handling
- Changed embed formatting to deal with inline colums more cleanly

* Log file is now default function parameter

* Better sorting of analysis messages
- Now sorted alphabetically and by severity for consistency
- Show available RAM in low RAM warning
- Fix variable name misspelling

* Logging level changed to info

* Warn if bad dump in error message

* Add warning for no custom build support

* Warn user to post log in correct channel
- Warn about not supporting custom builds
- Warn to post in pr build if detected
- Warn about channels to post logs if detected in #general
2021-07-31 23:34:37 +02:00
robocop_ng Log reading capabilities to Ryuko bot (#3) 2021-07-31 23:34:37 +02:00
.dockerignore Add Dockerfile 2021-02-28 14:45:31 +01:00
.gitignore Get rid of data folder on git, add it to gitignore, gen files needed at 2018-12-27 14:13:28 +03:00
Dockerfile poetryify robocop 2021-08-01 00:28:20 +03:00
LICENSE Initial commit 2018-03-09 01:47:53 +03:00
poetry.lock poetryify robocop 2021-08-01 00:28:20 +03:00
pyproject.toml poetryify robocop 2021-08-01 00:28:20 +03:00
README.md poetryify robocop 2021-08-01 00:28:20 +03:00
requirements.txt poetryify robocop 2021-08-01 00:28:20 +03:00
SECURITY.md im a bitch 2019-12-19 23:30:27 +10:00

robocop-ng

Next-gen rewrite of Kurisu/Robocop bot used on ReSwitched bot with discord.py rewrite, designed to be relatively clean, consistent and un-bloated.

Code is based on https://gitlab.com/a/dpybotbase and https://github.com/916253/Kurisu-Reswitched.


How to run

  • Copy robocop_ng/config_template.py to robocop_ng/config.py, configure all necessary parts to your server.
  • Enable the Server Members privileged intent (guide here) for the bot. You don't need to give Discord your passport as Robocop-NG is not designed to run at >1 guild at once, let alone >100.
  • (obviously) Add the bot to your guild. Many resources about this online.
  • If you haven't already done this already, move the bot's role above the roles it'll need to manage, or else it won't function properly, this is especially important for verification as it doesn't work otherwise.
  • Install python3.6+.
  • Install python dependencies (pip3 install -Ur requirements.txt, you might need to put sudo -H before that). You can also install with poetry with just poetry install.
  • If you're moving from Kurisu or Robocop: Follow Tips for people moving from Kurisu/Robocop below.
  • Run robocop_ng/__init__.py (cd robocop_ng;python3 __init__.py). Alternatively, if you did poetry install, run python3 -m robocop_ng in the same directory as your config files.

To keep the bot running, you might want to use pm2 or a systemd service.


Tips for people moving from Kurisu/Robocop

If you're moving from Kurisu/Robocop, and want to preserve your data, you'll want to do the following steps:

  • Copy your data folder over.
  • Rename your data/warnsv2.json file to data/userlog.json.
  • Edit data/restrictions.json and replace role names ("Muted" etc) with role IDs (526500080879140874 etc). Make sure to have it as int, not as str (don't wrap role id with " or ').

Contributing

Contributions are welcome. If you're unsure if your PR would be merged or not, either open an issue, ask on ReSwitched off-topic pinging ave or DM ave.

You're expected to use black for code formatting before sending a PR. Simply install it with pip (pip3 install black), and run it with black ..


Credits

Robocop-NG was initially developed by @aveao and @tumGER. It is currently maintained by @aveao. Similarly, the official robocop-ng on reswitched discord guild is hosted by @aveao too.

I (ave) would like to thank the following, in no particular order:

  • ReSwitched community, for being amazing
  • ihaveamac/ihaveahax and f916253 for the original kurisu/robocop
  • misson20000 for adding in reaction removal feature and putting up with my many BS requests on PR reviews
  • linuxgemini for helping out with Yubico OTP revocation code (which is based on their work)
  • Everyone who contributed to robocop-ng in any way (reporting a bug, sending a PR, forking and hosting their own at their own guild, etc).