|
@@ -1,17 +1,18 @@
|
1
|
|
-import requests
|
|
1
|
+import socket
|
2
|
2
|
|
3
|
3
|
from .service import Service
|
4
|
4
|
|
5
|
5
|
|
6
|
6
|
class IrcCat(Service):
|
7
|
|
- def __init__(self, url, channel):
|
|
7
|
+ def __init__(self, host, port, channel):
|
8
|
8
|
super().__init__("irccat")
|
9
|
|
- self._url = url
|
|
9
|
+ self._host = host
|
|
10
|
+ self._port = port
|
10
|
11
|
self._channel = channel
|
11
|
12
|
|
12
|
13
|
def announce(self, message):
|
|
14
|
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
15
|
+ s.connect((self._host, self._port))
|
13
|
16
|
for line in message.split("\n"):
|
14
|
|
- requests.post(
|
15
|
|
- self._url,
|
16
|
|
- f"{self._channel}, {line}",
|
17
|
|
- )
|
|
17
|
+ s.sendall(bf"{self._channel} {line}\n")
|
|
18
|
+ s.close()
|