UniversityOfHelsinkiCS / toska-silta

Minttuinen discord silta
0 stars 4 forks source link

Fix emojis #13

Closed Rochet2 closed 2 years ago

Rochet2 commented 2 years ago

Partially fixes https://github.com/UniversityOfHelsinkiCS/toska-silta/issues/2 Fixes:

Also takes into account that animated gifs have a in front of them: <a:fishsteer:885601242930372668>

The regex searches for a tag <a:name:000000> where a is optional, the name can be anything but it cannot contain : character, and at the end before the closing tag there must be one or more numbers. The regex uses g flag to replace all instances of the found pattern from the message. The instances are replaced with a subgroup that is :name: captured from the searched pattern.