LPgenerator / mattermost_bot

MatterBot - A chat bot for MatterMost (http://www.mattermost.org).
MIT License
211 stars 60 forks source link

Mattermost Bot doesnt find givin team #50

Closed 0x78f1935 closed 6 years ago

0x78f1935 commented 6 years ago

Traceback (most recent call last): │ }, File "run.py", line 4, in <module> │ "WebrtcSettings": { Bot().run() │ "Enable": false, File "/home/mk0307/.local/lib/python3.5/site-packages/mattermost_bot/bot.py", line 27, in __init__ │ "GatewayWebsocketUrl": "", settings.SSL_VERIFY │ "GatewayAdminUrl": "", File "/home/mk0307/.local/lib/python3.5/site-packages/mattermost_bot/mattermost.py", line 154, in __init__ │ "GatewayAdminSecret": "", self.login(team, email, password) │ "StunURI": "", File "/home/mk0307/.local/lib/python3.5/site-packages/mattermost_bot/mattermost.py", line 158, in login │ "TurnURI": "", self.user = self.api.login(team, email, password) │ "TurnUsername": "", File "/home/mk0307/.local/lib/python3.5/site-packages/mattermost_bot/mattermost.py", line 48, in login │ "TurnSharedKey": "" self.load_initial_data() │ } File "/home/mk0307/.local/lib/python3.5/site-packages/mattermost_bot/mattermost.py", line 55, in load_initial_data │}root@git:~/mattermost/config# self.team_id = self.initial['teams'][0]['id'] │root@git:~/mattermost/config# KeyError: 'teams'

I know for a fact that the right name convention is used in settings.py

eyebank commented 6 years ago

Hey @Annihilator708 Annihilator708, We are trying to get Mattermost_bot setup on our system. any pointers?

0x78f1935 commented 6 years ago

@eyebank Fortunately... sorry.

We upgraded to mattermost 4.3 and using the curl command now instead of a python script. I build my own wrapper around it. I'm so sorry but I keep this wrapper private for now. The curl command I use with the correct webhook goes like this:

os.popen('curl -i -X POST -d \'payload={"text": "Connection re-established!"}\' %s' % (bot_url)).read()

Where bot_url is the webhook link. os.popen may not be the best solution but it works for me