Merge pull request #172 from Joshix-1/custom-emoji-chec-fix

fix check for custom emojis
This commit is contained in:
trigg 2021-10-16 09:23:00 +00:00 committed by GitHub
commit e29980577c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -127,10 +127,9 @@ class TextOverlayWindow(OverlayWindow):
ret = message['surrogate']
else:
### Add Image ###
url = ("https://cdn.discordapp.com/emojis/%s.png?v=1" %
(message['emojiId']))
img = {"url": url}
self.image_list.append(img)
self.image_list.append(
f"https://cdn.discordapp.com/emojis/{message['emojiId']}.png?v=1"
)
ret = "`"
elif (message['type'] == 'inlineCode' or
message['type'] == 'codeBlock' or
@ -296,11 +295,12 @@ class TextOverlayWindow(OverlayWindow):
"""
Draw an inline image as a custom emoticon
"""
if not shape.data in self.image_list:
# print(shape.data, self.image_list, self.attachment)
if shape.data >= len(self.image_list):
logging.warning(f"{shape.data} >= {len(self.image_list)}")
return
if not 'url' in self.image_list[shape.data]:
return
key = self.image_list[shape.data]['url']
# key is the url to the image
key = self.image_list[shape.data]
if key not in self.attachment:
get_surface(self.recv_attach,
key,