Use JSON for sending messages

This commit is contained in:
2022-08-14 16:45:48 +01:00
parent 555bcb4c09
commit e7b7695efd
4 changed files with 17 additions and 11 deletions

View File

@@ -1,5 +1,3 @@
import urllib.parse
from django.conf import settings
from core.lib.opensearch import client, run_main_query
@@ -194,9 +192,8 @@ def get_irc_alerts(user):
def send_irc_message(net, num, channel, msg, nick=None):
channel = urllib.parse.quote(channel, safe="")
url = f"irc/msg/{net}/{num}/{channel}"
payload = {"msg": msg}
url = f"irc/msg/{net}/{num}"
payload = {"msg": msg, "channel": channel}
if nick:
payload["nick"] = nick
messaged = threshold_request(url, payload, method="PUT")