Alex Taber 6 anni fa
parent
commit
3bc12e7762
1 ha cambiato i file con 8 aggiunte e 0 eliminazioni
  1. 8
    0
      app.py

+ 8
- 0
app.py Vedi File

@@ -51,6 +51,14 @@ async def on_message(message):
51 51
 	content = prepare_matrix_content(message)
52 52
 	matrix_room.send_text("<{}> {}".format(username, content))
53 53
 
54
+@discord_client.event
55
+async def on_message_edit(before, after):
56
+	if after.channel.id != discord_channel: return
57
+	after.attachments = []
58
+	username = after.author.name[:1] + "\u200B" + after.author.name[1:] + "#" + after.author.discriminator
59
+	content = prepare_matrix_content(after)
60
+	matrix_room.send_text("<{}> {} (edited)".format(username, content))
61
+
54 62
 def send_webhook(username, avatar_url, content):
55 63
 	data = {'username': username, 'content': content}
56 64
 	if avatar_url: data['avatar_url'] = avatar_url