Compare commits
5 Commits
2107166407
...
c2d6a04c41
Author | SHA1 | Date |
---|---|---|
hedy | c2d6a04c41 | |
hedy | 0aa78488fe | |
hedy | 445f8df2ed | |
hedy | b668a361c5 | |
hedy | cd71b3f443 |
|
@ -0,0 +1,31 @@
|
|||
NICKNAME = "hedyrelay"
|
||||
SERVERS = {
|
||||
"libera": {
|
||||
# host port ssl
|
||||
"connection": ("irc.libera.chat", 6697, True),
|
||||
"chans": ["#hedy-dev"],
|
||||
"hidechan": True,
|
||||
},
|
||||
"tilde": {
|
||||
"connection": ("irc.tilde.chat", 6697, True),
|
||||
"chans": ["##hedy-dev"],
|
||||
"hidechan": True,
|
||||
},
|
||||
"foxies": {
|
||||
"connection": (
|
||||
"foxes.are.allowed.org",
|
||||
6697,
|
||||
True,
|
||||
NICKNAME,
|
||||
NICKNAME,
|
||||
"tilde.cafe",
|
||||
),
|
||||
"chans": ["#hedy-dev"],
|
||||
"hidechan": True,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
ADMINS = ["hedy"]
|
||||
|
||||
NOPING = ["hedy", "jmjl"]
|
26
main.py
26
main.py
|
@ -50,6 +50,15 @@ class Server(BaseServer):
|
|||
await self.send(build("JOIN", [c.strip("!")]))
|
||||
self.chans_actual.append(c.strip("!"))
|
||||
|
||||
if line.command == "PRIVMSG" and line.params[0] == self.nickname:
|
||||
line.params.pop(0)
|
||||
nick = line.source.split("!")[0]
|
||||
text = line.params[0]
|
||||
if text.startswith("!") and nick in ADMINS:
|
||||
args = text[1:].split(" ")
|
||||
asyncio.create_task(self.ac(self.name, args))
|
||||
return
|
||||
|
||||
if line.command == "PRIVMSG" and line.params[0] in self.chans_actual:
|
||||
chan = line.params.pop(0)
|
||||
me = False
|
||||
|
@ -71,10 +80,10 @@ class Server(BaseServer):
|
|||
and self.users[nick.lower()].account in ADMINS
|
||||
):
|
||||
if (
|
||||
text[: len(self.nickname) + 2].lower()
|
||||
== f"{self.nickname}: ".lower()
|
||||
text[: len(self.nickname) + 3].lower()
|
||||
== f"{self.nickname}: !".lower()
|
||||
):
|
||||
args = text[len(self.nickname) + 2 :].split(" ")
|
||||
args = text[len(self.nickname) + 3 :].split(" ")
|
||||
if args[0] == "connect" and len(args) > 4:
|
||||
await self.bot.add_server(
|
||||
args[1],
|
||||
|
@ -89,10 +98,7 @@ class Server(BaseServer):
|
|||
)
|
||||
)
|
||||
return
|
||||
for i in random.sample(
|
||||
list(self.bot.servers), len(self.bot.servers)
|
||||
):
|
||||
asyncio.create_task(self.bot.servers[i].ac(self.name, args))
|
||||
asyncio.create_task(self.ac(self.name, args))
|
||||
return
|
||||
|
||||
for npn in NOPING:
|
||||
|
@ -127,12 +133,9 @@ class Server(BaseServer):
|
|||
if self.disconnected or "chans" not in list(dir(self)):
|
||||
return
|
||||
if name == self.name and len(SERVERS[name]["chans"]) == 1:
|
||||
print("NAME", name, self.name)
|
||||
return
|
||||
print(self.name)
|
||||
for c in self.chans_actual:
|
||||
# if c != chan:
|
||||
print("RELAYING", c)
|
||||
s = f"\x0f\x0f\x0f\x0f<{nick[:1]}\u200c{nick[1:]}/{name}"
|
||||
if not hide:
|
||||
s += f"{chan}"
|
||||
|
@ -145,7 +148,6 @@ class Server(BaseServer):
|
|||
nargs = []
|
||||
isComb = False
|
||||
for arg in args:
|
||||
print("a", arg)
|
||||
if arg[0] == ":":
|
||||
isComb = True
|
||||
nargs.append(arg[1:])
|
||||
|
@ -156,7 +158,7 @@ class Server(BaseServer):
|
|||
nargs.append(arg)
|
||||
print("nargs:", nargs)
|
||||
await self.send(
|
||||
build(nargs[0], [self.chans_actual[0]] + nargs[1:])
|
||||
build(nargs[0], nargs[1:])
|
||||
) # TODO: loop over chans
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue