Allows pickled loading in chatbot
This commit is contained in:
+4
-4
@@ -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, oldest_first=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:
|
||||
|
||||
Reference in New Issue
Block a user