sinus-x / discord-wormhole

Connect multiple Discord guilds with wormhole
https://sinus-x.github.io/discord-wormhole/
GNU General Public License v3.0
16 stars 8 forks source link

Feature: Regex edit #62

Open sinus-x opened 4 years ago

sinus-x commented 4 years ago

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

Apoorve73 commented 4 years ago

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

Apoorve73 commented 4 years ago

Please specify, which file needs change

sinus-x commented 4 years ago

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:

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