Delete old webhook message on edit

This commit is contained in:
git-bruh 2020-12-02 20:42:26 +05:30
parent 2e6b979ffa
commit d4551a5c61
No known key found for this signature in database
GPG key ID: E1475C50075ADCE6

18
main.py
View file

@ -239,16 +239,14 @@ class Callbacks(object):
return
# https://github.com/Rapptz/discord.py/issues/6058
# content_dict = event.source.get("content")
# try:
# if content_dict["m.relates_to"]["rel_type"] == "m.replace":
# edited_event = content_dict["m.relates_to"]["event_id"]
# edited_content = content_dict["m.new_content"]["body"]
# webhook_message = message_cache[edited_event]
# await something_edit_webhook(webhook_message, edited_content)
# return
# except KeyError:
# pass
content_dict = event.source.get("content")
try:
if content_dict["m.relates_to"]["rel_type"] == "m.replace":
edited_event = content_dict["m.relates_to"]["event_id"]
webhook_message = message_store[edited_event]
await webhook_message.delete()
except KeyError:
pass
message = event.body