diamondburned / dissent

Tiny native Discord app
https://flathub.org/apps/details/so.libdb.dissent
GNU General Public License v3.0
1.23k stars 39 forks source link

Add `Add Reaction` message action #168

Closed tfuxu closed 10 months ago

tfuxu commented 10 months ago

This adds an action item to message menu, which allows users to add reactions to messages. Currently shows gtk.EmojiChooser when clicked, in future it will probably be replaced with custom emoji selector with custom emoji support.

Issues:

Screenshots:

Screenshot from 2023-10-03 23-52-59

Screenshot from 2023-10-03 23-53-25

diamondburned commented 10 months ago

Does this only happen for the pumpkin emoji? What are its bytes? Any weird invisible characters?

tfuxu commented 10 months ago

It is very picky with what emojis it accepts, for example it works great with πŸ˜Άβ€πŸŒ«οΈ and ☁️ emojis, but it doesn't with πŸ™‚οΈ or πŸ₯„️.

Note: That U+FE0F code in every emoji rune is a variation selector, so it shouldn't make any issues with Discord API, it they are using a compliant Unicode parser.

Byte and rune data for tested emojis:

Not working:

πŸ₯„️ Spoon:

Emoji Bytes: [240 159 165 132 239 184 143]
Emoji Unicode: [U+1F944 U+FE0F]

πŸ™‚οΈ Slightly Smiling Face:

Emoji Bytes: [240 159 153 130 239 184 143]
Emoji Unicode: [U+1F642 U+FE0F]

Working:

πŸ΄β€β˜ οΈ Pirate Flag:

Emoji Bytes: [240 159 143 180 226 128 141 226 152 160 239 184 143]
Emoji Unicode: [U+1F3F4 U+200D U+2620 U+FE0F]

πŸ˜Άβ€πŸŒ«οΈ Face In Clouds:

Emoji Bytes: [240 159 152 182 226 128 141 240 159 140 171 239 184 143]
Emoji Unicode: [U+1F636 U+200D U+1F32B U+FE0F]

☁️ Cloud:

Emoji Bytes: [226 152 129 239 184 143]
Emoji Unicode: [U+2601 U+FE0F]
diamondburned commented 10 months ago

Does it work if you trim off U+FE0F anyway?

tfuxu commented 10 months ago

Trimming U+FE0F makes those emojis who weren't working to work, but breaks those who were working before πŸ™ƒοΈ

diamondburned commented 10 months ago

Perhaps check that there's only one codepoint before that belongs in the emoji block?

diamondburned commented 10 months ago

(It might be a good idea to add this to Arikawa directly)

((Also gtkcord3 has working reactions))

tfuxu commented 10 months ago

I've added a basic sanitizer to remove \ufe0f in most emojis that made issues. It covers most emojis (about ~70%), but there are some that will still don't work, or will only display in text representation.

This isn't a perfect solution, but it should be good enough before we will have a custom emoji chooser.