Added someone ugly way of "sanitizing" messages sent through minecraft

chat
feature/embed-uploads
Tristan Gosselin-Hane 7 years ago
parent ac940d02e5
commit bf48692129
  1. 9
      webhook-bridge.py

@ -264,10 +264,10 @@ def main():
message = regexp_match.group(2) message = regexp_match.group(2)
player_uuid = mc_username_to_uuid(username) player_uuid = mc_username_to_uuid(username)
logging.info("Username: {} Message: {}".format(username, message)) logging.info("Username: {} Message: {}".format(username, message))
#webhook_payload = {'username': minecraft_username, 'avatar_url': "https://visage.surgeplay.com/face/160/{}".format(minecraft_uuid), # Ghetto fix for sanitizing chat messages until Issue #4 is resolved.
# 'content': '{}'.format(message)} message = message.replace("@", "@\N{zero width space}")
webhook_payload = {'username': username, 'avatar_url': "https://visage.surgeplay.com/face/160/{}".format(player_uuid), webhook_payload = {'username': username, 'avatar_url': "https://visage.surgeplay.com/face/160/{}".format(player_uuid),
'embeds': [{'title': '{}'.format(message)}]} 'content': '{}'.format(message)}
post = requests.post(WEBHOOK_URL,json=webhook_payload) post = requests.post(WEBHOOK_URL,json=webhook_payload)
def handle_health_update(health_update_packet): def handle_health_update(health_update_packet):
@ -431,8 +431,7 @@ def main():
return return
webhook_payload = {'username': minecraft_username, 'avatar_url': "https://visage.surgeplay.com/face/160/{}".format(minecraft_uuid), webhook_payload = {'username': minecraft_username, 'avatar_url': "https://visage.surgeplay.com/face/160/{}".format(minecraft_uuid),
'embeds': [{'title': '{}'.format(message_to_send)}]} 'content': '{}'.format(message_to_discord)}
#'content': '{}'.format(message_to_discord)
post = requests.post(WEBHOOK_URL,json=webhook_payload) post = requests.post(WEBHOOK_URL,json=webhook_payload)
packet = serverbound.play.ChatPacket() packet = serverbound.play.ChatPacket()

Loading…
Cancel
Save