Skip to content
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.

Feature: Regex edit #62

Open
sinus-x opened this issue Oct 2, 2020 · 3 comments
Open

Feature: Regex edit #62

sinus-x opened this issue Oct 2, 2020 · 3 comments
Labels
enhancement New feature or request Hacktoberfest digitalocean's Hacktoberfest

Comments

@sinus-x
Copy link
Owner

sinus-x commented Oct 2, 2020

Discord allows editing of last message via s/old/new syntax. We can try to replicate this with +s old text/new text.

@sinus-x sinus-x added enhancement New feature or request Hacktoberfest digitalocean's Hacktoberfest labels Oct 2, 2020
@sinus-x sinus-x changed the title Feature: Regex replace Feature: Regex edit Oct 2, 2020
@Apoorve73
Copy link

Aha! Regex can't skip my eyes! I would love to work on it.

@Apoorve73
Copy link

Please specify, which file needs change

@sinus-x
Copy link
Owner Author

sinus-x commented Oct 2, 2020

Hi!
I'm not sure how you're familiar with discord.py, I'll assume that you know or can quickly learm the basics. You can try to set up this project in order to learn what functionality this issue targets.

There is a function in cogs/wormhole.py called edit. It currently replaces whole content of the sent message. We'd like to have another function similar to it, but smarter -- it will only replace substrings matching the input regex.

Example situations:

  • User sends a message with content This is original message. Then they change their mind and send another one: +s original changed. This will chane their first one to This is changed message.
  • User sends a message with content a24 b86 c78. Then they send another: +s [a-z][0-9] X, which will change the original to X4 X6 X8.

The logic itself is already done in edit function, this adds some additional processing before the changed message is duplicated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request Hacktoberfest digitalocean's Hacktoberfest
Projects
None yet
Development

No branches or pull requests

2 participants