@@ -24,11 +24,6 @@ def cmd_die(client, msg): | |||||
yield from client.send_message(msg.channel, "But will I dream? ;-;") | yield from client.send_message(msg.channel, "But will I dream? ;-;") | ||||
yield from client.logout() | yield from client.logout() | ||||
if msg.content[5:] == "reload": | |||||
# touch file to signal reload | |||||
with open("reload", "a"): | |||||
os.utime("reload", None) | |||||
@asyncio.coroutine | @asyncio.coroutine | ||||
def cmd_quiet(client, msg): | def cmd_quiet(client, msg): | ||||
@@ -70,14 +70,14 @@ def on_message(msg): | |||||
if msg.content != "": | if msg.content != "": | ||||
history[msg.server.id + msg.author.id] = (msg.server.id, | history[msg.server.id + msg.author.id] = (msg.server.id, | ||||
time.time(), msg.content) | time.time(), msg.content) | ||||
with open('hist.json', 'w') as fp: | |||||
with open('./persist/hist.json', 'w') as fp: | |||||
json.dump(history, fp) | json.dump(history, fp) | ||||
# log user messages for markov chains, ignoring messages with certain substrings | # log user messages for markov chains, ignoring messages with certain substrings | ||||
filters = ['`', 'http://', 'https://'] | filters = ['`', 'http://', 'https://'] | ||||
if not any(x in msg.content for x in filters): | if not any(x in msg.content for x in filters): | ||||
try: | try: | ||||
with open('./markovs/' + msg.server.id + '-' + msg.author.id, | |||||
with open('./persist/markovs/' + msg.server.id + '-' + msg.author.id, | |||||
'a') as fp: | 'a') as fp: | ||||
fp.write('\n' + msg.content) | fp.write('\n' + msg.content) | ||||
except PermissionError: | except PermissionError: | ||||
@@ -123,7 +123,7 @@ def cmd_markov(client, msg): | |||||
reponse = "I can't find `{}`".format(tmp) | reponse = "I can't find `{}`".format(tmp) | ||||
if target != "": | if target != "": | ||||
mfile = "./markovs/" + target | |||||
mfile = "./persist/markovs/" + target | |||||
if os.path.isfile(mfile): | if os.path.isfile(mfile): | ||||
mc = markov.Markov(open(mfile)) | mc = markov.Markov(open(mfile)) | ||||
response = mc.generate_text(random.randint(20, 40)) | response = mc.generate_text(random.randint(20, 40)) | ||||
@@ -10,7 +10,7 @@ import os | |||||
import json | import json | ||||
# bot version | # bot version | ||||
version = "v1.2.0" | |||||
version = "v1.2.2" | |||||
# TODO: generate this on the fly and make it look acceptable | # TODO: generate this on the fly and make it look acceptable | ||||
# text shown by .help command | # text shown by .help command | ||||