move parameter count check
This commit is contained in:
parent
1a7b63055b
commit
865f9b8b46
13
tracer.py
13
tracer.py
|
@ -68,8 +68,7 @@ populate()
|
|||
def generate(rule):
|
||||
populate()
|
||||
if rule in DB:
|
||||
g = random.choice(DB[rule])
|
||||
return grammar(load_rules(g)).flatten("#origin#")
|
||||
return grammar(load_rules(random.choice(DB[rule]))).flatten("#origin#")
|
||||
|
||||
|
||||
def listify(col):
|
||||
|
@ -103,8 +102,6 @@ def fuse(argv):
|
|||
|
||||
def think(line):
|
||||
words = line.params[1].split(" ")
|
||||
|
||||
if len(words) > 0:
|
||||
if words[0] == "!!list":
|
||||
return " ".join(DB)
|
||||
elif words[0] == "!!source":
|
||||
|
@ -114,14 +111,11 @@ def think(line):
|
|||
elif words[0] == "!!fuse":
|
||||
if "|" in words:
|
||||
w = words.index("|")
|
||||
print(words[1:w])
|
||||
res = fuse(words[1:w])
|
||||
if res:
|
||||
return " ".join(words[w + 1 :]) + " " + res
|
||||
else:
|
||||
print(words[1:])
|
||||
res = fuse(words[1:])
|
||||
print(res)
|
||||
if res:
|
||||
return res
|
||||
elif words[0].startswith("!!"):
|
||||
|
@ -151,6 +145,7 @@ class Server(BaseServer):
|
|||
line.command == "PRIVMSG"
|
||||
and self.has_channel(line.params[0])
|
||||
and self.has_user(line.hostmask.nickname)
|
||||
and len(line.params[1].split(" ")) > 0
|
||||
and not line.hostmask is None
|
||||
and not self.casefold(line.hostmask.nickname) == self.nickname_lower
|
||||
and not ("batch" in line.tags and line.tags["batch"] == "1")
|
||||
|
@ -172,8 +167,6 @@ class Bot(BaseBot):
|
|||
|
||||
|
||||
async def main():
|
||||
bot = Bot()
|
||||
|
||||
params = ConnectionParams(
|
||||
config["nick"],
|
||||
host=config["server"],
|
||||
|
@ -181,7 +174,7 @@ async def main():
|
|||
tls=config.getboolean("tls"),
|
||||
sasl=SASLUserPass(account["username"], account["password"]),
|
||||
)
|
||||
|
||||
bot = Bot()
|
||||
await bot.add_server("tilde", params)
|
||||
await bot.run()
|
||||
|
||||
|
|
Loading…
Reference in New Issue