vranki / hemppa

Generic modular bot for Matrix (and via it irc, telegram, slack, etc..)
GNU General Public License v3.0
153 stars 37 forks source link

!help throws AttributeError: 'MatrixModule' object has no attribute 'info' #175

Open matthijskooijman opened 3 years ago

matthijskooijman commented 3 years ago

I just cloned the latest git master (cc65d630a0fb0536322d6fb83fa48a9634e50c04) and ran it in docker, which seems to work. However, the !help command seems to be broken. The log says:

hemppa-matrix-bot | 2021-10-07 01:21:43,792 - ERROR - hemppa - unhandled exception in !help                                                                   
hemppa-matrix-bot | Traceback (most recent call last):
hemppa-matrix-bot |   File "/bot/bot.py", line 444, in message_cb
hemppa-matrix-bot |     await moduleobject.matrix_message(self, room, event)
hemppa-matrix-bot |   File "/bot/modules/help.py", line 69, in matrix_message
hemppa-matrix-bot |     msg = msg + '\n' + self.info
hemppa-matrix-bot | AttributeError: 'MatrixModule' object has no attribute 'info'  
vorletzter commented 3 years ago

Ran into the same Issue.

As far as i can tell, the Bot needs to save some settings to {self.client.homeserver}/_matrix/client/r0/user/{userid}/account_data/{self.appid}?access_token={self.client.access_token} in order for the get_settings() method to succeed. Otherwise self.info is not getting set.

Issue should resolve itself, after a restart of the Bot.

Otherwise a quick solution might be to add self.info = "More information at https://github.com/vranki/hemppa" to init in modules/help.py

ellidi commented 2 years ago

Issue should resolve itself, after a restart of the Bot.

I have this issue as well, bot restart doesn't help. Any ideas?

vorletzter commented 2 years ago

I think you need to safe some settings in order for the method to succeed. Or you could try wrapping the method in try / except: AttributeError or assigning info a default value.

I haven't really looked into the issue though.

zikapanam commented 1 year ago

Hello,

I'm totally new to hemppa. I ran into the same issue.

Can someone tell me how to write settings ?

The command "!bot export" give me an error.

| Traceback (most recent call last): hemppa | File "./bot.py", line 444, in message_cb hemppa | await moduleobject.matrix_message(self, room, event) hemppa | File "/bot/modules/bot.py", line 57, in matrix_message hemppa | await self.export_settings(bot, event) hemppa | File "/bot/modules/bot.py", line 221, in export_settings hemppa | data = bot.get_account_data()['module_settings'] hemppa | TypeError: 'NoneType' object is not subscriptable Thx for your help !