jishaku
jishaku copied to clipboard
Add support to `jsk sync` for clearing application commands
Usage remains largely the same, but prefixing a target with -
will switch to upserting an empty payload
-
alone or -$
can both be used to clear global commands
-.
, -*
, or -{guild_id}
all simply clear the commands for the expected target
Rationale
Currently, if I want to clear my commands (my use case, btw, is clearing from the beta bot so they don't interfere with the public bot), I have to manually type bot.tree.clear_commands(guild=guild/None)
, so this just makes it easier to wipe commands from a locale.
On a similar note, I wanted to also ask - thoughts on a way to replicate
CommandTree.copy_global_to(guild=guild)
await CommandTree.sync(guild=guild)
with jsk sync
? I was thinking something like +{target}
could handle that for guild ids/*
/.
, and be ignored for $
?
Summary of changes made
I created a second set that holds the guilds to be cleared, and changed the cleaned guilds list to be a tuple of [id, clear?], then loop through and set payload
to an empty list when clear is True
Checklist
- [x] This PR changes the jishaku module/cog codebase
- [x] These changes add new functionality to the module/cog
- [ ] These changes fix an issue or bug in the module/cog
- [x] I have tested that these changes work on a production bot codebase
- [x] I have tested these changes against the CI/CD test suite
- [ ] I have updated the documentation to reflect these changes
- [ ] This PR changes the CI/CD test suite
- [ ] I have tested my suite changes are well-formed (all tests can be discovered)
- [ ] These changes adjust existing test cases
- [ ] These changes add new test cases
- [ ] This PR changes prose (such as the documentation, README or other Markdown/RST documents)
- [ ] I have proofread my changes for grammar and spelling issues
- [ ] I have tested that any changes regarding Markdown/RST syntax result in a well formed document