enable ac()

This commit is contained in:
Hedy Li 2021-03-29 21:03:29 +08:00
parent 55719e289b
commit 6080597580
2 changed files with 7 additions and 4 deletions

View File

@ -14,6 +14,6 @@ SERVERS = {
NICKNAME = 'hbot'
ADMINS=['hedy']
ADMINS=['hedy', 'hedyli']
NOPING=[]
NOPING=[]

View File

@ -76,6 +76,7 @@ class Server(BaseServer):
if line.command == "INVITE":
await self.send(build("JOIN",[line.params[1]]))
# TODO: add to relay chans if needed
self.chans.append(line.params[1])
async def line_send(self, line: Line):
@ -91,11 +92,12 @@ class Server(BaseServer):
await self.send(build("PRIVMSG",[c,f"\x0f\x0f\x0f\x0f<{nick[:1]}\u200c{nick[1:]}@{name}{chan}> {msg}"]))
async def ac(self,name,args):
if self.disconnected or "chan" not in list(dir(self)):
if self.disconnected or "chans" not in list(dir(self)):
return
nargs = []
isComb = False
for arg in args:
print("a", arg)
if arg[0] == ':':
isComb = True
nargs.append(arg[1:])
@ -104,7 +106,8 @@ class Server(BaseServer):
nargs[-1] += ' '+arg
else:
nargs.append(arg)
await self.send(build(nargs[0],[self.chan]+nargs[1:]))
print("nargs:", nargs)
await self.send(build(nargs[0],[self.chans[0]]+nargs[1:])) # TODO: loop over chans
class Bot(BaseBot):
def create_server(self, name: str):