mirror of
https://github.com/MrDetonia/Maki.git
synced 2024-11-21 19:44:14 -05:00
v1.2.2, move persistent storage into persist/ subdir, in preparation for docker
This commit is contained in:
parent
e4c5eb6c2a
commit
b0b64a835e
@ -24,11 +24,6 @@ def cmd_die(client, msg):
|
||||
yield from client.send_message(msg.channel, "But will I dream? ;-;")
|
||||
yield from client.logout()
|
||||
|
||||
if msg.content[5:] == "reload":
|
||||
# touch file to signal reload
|
||||
with open("reload", "a"):
|
||||
os.utime("reload", None)
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def cmd_quiet(client, msg):
|
||||
|
4
bot.py
4
bot.py
@ -70,14 +70,14 @@ def on_message(msg):
|
||||
if msg.content != "":
|
||||
history[msg.server.id + msg.author.id] = (msg.server.id,
|
||||
time.time(), msg.content)
|
||||
with open('hist.json', 'w') as fp:
|
||||
with open('./persist/hist.json', 'w') as fp:
|
||||
json.dump(history, fp)
|
||||
|
||||
# log user messages for markov chains, ignoring messages with certain substrings
|
||||
filters = ['`', 'http://', 'https://']
|
||||
if not any(x in msg.content for x in filters):
|
||||
try:
|
||||
with open('./markovs/' + msg.server.id + '-' + msg.author.id,
|
||||
with open('./persist/markovs/' + msg.server.id + '-' + msg.author.id,
|
||||
'a') as fp:
|
||||
fp.write('\n' + msg.content)
|
||||
except PermissionError:
|
||||
|
2
commands.py
Executable file → Normal file
2
commands.py
Executable file → Normal file
@ -123,7 +123,7 @@ def cmd_markov(client, msg):
|
||||
reponse = "I can't find `{}`".format(tmp)
|
||||
|
||||
if target != "":
|
||||
mfile = "./markovs/" + target
|
||||
mfile = "./persist/markovs/" + target
|
||||
if os.path.isfile(mfile):
|
||||
mc = markov.Markov(open(mfile))
|
||||
response = mc.generate_text(random.randint(20, 40))
|
||||
|
2
common.py
Executable file → Normal file
2
common.py
Executable file → Normal file
@ -10,7 +10,7 @@ import os
|
||||
import json
|
||||
|
||||
# bot version
|
||||
version = "v1.2.0"
|
||||
version = "v1.2.2"
|
||||
|
||||
# TODO: generate this on the fly and make it look acceptable
|
||||
# text shown by .help command
|
||||
|
0
helpers.py
Executable file → Normal file
0
helpers.py
Executable file → Normal file
Loading…
Reference in New Issue
Block a user