mirror of
https://github.com/MrDetonia/Maki.git
synced 2024-11-13 00:26:53 -05:00
Fixed KeyError when invalid username used with .markov, v0.10.6
This commit is contained in:
parent
98b2076730
commit
20c838df9e
4
bot.py
4
bot.py
@ -25,7 +25,7 @@ from secret import email,pwd
|
||||
name = "Maki"
|
||||
|
||||
# bot version
|
||||
version = "v0.10.5"
|
||||
version = "v0.10.6"
|
||||
|
||||
# text shown by .help command
|
||||
helptext = """I am a bot written in Python by MrDetonia
|
||||
@ -267,7 +267,7 @@ def on_message(message):
|
||||
elif message.content.startswith('.markov'):
|
||||
# generate a markov chain sentence based on the user's chat history
|
||||
tmp = message.content[8:]
|
||||
if os.path.isfile('./markovs/' + users[tmp]):
|
||||
if tmp in users and os.path.isfile('./markovs/' + users[tmp]):
|
||||
mc = markov.Markov(open('./markovs/' + users[tmp]))
|
||||
try:
|
||||
response = mc.generate_text(random.randint(20,40))
|
||||
|
Loading…
Reference in New Issue
Block a user