From 0311fd5c97eefb155c32ea8e88e94e115aaedc90 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sat, 19 Nov 2022 03:28:08 +0000 Subject: support sending to more than one apionet channel now that apiobot supports multiple channels, apioforum can too. we use the 'url' field in the webhooks table to determine the path to the socket to send things to. --- apioforum/webhooks.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/apioforum/webhooks.py b/apioforum/webhooks.py index 7740c87..f7387be 100644 --- a/apioforum/webhooks.py +++ b/apioforum/webhooks.py @@ -164,18 +164,13 @@ class DiscordWebhook(WebhookType): @webhook_type("apionet") class ApionetWebhook(WebhookType): - # this is generally quite awful - - sockpath = "/srv/apiobot/bees.sock" - #sockpath = "/home/rebecca/programming/apiobot/bees.sock" MAXMSGLEN = 420 - # doesn't use url or anything + # using 'url' as path of socket to send to. def send(self,payload): - # this is possibly terrible import socket s = socket.socket(socket.AF_UNIX,socket.SOCK_DGRAM) - s.sendto(payload.encode("utf-8"),self.sockpath) + s.sendto(payload.encode("utf-8"),self.url) s.close() def append_url(self,rest,url): -- cgit v1.2.3