hemppa icon indicating copy to clipboard operation
hemppa copied to clipboard

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

Open matthijskooijman opened this issue 3 years ago • 4 comments

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'  

matthijskooijman avatar Oct 06 '21 23:10 matthijskooijman

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

vorletzter avatar Oct 11 '21 21:10 vorletzter

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

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

ellidi avatar May 11 '22 05:05 ellidi

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.

vorletzter avatar May 12 '22 15:05 vorletzter

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 !

zikapanam avatar May 03 '23 09:05 zikapanam