sir-lancebot icon indicating copy to clipboard operation
sir-lancebot copied to clipboard

Use replied message as argument to `.randomcase` when text isn't provided.

Open TizzySaurus opened this issue 3 years ago • 9 comments

Description

Allow .randomcase to work on replied messages whenever no text argument is provided.

Reasoning

Pretty self-explanatory; means you can just reply to a message instead of having to manually copy-paste the content as the command argument.

Proposed Implementation

A simple if statement checking whether a text argument was provided, and if not whether a message was replied to.

Would you like to implement this yourself?

  • [x] I'd like to implement this feature myself
  • [ ] Anyone can implement this feature

TizzySaurus avatar Jul 12 '22 21:07 TizzySaurus

AFAIK this already exists?

ChrisLovering avatar Jul 12 '22 21:07 ChrisLovering

AFAIK this already exists?

Sorry, I said the wrong command. I meant .randomcase 😰

TizzySaurus avatar Jul 12 '22 21:07 TizzySaurus

Ah I see now.

Since this in a few places now, I think we should make a custom converter that has the behavior, rather than duplicating code

ChrisLovering avatar Jul 12 '22 21:07 ChrisLovering

Since this in a few places now, I think we should make a custom converter that has the behavior, rather than duplicating code

Yeah, I'd agree with that. Should I replace the existing implementations too (e.g. .uwu)?

What would be a good converter name? Perhaps something along the lines of TextOrReply?

TizzySaurus avatar Jul 12 '22 21:07 TizzySaurus

Yea, we should replace existing implementations of this.

maybe TextOrReplyCleaned, to indicate we run clean_content over it too, but that sounds good.

ChrisLovering avatar Jul 12 '22 21:07 ChrisLovering

Would this be better in bot-core so that we can use it in bot too? (Does bot even need this?)

TizzySaurus avatar Jul 12 '22 21:07 TizzySaurus

Yea, that could work. We should start adding converters to bot core more often.

ChrisLovering avatar Jul 12 '22 21:07 ChrisLovering

NB: This is currently stalled by python-discord/bot-core#100

TizzySaurus avatar Jul 14 '22 19:07 TizzySaurus

python-discord/bot-core#101 has just been merged so I'll be working on this soon:tm:

TizzySaurus avatar Jul 23 '22 13:07 TizzySaurus

It seems I forgot about this issue, but it's now back on my radar and will hopefully have a PR ready over the next week or two.

TizzySaurus avatar Oct 22 '22 10:10 TizzySaurus

Managed to get it done in my spare time this morning -- #1129.

TizzySaurus avatar Oct 23 '22 09:10 TizzySaurus