Terrance / SkPy

An unofficial Python library for interacting with the Skype HTTP API.
https://skpy.t.allofti.me
BSD 3-Clause "New" or "Revised" License
262 stars 66 forks source link

Unable to use Many Emotes in rich Text Messages #202

Open eth opened 2 years ago

eth commented 2 years ago

Account type

Live

Conversation details

Group, desktop & mobile

Steps to reproduce

Unable to use emotes such as (creditcard) or flags such as (flag:us) in a rich text message when using the sendMsg() function. Basically many emotes aren't in SkypeUtils.static["items"], so it doesn't work when calling SkypeMsg.Emote() either as that method relies on SkypeUtils.static["items"]. Rich text seems to force Skype emotes in all formats EXCEPT UniCode to not embed. Example: (flag:us) will not embed properly if rich=true, but will work if rich=false.

Result or traceback

Unable to use many emotes in rich text messages.

Sorry if there is already a known fix that I was unable to find. I looked and couldn't find anything.

Terrance commented 2 years ago

It may well be that emoticons are managed in a different way now (which may include being "compiled" into their JavaScript instead of being retrieved from an endpoint). I suppose ideally you'd be able to still send an emoticon with just the short code -- what does the markup for an incoming message with such an emoticon look like?

eth commented 2 years ago

It may well be that emoticons are managed in a different way now (which may include being "compiled" into their JavaScript instead of being retrieved from an endpoint). I suppose ideally you'd be able to still send an emoticon with just the short code -- what does the markup for an incoming message with such an emoticon look like?

In markup they're written the same as plain text (flag:us), (creditcard), etc... If I do no formatting it shows (creditcard) like this: <ss type="1f4b3_creditcard">(creditcard)</ss> and (flag:us) like this <ss type="flag_us">(flag:us)</ss>

Terrance commented 2 years ago

A cursory look at the network requests suggests Skype for Web now does a lookup for every individual emoticon(!):

e.g. https://static-asm.secure.skypeassets.com/pes/v1/emoticons/1f4b3_creditcard/views/meta.default:

{
  "id": "1f4b3_creditcard",
  "type": "emoticon",
  "shortcuts": [
    "(creditcard)",
    "(1f4b3_creditcard)"
  ],
  "visible": true,
  "useInSms": false,
  "media": {
    "default": {
      "firstFrame": 1,
      "framesCount": 1,
      "framesCountOptimized": 1,
      "fluentFramesCount": 1,
      "fps": 24
    }
  },
  "diverse": false,
  "utf": "💳",
  "description": "Credit card",
  "keywords": [
    "credit card"
  ],
  "etag": "v8"
}

I can't see any obvious endpoint that lists the available emoticons though.

As a fallback to the static list we have currently, I could make it use this lookup to try and find additional emoticons as and when needed, though it's not ideal.

eth commented 2 years ago

Whatever you think is best :_)