python-discord/sir-lancebot

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

TizzySaurus opened this issue · 11 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?

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

AFAIK this already exists?

AFAIK this already exists?

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

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

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?

Yea, we should replace existing implementations of this.

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

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

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

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

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

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.

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