Skip to content

rerun command to re-execute commands from replied messages (with intact content, attachments, etc.)#251

Merged
scarletcafe merged 9 commits into
scarletcafe:masterfrom
WitherredAway:feature/rerun-command
Jan 27, 2026
Merged

rerun command to re-execute commands from replied messages (with intact content, attachments, etc.)#251
scarletcafe merged 9 commits into
scarletcafe:masterfrom
WitherredAway:feature/rerun-command

Conversation

@WitherredAway

@WitherredAway WitherredAway commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

Rationale

I was programming a command that takes attachments and I found myself having to resend attachments and copy the same contents over and over again as I made changes to the code. This became super tedious and I thought about making a command on my bot to do this but then realize it's actually really useful and I could create a PR for it

There are other really useful use-cases too, for example if you have a bunch of jsk scripts pinned in a channel like me you can easily re-run them with just the message ID without having to copy-paste (or resend any attachments). It's also really nice if you had nitro before when you sent a command but no longer have the extra characters to resend it again.

Aside from attachments it's just really nice to have a way to rerun a command, perhaps even as a different user or in a different channel, without having to copy its contents every time. It piggybacks off of the jsk exec command so the overrides and behaviors are the same.

It could also be useful for running commands with embeds (if you override a bot's message) to test stuff

Summary of changes made

  • Added the jsk rerun command to rerun a command from a message without needing to copy-paste or resend attachments/other contextual entities. Similar syntax to the jsk exec command, allows overriding and bypassing.
    • the message can be replied to when running the command or passed through the optional message argument (url, id, etc.) that MessageConverter converts
    • i don't like the method i used to see if the target message is another rerun command invocation to prevent circular reruns. but after hours of trying different things i could not find another way to get the subcommand before the ctx is invoked upon.
  • Added documentation for the command.
  • Fixed a bug in Jishaku preventing member mentions from working in the jsk override command
    • was gonna make another PR for this but the rerun command implementation depends on this to work

scroll for demo!

Checklist

  • This PR changes the jishaku module/cog codebase
    • These changes add new functionality to the module/cog
    • These changes fix an issue or bug in the module/cog
    • I have tested that these changes work on a production bot codebase
    • 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

Demonstration

1. unit tests

Screenshot 2026-01-27 235001

2. fixed long time bug preventing member mentions in the exec command (old vs new)

image

3. rerunning a command by replying without having to resend attachment

image

3. rerunning command by message id (same channel)

image

4. bypassing checks (also rerunning by channelid-messageid pair)

image

5. here i edited an old message and reran the command with the same attachments

image

@scarletcafe

Copy link
Copy Markdown
Owner

Looks well thought out and in style, thanks.

Check errors seem to be spurious error from a sphinxcontrib-trio bug @ python-trio/sphinxcontrib-trio#399 , can ignore these and see if there is a solution upstream later.

@scarletcafe scarletcafe merged commit a293581 into scarletcafe:master Jan 27, 2026
54 of 126 checks passed
@WitherredAway

Copy link
Copy Markdown
Contributor Author

yayyyy ❤️

also woah i didn't notice that issue that's great!

@WitherredAway

Copy link
Copy Markdown
Contributor Author

small typo in the documentation 😭 fixed in #252 thanks ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants