csvance / armchair-expert

Machine Learning Chatbot
MIT License
56 stars 19 forks source link

AttributeError: 'bool' object has no attribute 'set' #50

Open ineptvirus opened 5 years ago

ineptvirus commented 5 years ago

Hi, firstly apologies because I hate to create issues, but I cant seem to fix this error by myself. I'm a bit of a noob.

It seems to finish loading and display the graphical info on training stats in the console, but after a few seconds another message appears that seems to be an error that stops the bot from working correctly.

Using Python 3.7, all modules installed and updated, on discord.

Console:

D:\Mirai\armchair-expert-master>c:\Users\Jake\AppData\Local\Programs\Python\Python37\python.exe D:\Mirai\armchair-expert-master\armchair_expert.py
INFO:ArmchairExpert:Status: STARTING_UP
INFO:ArmchairExpert:Loaded Discord Connector.
INFO:ArmchairExpert:Loading spaCy model
INFO:ArmchairExpert:Training begin
INFO:ArmchairExpert:Training_Preprocessing_Markov(Import)
INFO:ArmchairExpert:Training_Preprocessing_Markov(Discord)
INFO:ArmchairExpert:Training(Markov)
INFO:ArmchairExpert:Training_Preprocessing_Structure(Import)
INFO:ArmchairExpert:Training_Preprocessing_Structure(Discord)
INFO:ArmchairExpert:Training(Structure)
Using TensorFlow backend.
Using TensorFlow backend.
WARNING:tensorflow:From c:\Users\Jake\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
WARNING:tensorflow:From c:\Users\Jake\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\backend\tensorflow_backend.py:3445: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`.
INFO:ArmchairExpert:Training end
INFO:ArmchairExpert:Status: RUNNING
_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
embedding_1 (Embedding)      (None, 16, 120)           14400
_________________________________________________________________
lstm_1 (LSTM)                (None, 128)               127488
_________________________________________________________________
dense_1 (Dense)              (None, 120)               15480
=================================================================
Total params: 157,368
Trainable params: 157,368
Non-trainable params: 0
_________________________________________________________________
Task exception was never retrieved
future: <Task finished coro=<ConnectionState._delay_ready() done, defined at c:\Users\Jake\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\state.py:286> exception=AttributeError("'bool' object has no attribute 'set'")>
Traceback (most recent call last):
  File "c:\Users\Jake\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\state.py", line 322, in _delay_ready
    self.call_handlers('ready')
  File "c:\Users\Jake\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\state.py", line 139, in call_handlers
    func(*args, **kwargs)
  File "c:\Users\Jake\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\client.py", line 207, in _handle_ready
    self._ready.set()
AttributeError: 'bool' object has no attribute 'set'

After this the bot still appears to be online, and direct messaging it yields further console text every time a message is sent, either direct or in a dm:

Ignoring exception in on_message
Traceback (most recent call last):
  File "c:\Users\Jake\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\client.py", line 255, in _run_event
    await coro(*args, **kwargs)
  File "D:\Mirai\armchair-expert-master\connectors\discord.py", line 54, in on_message
    if message.server is None and DISCORD_LEARN_FROM_DIRECT_MESSAGE:
AttributeError: 'Message' object has no attribute 'server'

The bot never sends any messages out to discord. :(

Thanks, -I.V.

JacobMrox commented 5 years ago

I'm having the same issue as well...

Edit: I was using discord rewrite, so I had to rewrite parts of the bot's code (the parts that generated these errors, for example, message.server is message.guild in the rewrite branch and so on) and it works now.