modular-bot-framework-for-t.../modules/irc-bridge/index.py

11 lines
441 B
Python

if self.MESSAGE["chat"]["id"] == -1001570221452:
l = min( len(self.MESSAGE["text"]), 300 )
new_msg = "{} {}: {}".format(self.MESSAGE.from_user.first_name,\
self.MESSAGE.from_user.last_name,\
self.MESSAGE.text.replace("\n", " | ")[:l])
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.sendto(f"PRIVMSG #io23-bridge :{new_msg}\n".encode("utf-8"), ("127.0.0.1", 5001))
del s