|
@@ -36,13 +36,10 @@ unmatched_messages_cache = {}
|
36
|
36
|
message_delete_queue = []
|
37
|
37
|
|
38
|
38
|
def prepare_matrix_content(message):
|
39
|
|
- reg = re.match(r"^<a?:\w+:\d*>$", message.content)
|
|
39
|
+ reg = re.match(r"^<a?:\w+:(\d+)>$", message.content)
|
40
|
40
|
|
41
|
41
|
if reg:
|
42
|
|
- try:
|
43
|
|
- return emoji_urls[message.content]
|
44
|
|
- except:
|
45
|
|
- pass
|
|
42
|
+ return "https://cdn.discordapp.com/emojis/{}.png?size=32".format(reg.group(1))
|
46
|
43
|
|
47
|
44
|
attachments = "\n".join([x.url for x in message.attachments])
|
48
|
45
|
content = message.clean_content + ("\n" + attachments if attachments != "" else "")
|
|
@@ -52,7 +49,6 @@ def prepare_matrix_content(message):
|
52
|
49
|
guild = None
|
53
|
50
|
channel = None
|
54
|
51
|
emojis = {}
|
55
|
|
-emoji_urls = {}
|
56
|
52
|
|
57
|
53
|
@discord_client.event
|
58
|
54
|
async def on_ready():
|
|
@@ -65,10 +61,8 @@ async def on_ready():
|
65
|
61
|
for emoji in guild.emojis:
|
66
|
62
|
if not emoji.animated:
|
67
|
63
|
emojis[":{}:".format(emoji.name)] = "<:{}:{}>".format(emoji.name, emoji.id)
|
68
|
|
- emoji_urls["<:{}:{}>".format(emoji.name, emoji.id)] = emoji.url + "?size=32"
|
69
|
64
|
else:
|
70
|
65
|
emojis[":{}:".format(emoji.name)] = "<a:{}:{}>".format(emoji.name, emoji.id)
|
71
|
|
- emoji_urls["<a:{}:{}>".format(emoji.name, emoji.id)] = emoji.url + "?size=32"
|
72
|
66
|
|
73
|
67
|
@discord_client.event
|
74
|
68
|
async def on_message(message):
|