Repository: opsdroid/opsdroid

Issue:
Mattermost connector is broken
# Description
The Mattermost connector is broken. It can connect to a Mattermost instance, but when sending a message to OpsDroid (using the Hello skill) you get:

```
ERROR opsdroid.core: Exception when running skill 'hello'.
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/opsdroid/core.py", line 465, in run_skill
    return await skill(event)
  File "/root/.local/share/opsdroid/opsdroid-modules/skill/hello/__init__.py", line 13, in hello
    await message.respond(text)
  File "/usr/local/lib/python3.8/site-packages/opsdroid/events.py", line 278, in respond
    "thinking-delay" in self.connector.configuration
AttributeError: 'NoneType' object has no attribute 'configuration'
WARNING mattermostdriver.websocket: Failed to establish websocket connection: 'NoneType' object has no attribute 'configuration'
```

## Steps to Reproduce
Configure the Mattermost connector and the Hello skill, start Opsdroid and send a message to the bot in Mattermost.


## Expected Functionality
A reply form the Hello skill.


## Experienced Functionality
No reply, and the above error in the Opsdroid logs.

## Versions
- **Opsdroid version:** 0.22.0
- **Python version:** 3.8
- **OS/Docker version:** N/A

## Configuration File
Please include your version of the configuration file below.

```yaml
welcome-message: false

connectors:
  ## Mattermost (core)
  mattermost:
    # Required
    token: "<redacted>"
    url: "<redacted>"
    team-name: "<redacted>"
    # Optional
    scheme: "https" # default: https
    port: 443 # default: 8065
    ssl-verify: true # default: true
    connect-timeout: 30 # default: 30

skills:
  ## Hello (https://github.com/opsdroid/skill-hello)
  hello: {}
  ## Seen (https://github.com/opsdroid/skill-seen)
  seen: {}
```

## Additional Details
Looks like this the Mattermost connector was missed in #1116 -- I'll submit a PR shortly to correct this.


Discussion:

Resolving patch:
diff --git a/opsdroid/connector/mattermost/__init__.py b/opsdroid/connector/mattermost/__init__.py
--- a/opsdroid/connector/mattermost/__init__.py
+++ b/opsdroid/connector/mattermost/__init__.py
@@ -95,10 +95,10 @@ async def process_message(self, raw_message):
             post = json.loads(data["post"])
             await self.opsdroid.parse(
                 Message(
-                    post["message"],
-                    data["sender_name"],
-                    data["channel_name"],
-                    self,
+                    text=post["message"],
+                    user=data["sender_name"],
+                    target=data["channel_name"],
+                    connector=self,
                     raw_event=message,
                 )
             )


Test patch:
diff --git a/tests/test_connector_mattermost.py b/tests/test_connector_mattermost.py
--- a/tests/test_connector_mattermost.py
+++ b/tests/test_connector_mattermost.py
@@ -170,6 +170,8 @@ async def test_send_message(self):
         )
         connector.mm_driver.posts = mock.Mock()
         connector.mm_driver.posts.create_post = mock.MagicMock()
-        await connector.send(Message("test", "user", "room", connector))
+        await connector.send(
+            Message(text="test", user="user", target="room", connector=connector)
+        )
         self.assertTrue(connector.mm_driver.channels.get_channel_by_name_and_team_name)
         self.assertTrue(connector.mm_driver.posts.create_post.called)