Allows pickled loading to fix points function

This commit is contained in:
Mark Hoekveen
2020-05-04 15:21:26 +02:00
parent 70392bed44
commit b79c9c70c2
2 changed files with 15 additions and 15 deletions
+5 -5
View File
@@ -17,7 +17,7 @@ class Chatbot(commands.Cog):
self.pmLast = datetime(2018, 1, 1, 1, 1, 1)
self.pmCount = 0
try:
np.load('markov_dict.npy')
np.load('markov_dict.npy', allow_pickle=True)
except FileNotFoundError:
#If there's no initial file, make a new one:
initFile = {'pairs':{self.START_OF_MESSAGE:{'Hoi':1},'Hoi':{self.END_OF_MESSAGE:1}}, 'trairs':{}, 'responsePairs':{}}
@@ -187,7 +187,7 @@ class Chatbot(commands.Cog):
channel=self.bot.get_channel(channelId)
#Open current chain:
wordDict = np.load('markov_dict.npy').item()
wordDict = np.load('markov_dict.npy', allow_pickle=True).item()
#Iterate through the last x messages from the channel:
messageIterator = channel.history(limit=nrOfMessages, before=None, after=None, reverse=False, around=None)
@@ -276,7 +276,7 @@ class Chatbot(commands.Cog):
MAX_N_WORDS = 100 #Don't use more words than this
#Get dictionary/Markov chain
wordDict = np.load('markov_dict.npy').item()
wordDict = np.load('markov_dict.npy', allow_pickle=True).item()
wordPairDict = wordDict['pairs']
wordTrairDict = wordDict['trairs']
responsePairDict = wordDict['responsePairs']
@@ -389,7 +389,7 @@ class Chatbot(commands.Cog):
MAX_N_TRIES = 50
#Get dictionary/Markov chain
wordDict = np.load('markov_dict.npy').item()
wordDict = np.load('markov_dict.npy', allow_pickle=True).item()
wordPairDict = wordDict['pairs']
#try:
@@ -439,4 +439,4 @@ class Chatbot(commands.Cog):
message += uitspraken[i]
yield from ctx.channel.send(message)
except:
pass
pass