We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Setting typing delay to 0 means bot never responds
# Description
When a typing delay is defined it is an integer which states how many characters per second opsdroid should type. If you set this to `0` then it can type no characters per second and therefore never responds.


## Steps to Reproduce
- Configure a connector with a `typing-delay` of `0`. 
- Talk to the bot


## Experienced Functionality
The bot never responds.


## Expected Functionality
I would expect the bot to respond eventually. Perhaps even immediately and log an error stating `0` is an invalid response.

Thinking a little more about this I wonder if this functionality is the wrong way round. With `thinking-delay` that is the number of seconds that opsdroid should way before responding, so as the number gets bigger the longer opsdroid waits. But with `typing-delay` it is the number of characters per second that opsdroid can type, so the bigger the number the less opsdroid waits. The word `delay` suggests that the higher the number the longer the wait.

These opposites could be confusing (it confused me this evening). I think it would be good that both numbers represent time, rather than one representing characters per second. That would involve changing it to be seconds per character. This would result in a bigger number causing a bigger delay. 


## Versions
- **Opsdroid version:** master
- **Python version:** 3.5.4
- **OS/Docker version:** macOS 10.13

## Configuration File


```yaml
connectors:
  - name: shell
    typing-delay: 0

skills:
  - name: hello
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `opsdroid/message.py`
Content:
```
1 """Class to encapsulate a message."""
2 
3 from datetime import datetime
4 from copy import copy
5 import asyncio
6 from random import randrange
7 
8 from opsdroid.helper import get_opsdroid
9 
10 
11 class Message:
12     # pylint: disable=too-few-public-methods
13     """A message object."""
14 
15     def __init__(self, text, user, room, connector, raw_message=None):
16         """Create object with minimum properties."""
17         self.created = datetime.now()
18         self.text = text
19         self.user = user
20         self.room = room
21         self.connector = connector
22         self.raw_message = raw_message
23         self.regex = None
24         self.responded_to = False
25 
26     async def _thinking_delay(self):
27         """Make opsdroid wait x-seconds before responding."""
28         seconds = self.connector.configuration.get('thinking-delay', 0)
29 
30         if isinstance(seconds, list):
31             seconds = randrange(seconds[0], seconds[1])
32 
33         await asyncio.sleep(seconds)
34 
35     async def _typing_delay(self, text):
36         """Simulate typing, takes an int(characters per second typed)."""
37         try:
38             char_per_sec = self.connector.configuration['typing-delay']
39             char_count = len(text)
40             await asyncio.sleep(char_count//char_per_sec)
41         except KeyError:
42             pass
43 
44     async def respond(self, text, room=None):
45         """Respond to this message using the connector it was created by."""
46         opsdroid = get_opsdroid()
47         response = copy(self)
48         response.text = text
49 
50         if 'thinking-delay' in self.connector.configuration or \
51            'typing-delay' in self.connector.configuration:
52             await self._thinking_delay()
53             await self._typing_delay(response.text)
54 
55         await self.connector.respond(response, room)
56         if not self.responded_to:
57             now = datetime.now()
58             opsdroid.stats["total_responses"] = \
59                 opsdroid.stats["total_responses"] + 1
60             opsdroid.stats["total_response_time"] = \
61                 opsdroid.stats["total_response_time"] + \
62                 (now - self.created).total_seconds()
63             self.responded_to = True
64 
65     async def react(self, emoji):
66         """React to this message using the connector it was created by."""
67         if 'thinking-delay' in self.connector.configuration:
68             await self._thinking_delay()
69         return await self.connector.react(self, emoji)
70
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/opsdroid/message.py b/opsdroid/message.py
--- a/opsdroid/message.py
+++ b/opsdroid/message.py
@@ -33,13 +33,14 @@
         await asyncio.sleep(seconds)
 
     async def _typing_delay(self, text):
-        """Simulate typing, takes an int(characters per second typed)."""
-        try:
-            char_per_sec = self.connector.configuration['typing-delay']
-            char_count = len(text)
-            await asyncio.sleep(char_count//char_per_sec)
-        except KeyError:
-            pass
+        """Simulate typing, takes an int or float to delay reply."""
+        seconds = self.connector.configuration.get('typing-delay', 0)
+        char_count = len(text)
+
+        if isinstance(seconds, list):
+            seconds = randrange(seconds[0], seconds[1])
+
+        await asyncio.sleep(char_count*seconds)
 
     async def respond(self, text, room=None):
         """Respond to this message using the connector it was created by."""

{"golden_diff": "diff --git a/opsdroid/message.py b/opsdroid/message.py\n--- a/opsdroid/message.py\n+++ b/opsdroid/message.py\n@@ -33,13 +33,14 @@\n         await asyncio.sleep(seconds)\n \n     async def _typing_delay(self, text):\n-        \"\"\"Simulate typing, takes an int(characters per second typed).\"\"\"\n-        try:\n-            char_per_sec = self.connector.configuration['typing-delay']\n-            char_count = len(text)\n-            await asyncio.sleep(char_count//char_per_sec)\n-        except KeyError:\n-            pass\n+        \"\"\"Simulate typing, takes an int or float to delay reply.\"\"\"\n+        seconds = self.connector.configuration.get('typing-delay', 0)\n+        char_count = len(text)\n+\n+        if isinstance(seconds, list):\n+            seconds = randrange(seconds[0], seconds[1])\n+\n+        await asyncio.sleep(char_count*seconds)\n \n     async def respond(self, text, room=None):\n         \"\"\"Respond to this message using the connector it was created by.\"\"\"\n", "issue": "Setting typing delay to 0 means bot never responds\n# Description\r\nWhen a typing delay is defined it is an integer which states how many characters per second opsdroid should type. If you set this to `0` then it can type no characters per second and therefore never responds.\r\n\r\n\r\n## Steps to Reproduce\r\n- Configure a connector with a `typing-delay` of `0`. \r\n- Talk to the bot\r\n\r\n\r\n## Experienced Functionality\r\nThe bot never responds.\r\n\r\n\r\n## Expected Functionality\r\nI would expect the bot to respond eventually. Perhaps even immediately and log an error stating `0` is an invalid response.\r\n\r\nThinking a little more about this I wonder if this functionality is the wrong way round. With `thinking-delay` that is the number of seconds that opsdroid should way before responding, so as the number gets bigger the longer opsdroid waits. But with `typing-delay` it is the number of characters per second that opsdroid can type, so the bigger the number the less opsdroid waits. The word `delay` suggests that the higher the number the longer the wait.\r\n\r\nThese opposites could be confusing (it confused me this evening). I think it would be good that both numbers represent time, rather than one representing characters per second. That would involve changing it to be seconds per character. This would result in a bigger number causing a bigger delay. \r\n\r\n\r\n## Versions\r\n- **Opsdroid version:** master\r\n- **Python version:** 3.5.4\r\n- **OS/Docker version:** macOS 10.13\r\n\r\n## Configuration File\r\n\r\n\r\n```yaml\r\nconnectors:\r\n  - name: shell\r\n    typing-delay: 0\r\n\r\nskills:\r\n  - name: hello\r\n```\r\n\n", "before_files": [{"content": "\"\"\"Class to encapsulate a message.\"\"\"\n\nfrom datetime import datetime\nfrom copy import copy\nimport asyncio\nfrom random import randrange\n\nfrom opsdroid.helper import get_opsdroid\n\n\nclass Message:\n    # pylint: disable=too-few-public-methods\n    \"\"\"A message object.\"\"\"\n\n    def __init__(self, text, user, room, connector, raw_message=None):\n        \"\"\"Create object with minimum properties.\"\"\"\n        self.created = datetime.now()\n        self.text = text\n        self.user = user\n        self.room = room\n        self.connector = connector\n        self.raw_message = raw_message\n        self.regex = None\n        self.responded_to = False\n\n    async def _thinking_delay(self):\n        \"\"\"Make opsdroid wait x-seconds before responding.\"\"\"\n        seconds = self.connector.configuration.get('thinking-delay', 0)\n\n        if isinstance(seconds, list):\n            seconds = randrange(seconds[0], seconds[1])\n\n        await asyncio.sleep(seconds)\n\n    async def _typing_delay(self, text):\n        \"\"\"Simulate typing, takes an int(characters per second typed).\"\"\"\n        try:\n            char_per_sec = self.connector.configuration['typing-delay']\n            char_count = len(text)\n            await asyncio.sleep(char_count//char_per_sec)\n        except KeyError:\n            pass\n\n    async def respond(self, text, room=None):\n        \"\"\"Respond to this message using the connector it was created by.\"\"\"\n        opsdroid = get_opsdroid()\n        response = copy(self)\n        response.text = text\n\n        if 'thinking-delay' in self.connector.configuration or \\\n           'typing-delay' in self.connector.configuration:\n            await self._thinking_delay()\n            await self._typing_delay(response.text)\n\n        await self.connector.respond(response, room)\n        if not self.responded_to:\n            now = datetime.now()\n            opsdroid.stats[\"total_responses\"] = \\\n                opsdroid.stats[\"total_responses\"] + 1\n            opsdroid.stats[\"total_response_time\"] = \\\n                opsdroid.stats[\"total_response_time\"] + \\\n                (now - self.created).total_seconds()\n            self.responded_to = True\n\n    async def react(self, emoji):\n        \"\"\"React to this message using the connector it was created by.\"\"\"\n        if 'thinking-delay' in self.connector.configuration:\n            await self._thinking_delay()\n        return await self.connector.react(self, emoji)\n", "path": "opsdroid/message.py"}], "after_files": [{"content": "\"\"\"Class to encapsulate a message.\"\"\"\n\nfrom datetime import datetime\nfrom copy import copy\nimport asyncio\nfrom random import randrange\n\nfrom opsdroid.helper import get_opsdroid\n\n\nclass Message:\n    # pylint: disable=too-few-public-methods\n    \"\"\"A message object.\"\"\"\n\n    def __init__(self, text, user, room, connector, raw_message=None):\n        \"\"\"Create object with minimum properties.\"\"\"\n        self.created = datetime.now()\n        self.text = text\n        self.user = user\n        self.room = room\n        self.connector = connector\n        self.raw_message = raw_message\n        self.regex = None\n        self.responded_to = False\n\n    async def _thinking_delay(self):\n        \"\"\"Make opsdroid wait x-seconds before responding.\"\"\"\n        seconds = self.connector.configuration.get('thinking-delay', 0)\n\n        if isinstance(seconds, list):\n            seconds = randrange(seconds[0], seconds[1])\n\n        await asyncio.sleep(seconds)\n\n    async def _typing_delay(self, text):\n        \"\"\"Simulate typing, takes an int or float to delay reply.\"\"\"\n        seconds = self.connector.configuration.get('typing-delay', 0)\n        char_count = len(text)\n\n        if isinstance(seconds, list):\n            seconds = randrange(seconds[0], seconds[1])\n\n        await asyncio.sleep(char_count*seconds)\n\n    async def respond(self, text, room=None):\n        \"\"\"Respond to this message using the connector it was created by.\"\"\"\n        opsdroid = get_opsdroid()\n        response = copy(self)\n        response.text = text\n\n        if 'thinking-delay' in self.connector.configuration or \\\n           'typing-delay' in self.connector.configuration:\n            await self._thinking_delay()\n            await self._typing_delay(response.text)\n\n        await self.connector.respond(response, room)\n        if not self.responded_to:\n            now = datetime.now()\n            opsdroid.stats[\"total_responses\"] = \\\n                opsdroid.stats[\"total_responses\"] + 1\n            opsdroid.stats[\"total_response_time\"] = \\\n                opsdroid.stats[\"total_response_time\"] + \\\n                (now - self.created).total_seconds()\n            self.responded_to = True\n\n    async def react(self, emoji):\n        \"\"\"React to this message using the connector it was created by.\"\"\"\n        if 'thinking-delay' in self.connector.configuration:\n            await self._thinking_delay()\n        return await self.connector.react(self, emoji)\n", "path": "opsdroid/message.py"}]}