Embed attachment links into minecraft chat. (broken for now)

This is broken by design because the bridge's message masquerading
deletes the original image and this the link 404s by the time it is
posted in chat. I will need to figure out a workaround before merging
this.
feature/embed-uploads
Tristan Gosselin-Hane 7 years ago
parent 8db6873f48
commit 6196d7e8b3
No known key found for this signature in database
GPG Key ID: D2282BE1CF7B78DA
  1. 10
      webhook-bridge.py

@ -627,12 +627,20 @@ def main():
message.clean_content.encode('utf-8').decode('ascii', 'replace')).strip() message.clean_content.encode('utf-8').decode('ascii', 'replace')).strip()
message_to_discord = escape_markdown(message.clean_content) message_to_discord = escape_markdown(message.clean_content)
if len(message.attachments) > 0:
for attach in message.attachments:
message_to_send = "{} {}".format(message_to_send, attach.url)
message_to_discord = "{} {}".format(message_to_discord, attach.url)
total_len = padding + len(message_to_send) total_len = padding + len(message_to_send)
if total_len > 256: if total_len > 256:
message_to_send = message_to_send[:(256 - padding)] message_to_send = message_to_send[:(256 - padding)]
message_to_discord = message_to_discord[:(256 - padding)] message_to_discord = message_to_discord[:(256 - padding)]
elif len(message_to_send) <= 0: elif len(message_to_send) <= 0:
return if len(message.attachments) > 0:
pass
else:
return
session = database_session.get_session() session = database_session.get_session()
channels = session.query(DiscordChannel).all() channels = session.query(DiscordChannel).all()

Loading…
Cancel
Save