Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added four new helpers for discord2telegram processing #270

Merged
merged 1 commit into from May 4, 2023

Conversation

Jers1k
Copy link
Contributor

@Jers1k Jers1k commented May 4, 2023

Added 4 new helpers to clean up output when using discord2telegram processing

  1. Added customEmojiFilter helper function that will filter out custom emojis (uploaded to discord server by user). Why: otherwise they're displayed in raw html format, since there're no emojis to translate them to;
  2. Added replaceAtWithHash helper function that will filter replace '@' with '#'. Why: '@' is used as an inner reference symbol in Telegram which leads to posts transferred from Discord (if they had any @-mentions in it) to have a lot of unexpected links leading to random channels;
  3. Added replaceExcessiveSpaces helper function that will filter out excessive (2 or more) whitespaces from the output. Why: after removing custom emojis html output frequently ends up with excessive spaces;
  4. Added removeNewlineSpaces helper function that will filter out whitespaces placed at the beginning of the newline. Why: after removing custom emojis that were placed at the beginning of the newline html output ends up with an unneeded space;

01. Added customEmojiFilter helper function that will filter out custom emojis (uploaded to discord server by user). Why: otherwise they're displayed in raw html format, since there're no emojis to translate them to;
02. Added replaceAtWithHash helper function that will filter replace '@' with '#'. Why: '@' is used as an inner reference symbol in Telegram which leads to posts transferred from Discord (if they had any @-mentions in it) to have a lot of unexpected links leading to random channels;
03. Added replaceExcessiveSpaces helper function that will filter out excessive (2 or more) whitespaces from the output. Why: after removing custom emojis html output frequently ends up with excessive spaces;
04. Added removeNewlineSpaces helper function that will filter out whitespaces placed at the beginning of the newline. Why: after removing custom emojis that were placed at the beginning of the newline html output ends up with an unneeded space;
@Lulalaby
Copy link
Collaborator

Lulalaby commented May 4, 2023

Looks good so far. Thanks for the contribution

@Lulalaby Lulalaby merged commit a9f006b into TediCross:master May 4, 2023
@Fabian42
Copy link
Collaborator

Fabian42 commented May 4, 2023

No, this does not look good at all.

  1. means that custom emoji become completely invisible now, if I understand it correctly. Seeing their code is actually useful, because I can just copy that, paste it into my own messages and it appears correctly on Discord. That even works in other Discord groups, because of an oversight in Discord's permissions for bots. Also, of course often these emoji are simply relevant for people's messages and shouldn't just be omitted. Various solutions could be done, like attachments, but definitely don't just delete them.

  2. makes user mentions appear like chat mentions. I don't see an issue with having links there, nobody forces me to click them. And if the person does happen to have the same username on Telegram, it makes it a little more convenient to message them there. And people use # characters for other things, this would make it indistinguishable.

  3. could break lots of things, like code, ASCII art, pasted logs, paragraph separations, etc.

  4. breaks spaces at the beginning, obviously.

Generally, the messages should stay as similar as possible on both platforms. Having lots of random changes everywhere makes it very confusing and error-prone.

@Jers1k
Copy link
Contributor Author

Jers1k commented May 4, 2023

@Fabian42 I agree that it might seem too radical for some users. For my personal use case this is perfect though.

Anyway, I definitely agree that we might not want to force this on everyone. I think allowing users to enable/disable this behaviour should be enough to address your concerns.

What do you think?

@Fabian42
Copy link
Collaborator

Fabian42 commented May 4, 2023

Maybe three options for #1: current, deleted or some placeholder. Since I don't see the point of #2, I won't suggest options, but one of them should definitely be how it is now. #3 and #4 shouldn't be needed at all, just let #1 check if there's (non-newline) whitespace before and after it and then remove one of them.

Lulalaby added a commit that referenced this pull request May 4, 2023
the new settings default to false
@Lulalaby
Copy link
Collaborator

Lulalaby commented May 4, 2023

Sorry for that, my brain was a bit broke

Moved it over to https://github.com/TediCross/TediCross/tree/dev and reset master to the old state

Lulalaby added a commit that referenced this pull request May 15, 2023
the new settings default to false
Lulalaby added a commit that referenced this pull request May 15, 2023
the new settings default to false
Lulalaby added a commit that referenced this pull request May 17, 2023
the new settings default to false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants