aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2022-11-19 03:28:08 +0000
committerubq323 <ubq323@ubq323.website>2022-11-19 03:28:08 +0000
commit0311fd5c97eefb155c32ea8e88e94e115aaedc90 (patch)
treeb3a13e04e42fcf5a8380808cd4f5a2710ba97b69
parentd3bc923ff1b040a86b6df951db25518a235dbc18 (diff)
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.
-rw-r--r--apioforum/webhooks.py9
1 files 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):