fix types from configparser
This commit is contained in:
parent
b140c7e539
commit
af04945187
13
tracer.py
13
tracer.py
|
@ -15,6 +15,9 @@ import random
|
||||||
import traceback
|
import traceback
|
||||||
import tracery
|
import tracery
|
||||||
|
|
||||||
|
HELPTEXT = "helo i'm a tracery bot that makes cool things from tracery grammars in your ~/.tracery. see http://tracery.io for more info"
|
||||||
|
REPOLINK = "https://tildegit.org/ben/tracer"
|
||||||
|
|
||||||
DB = {}
|
DB = {}
|
||||||
config = configparser.ConfigParser(
|
config = configparser.ConfigParser(
|
||||||
converters={"list": lambda x: [i.strip() for i in x.split(",")]}
|
converters={"list": lambda x: [i.strip() for i in x.split(",")]}
|
||||||
|
@ -48,7 +51,7 @@ def load_rules(path):
|
||||||
|
|
||||||
def populate():
|
def populate():
|
||||||
global DB
|
global DB
|
||||||
# DB = {}
|
DB = {}
|
||||||
for p in glob.glob("/home/*/.tracery/*"):
|
for p in glob.glob("/home/*/.tracery/*"):
|
||||||
name, ext = os.path.splitext(p)
|
name, ext = os.path.splitext(p)
|
||||||
name = os.path.basename(name)
|
name = os.path.basename(name)
|
||||||
|
@ -122,9 +125,9 @@ def think(line):
|
||||||
if res:
|
if res:
|
||||||
return res
|
return res
|
||||||
elif words[0] == "!!source":
|
elif words[0] == "!!source":
|
||||||
return "https://tildegit.org/ben/tracer"
|
return REPOLINK
|
||||||
elif words[0] == "!botlist" or words[0] == "!!help":
|
elif words[0] == "!botlist" or words[0] == "!!help":
|
||||||
return "helo i'm a tracery bot that makes cool things from tracery grammars in your ~/.tracery. see http://tracery.io for more info"
|
return HELPTEXT
|
||||||
elif words[0][0:2] == "!!":
|
elif words[0][0:2] == "!!":
|
||||||
print(words)
|
print(words)
|
||||||
res = generate(words[0][2:])
|
res = generate(words[0][2:])
|
||||||
|
@ -182,8 +185,8 @@ async def main():
|
||||||
params = ConnectionParams(
|
params = ConnectionParams(
|
||||||
bot["nick"],
|
bot["nick"],
|
||||||
host=bot["server"],
|
host=bot["server"],
|
||||||
port=int(bot["port"]),
|
port=bot.getint("port"),
|
||||||
tls=bool(bot["tls"]),
|
tls=bot.getboolean("tls"),
|
||||||
sasl=SASLUserPass(account["username"], account["password"]),
|
sasl=SASLUserPass(account["username"], account["password"]),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue