We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add Google Style Docstrings
We should implement Google Style Docstrings to every function, method, class in opsdroid. This style will support existing documentation and will help in the future by generating documentation automatically.

This consists in a bit of effort so this issue can be worked by more than one contributor, just make sure that everyone knows what you are working on in order to avoid other contributors spending time on something that you are working on.

If you are unfamiliar with the Google Style Docstrings I'd recommend that you check these resources:

 - [Sphix 1.8.0+ - Google Style Docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html)



Docstrings that need to be updated:

- main.py
  - [x] configure_lang
  - [ ] configure_log
  - [ ] get_logging_level
  - [ ] check_dependencies
  - [ ] print_version
  - [ ] print_example_config
  - [ ] edit_files
  - [x] welcome_message
- ~~helper.py~~
  - [x] get_opsdroid
  - [x] del_rw
  - [x] move_config_to_appdir
- memory.py
  - [x] Memory
  - [x] get
  - [x] put
  - [x] _get_from_database
  - [x] _put_to_database
- message.py
  - [x] Message
  - [x]  __init__
  - [x]  _thinking_delay
  - [x]  _typing delay
  - [x]  respond
  - [x]  react
- web.py
  - [ ] Web
  - [x] get_port
  - [x] get_host
  - [x]  get_ssl_context
  - [ ]  start
  - [ ]  build_response
  - [ ]  web_index_handler
  - [ ]  web_stats_handler
- matchers.py
  - [ ] match_regex
  - [ ] match_apiai_action
  - [ ] match_apiai_intent
  - [ ]  match_dialogflow_action
  - [ ]  match_dialogflow_intent
  - [ ] match_luisai_intent
  - [ ] match_rasanlu
  - [ ] match_recastai
  - [ ] match_witai
  - [ ] match_crontab
  - [ ] match_webhook
  - [ ] match_always
- core.py
  - [ ] OpsDroid
  - [ ] default_connector
  - [ ] exit
  - [ ] critical
  - [ ]  call_stop
  - [ ] disconnect
  - [ ] stop
  - [ ] load
  - [ ] start_loop
  - [x] setup_skills
  - [ ] train_parsers
  - [ ] start_connector_tasks
  - [ ] start_database
  - [ ] run_skill
  - [ ] get_ranked_skills
  - [ ] parse
- loader.py
  - [ ] Loader
  - [x] import_module_from_spec
  - [x] import_module
  - [x] check_cache
  - [x] build_module_import_path
  - [x] build_module_install_path
  - [x] git_clone
  - [x] git_pull
  - [x] pip_install_deps
  - [x] create_default_config
  - [x] load_config_file
  - [ ] envvar_constructor
  - [ ] include_constructor
  - [x] setup_modules_directory
  - [x] load_modules_from_config
  - [x] _load_modules
  - [x] _install_module
  - [x] _update_module
  - [ ] _install_git_module
  - [x] _install_local_module









---- ORIGINAL POST ---- 
I've been wondering about this for a while now and I would like to know if we should replace/update all the docstrings in opsdroid with the Google Style doc strings. 

I think this could help new and old contributors to contribute and commit to opsdroid since the Google Style docstrings give more information about every method/function and specifies clearly what sort of input the function/method expects, what will it return and what will be raised (if applicable).

The downsize of this style is that the length of every .py file will increase due to the doc strings, but since most IDE's allow you to hide those fields it shouldn't be too bad.

Here is a good example of Google Style Doc strings:  [Sphix 1.8.0+ - Google Style Docstrings](http://www.sphinx-doc.org/en/master/ext/example_google.html)

I would like to know what you all think about this idea and if its worth spending time on it.

--- 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/cli/utils.py`
Content:
```
1 """Utilities for the opsdroid CLI commands."""
2 
3 import click
4 import gettext
5 import os
6 import logging
7 import subprocess
8 import sys
9 import time
10 import warnings
11 
12 from opsdroid.const import (
13     DEFAULT_LOG_FILENAME,
14     LOCALE_DIR,
15     DEFAULT_LANGUAGE,
16     DEFAULT_CONFIG_PATH,
17 )
18 
19 _LOGGER = logging.getLogger("opsdroid")
20 
21 
22 def edit_files(ctx, param, value):
23     """Open config/log file with favourite editor."""
24     if value == "config":
25         file = DEFAULT_CONFIG_PATH
26         if ctx.command.name == "cli":
27             warn_deprecated_cli_option(
28                 "The flag -e/--edit-files has been deprecated. "
29                 "Please run `opsdroid config edit` instead."
30             )
31     elif value == "log":
32         file = DEFAULT_LOG_FILENAME
33         if ctx.command.name == "cli":
34             warn_deprecated_cli_option(
35                 "The flag -l/--view-log has been deprecated. "
36                 "Please run `opsdroid logs` instead."
37             )
38     else:
39         return
40 
41     editor = os.environ.get("EDITOR", "vi")
42     if editor == "vi":
43         click.echo(
44             "You are about to edit a file in vim. \n"
45             "Read the tutorial on vim at: https://bit.ly/2HRvvrB"
46         )
47         time.sleep(3)
48 
49     subprocess.run([editor, file])
50     ctx.exit(0)
51 
52 
53 def warn_deprecated_cli_option(text):
54     """Warn users that the cli option they have used is deprecated."""
55     print(f"Warning: {text}")
56     warnings.warn(text, DeprecationWarning)
57 
58 
59 def configure_lang(config):
60     """Configure app language based on user config.
61 
62     Args:
63         config: Language Configuration and it uses ISO 639-1 code.
64         for more info https://en.m.wikipedia.org/wiki/List_of_ISO_639-1_codes
65 
66 
67     """
68     lang_code = config.get("lang", DEFAULT_LANGUAGE)
69     if lang_code != DEFAULT_LANGUAGE:
70         lang = gettext.translation("opsdroid", LOCALE_DIR, (lang_code,), fallback=True)
71         lang.install()
72 
73 
74 def check_dependencies():
75     """Check for system dependencies required by opsdroid."""
76     if sys.version_info.major < 3 or sys.version_info.minor < 6:
77         logging.critical(_("Whoops! opsdroid requires python 3.6 or above."))
78         sys.exit(1)
79 
80 
81 def welcome_message(config):
82     """Add welcome message if set to true in configuration.
83 
84     Args:
85         config: config loaded by Loader
86 
87     Raises:
88         KeyError: If 'welcome-message' key is not found in configuration file
89 
90     """
91     try:
92         if config["welcome-message"]:
93             _LOGGER.info("=" * 40)
94             _LOGGER.info(
95                 _(
96                     "You can customise your opsdroid by modifying "
97                     "your configuration.yaml"
98                 )
99             )
100             _LOGGER.info(
101                 _("Read more at: " "http://opsdroid.readthedocs.io/#configuration")
102             )
103             _LOGGER.info(_("Watch the Get Started Videos at: " "http://bit.ly/2fnC0Fh"))
104             _LOGGER.info(
105                 _(
106                     "Install Opsdroid Desktop at: \n"
107                     "https://github.com/opsdroid/opsdroid-desktop/"
108                     "releases"
109                 )
110             )
111             _LOGGER.info("=" * 40)
112     except KeyError:
113         _LOGGER.warning(
114             _("'welcome-message: true/false' is missing in configuration.yaml")
115         )
116
```

Path: `opsdroid/cli/config.py`
Content:
```
1 """The config subcommand for opsdroid cli."""
2 
3 import click
4 
5 from opsdroid.cli.utils import edit_files, warn_deprecated_cli_option
6 from opsdroid.const import EXAMPLE_CONFIG_FILE
7 
8 
9 def print_example_config(ctx, param, value):
10     """[Deprecated] Print out the example config."""
11     if not value or ctx.resilient_parsing:
12         return
13     if ctx.command.name == "cli":
14         warn_deprecated_cli_option(
15             "The flag --gen-config has been deprecated. "
16             "Please run `opsdroid config gen` instead."
17         )
18     with open(EXAMPLE_CONFIG_FILE, "r") as conf:
19         click.echo(conf.read())
20     ctx.exit(0)
21 
22 
23 @click.group()
24 def config():
25     """Subcommands related to opsdroid configuration."""
26 
27 
28 @config.command()
29 @click.pass_context
30 def gen(ctx):
31     """Print out the example config."""
32     print_example_config(ctx, None, True)
33 
34 
35 @config.command()
36 @click.pass_context
37 def edit(ctx):
38     """Print out the example config."""
39     edit_files(ctx, None, "config")
40
```
--- 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/cli/config.py b/opsdroid/cli/config.py
--- a/opsdroid/cli/config.py
+++ b/opsdroid/cli/config.py
@@ -7,7 +7,19 @@
 
 
 def print_example_config(ctx, param, value):
-    """[Deprecated] Print out the example config."""
+    """[Deprecated] Print out the example config.
+
+    Args:
+        ctx (:obj:`click.Context`): The current click cli context.
+        param (dict): a dictionary of all parameters pass to the click
+            context when invoking this function as a callback.
+        value (bool): the value of this parameter after invocation.
+            Defaults to False, set to True when this flag is called.
+
+    Returns:
+        int: the exit code. Always returns 0 in this case.
+
+    """
     if not value or ctx.resilient_parsing:
         return
     if ctx.command.name == "cli":
diff --git a/opsdroid/cli/utils.py b/opsdroid/cli/utils.py
--- a/opsdroid/cli/utils.py
+++ b/opsdroid/cli/utils.py
@@ -20,7 +20,21 @@
 
 
 def edit_files(ctx, param, value):
-    """Open config/log file with favourite editor."""
+    """Open config/log file with favourite editor.
+
+    Args:
+        ctx (:obj:`click.Context`): The current click cli context.
+        param (dict): a dictionary of all parameters pass to the click
+            context when invoking this function as a callback.
+        value (string): the value of this parameter after invocation.
+            It is either "config" or "log" depending on the program
+            calling this function.
+
+    Returns:
+        int: the exit code. Always returns 0 in this case.
+
+    """
+
     if value == "config":
         file = DEFAULT_CONFIG_PATH
         if ctx.command.name == "cli":
@@ -72,7 +86,13 @@
 
 
 def check_dependencies():
-    """Check for system dependencies required by opsdroid."""
+    """Check for system dependencies required by opsdroid.
+
+    Returns:
+        int: the exit code. Returns 1 if the Python version installed is
+        below 3.6.
+
+    """
     if sys.version_info.major < 3 or sys.version_info.minor < 6:
         logging.critical(_("Whoops! opsdroid requires python 3.6 or above."))
         sys.exit(1)

{"golden_diff": "diff --git a/opsdroid/cli/config.py b/opsdroid/cli/config.py\n--- a/opsdroid/cli/config.py\n+++ b/opsdroid/cli/config.py\n@@ -7,7 +7,19 @@\n \n \n def print_example_config(ctx, param, value):\n-    \"\"\"[Deprecated] Print out the example config.\"\"\"\n+    \"\"\"[Deprecated] Print out the example config.\n+\n+    Args:\n+        ctx (:obj:`click.Context`): The current click cli context.\n+        param (dict): a dictionary of all parameters pass to the click\n+            context when invoking this function as a callback.\n+        value (bool): the value of this parameter after invocation.\n+            Defaults to False, set to True when this flag is called.\n+\n+    Returns:\n+        int: the exit code. Always returns 0 in this case.\n+\n+    \"\"\"\n     if not value or ctx.resilient_parsing:\n         return\n     if ctx.command.name == \"cli\":\ndiff --git a/opsdroid/cli/utils.py b/opsdroid/cli/utils.py\n--- a/opsdroid/cli/utils.py\n+++ b/opsdroid/cli/utils.py\n@@ -20,7 +20,21 @@\n \n \n def edit_files(ctx, param, value):\n-    \"\"\"Open config/log file with favourite editor.\"\"\"\n+    \"\"\"Open config/log file with favourite editor.\n+\n+    Args:\n+        ctx (:obj:`click.Context`): The current click cli context.\n+        param (dict): a dictionary of all parameters pass to the click\n+            context when invoking this function as a callback.\n+        value (string): the value of this parameter after invocation.\n+            It is either \"config\" or \"log\" depending on the program\n+            calling this function.\n+\n+    Returns:\n+        int: the exit code. Always returns 0 in this case.\n+\n+    \"\"\"\n+\n     if value == \"config\":\n         file = DEFAULT_CONFIG_PATH\n         if ctx.command.name == \"cli\":\n@@ -72,7 +86,13 @@\n \n \n def check_dependencies():\n-    \"\"\"Check for system dependencies required by opsdroid.\"\"\"\n+    \"\"\"Check for system dependencies required by opsdroid.\n+\n+    Returns:\n+        int: the exit code. Returns 1 if the Python version installed is\n+        below 3.6.\n+\n+    \"\"\"\n     if sys.version_info.major < 3 or sys.version_info.minor < 6:\n         logging.critical(_(\"Whoops! opsdroid requires python 3.6 or above.\"))\n         sys.exit(1)\n", "issue": "Add Google Style Docstrings\nWe should implement Google Style Docstrings to every function, method, class in opsdroid. This style will support existing documentation and will help in the future by generating documentation automatically.\r\n\r\nThis consists in a bit of effort so this issue can be worked by more than one contributor, just make sure that everyone knows what you are working on in order to avoid other contributors spending time on something that you are working on.\r\n\r\nIf you are unfamiliar with the Google Style Docstrings I'd recommend that you check these resources:\r\n\r\n - [Sphix 1.8.0+ - Google Style Docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html)\r\n\r\n\r\n\r\nDocstrings that need to be updated:\r\n\r\n- main.py\r\n  - [x] configure_lang\r\n  - [ ] configure_log\r\n  - [ ] get_logging_level\r\n  - [ ] check_dependencies\r\n  - [ ] print_version\r\n  - [ ] print_example_config\r\n  - [ ] edit_files\r\n  - [x] welcome_message\r\n- ~~helper.py~~\r\n  - [x] get_opsdroid\r\n  - [x] del_rw\r\n  - [x] move_config_to_appdir\r\n- memory.py\r\n  - [x] Memory\r\n  - [x] get\r\n  - [x] put\r\n  - [x] _get_from_database\r\n  - [x] _put_to_database\r\n- message.py\r\n  - [x] Message\r\n  - [x]  __init__\r\n  - [x]  _thinking_delay\r\n  - [x]  _typing delay\r\n  - [x]  respond\r\n  - [x]  react\r\n- web.py\r\n  - [ ] Web\r\n  - [x] get_port\r\n  - [x] get_host\r\n  - [x]  get_ssl_context\r\n  - [ ]  start\r\n  - [ ]  build_response\r\n  - [ ]  web_index_handler\r\n  - [ ]  web_stats_handler\r\n- matchers.py\r\n  - [ ] match_regex\r\n  - [ ] match_apiai_action\r\n  - [ ] match_apiai_intent\r\n  - [ ]  match_dialogflow_action\r\n  - [ ]  match_dialogflow_intent\r\n  - [ ] match_luisai_intent\r\n  - [ ] match_rasanlu\r\n  - [ ] match_recastai\r\n  - [ ] match_witai\r\n  - [ ] match_crontab\r\n  - [ ] match_webhook\r\n  - [ ] match_always\r\n- core.py\r\n  - [ ] OpsDroid\r\n  - [ ] default_connector\r\n  - [ ] exit\r\n  - [ ] critical\r\n  - [ ]  call_stop\r\n  - [ ] disconnect\r\n  - [ ] stop\r\n  - [ ] load\r\n  - [ ] start_loop\r\n  - [x] setup_skills\r\n  - [ ] train_parsers\r\n  - [ ] start_connector_tasks\r\n  - [ ] start_database\r\n  - [ ] run_skill\r\n  - [ ] get_ranked_skills\r\n  - [ ] parse\r\n- loader.py\r\n  - [ ] Loader\r\n  - [x] import_module_from_spec\r\n  - [x] import_module\r\n  - [x] check_cache\r\n  - [x] build_module_import_path\r\n  - [x] build_module_install_path\r\n  - [x] git_clone\r\n  - [x] git_pull\r\n  - [x] pip_install_deps\r\n  - [x] create_default_config\r\n  - [x] load_config_file\r\n  - [ ] envvar_constructor\r\n  - [ ] include_constructor\r\n  - [x] setup_modules_directory\r\n  - [x] load_modules_from_config\r\n  - [x] _load_modules\r\n  - [x] _install_module\r\n  - [x] _update_module\r\n  - [ ] _install_git_module\r\n  - [x] _install_local_module\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n---- ORIGINAL POST ---- \r\nI've been wondering about this for a while now and I would like to know if we should replace/update all the docstrings in opsdroid with the Google Style doc strings. \r\n\r\nI think this could help new and old contributors to contribute and commit to opsdroid since the Google Style docstrings give more information about every method/function and specifies clearly what sort of input the function/method expects, what will it return and what will be raised (if applicable).\r\n\r\nThe downsize of this style is that the length of every .py file will increase due to the doc strings, but since most IDE's allow you to hide those fields it shouldn't be too bad.\r\n\r\nHere is a good example of Google Style Doc strings:  [Sphix 1.8.0+ - Google Style Docstrings](http://www.sphinx-doc.org/en/master/ext/example_google.html)\r\n\r\nI would like to know what you all think about this idea and if its worth spending time on it.\n", "before_files": [{"content": "\"\"\"Utilities for the opsdroid CLI commands.\"\"\"\n\nimport click\nimport gettext\nimport os\nimport logging\nimport subprocess\nimport sys\nimport time\nimport warnings\n\nfrom opsdroid.const import (\n    DEFAULT_LOG_FILENAME,\n    LOCALE_DIR,\n    DEFAULT_LANGUAGE,\n    DEFAULT_CONFIG_PATH,\n)\n\n_LOGGER = logging.getLogger(\"opsdroid\")\n\n\ndef edit_files(ctx, param, value):\n    \"\"\"Open config/log file with favourite editor.\"\"\"\n    if value == \"config\":\n        file = DEFAULT_CONFIG_PATH\n        if ctx.command.name == \"cli\":\n            warn_deprecated_cli_option(\n                \"The flag -e/--edit-files has been deprecated. \"\n                \"Please run `opsdroid config edit` instead.\"\n            )\n    elif value == \"log\":\n        file = DEFAULT_LOG_FILENAME\n        if ctx.command.name == \"cli\":\n            warn_deprecated_cli_option(\n                \"The flag -l/--view-log has been deprecated. \"\n                \"Please run `opsdroid logs` instead.\"\n            )\n    else:\n        return\n\n    editor = os.environ.get(\"EDITOR\", \"vi\")\n    if editor == \"vi\":\n        click.echo(\n            \"You are about to edit a file in vim. \\n\"\n            \"Read the tutorial on vim at: https://bit.ly/2HRvvrB\"\n        )\n        time.sleep(3)\n\n    subprocess.run([editor, file])\n    ctx.exit(0)\n\n\ndef warn_deprecated_cli_option(text):\n    \"\"\"Warn users that the cli option they have used is deprecated.\"\"\"\n    print(f\"Warning: {text}\")\n    warnings.warn(text, DeprecationWarning)\n\n\ndef configure_lang(config):\n    \"\"\"Configure app language based on user config.\n\n    Args:\n        config: Language Configuration and it uses ISO 639-1 code.\n        for more info https://en.m.wikipedia.org/wiki/List_of_ISO_639-1_codes\n\n\n    \"\"\"\n    lang_code = config.get(\"lang\", DEFAULT_LANGUAGE)\n    if lang_code != DEFAULT_LANGUAGE:\n        lang = gettext.translation(\"opsdroid\", LOCALE_DIR, (lang_code,), fallback=True)\n        lang.install()\n\n\ndef check_dependencies():\n    \"\"\"Check for system dependencies required by opsdroid.\"\"\"\n    if sys.version_info.major < 3 or sys.version_info.minor < 6:\n        logging.critical(_(\"Whoops! opsdroid requires python 3.6 or above.\"))\n        sys.exit(1)\n\n\ndef welcome_message(config):\n    \"\"\"Add welcome message if set to true in configuration.\n\n    Args:\n        config: config loaded by Loader\n\n    Raises:\n        KeyError: If 'welcome-message' key is not found in configuration file\n\n    \"\"\"\n    try:\n        if config[\"welcome-message\"]:\n            _LOGGER.info(\"=\" * 40)\n            _LOGGER.info(\n                _(\n                    \"You can customise your opsdroid by modifying \"\n                    \"your configuration.yaml\"\n                )\n            )\n            _LOGGER.info(\n                _(\"Read more at: \" \"http://opsdroid.readthedocs.io/#configuration\")\n            )\n            _LOGGER.info(_(\"Watch the Get Started Videos at: \" \"http://bit.ly/2fnC0Fh\"))\n            _LOGGER.info(\n                _(\n                    \"Install Opsdroid Desktop at: \\n\"\n                    \"https://github.com/opsdroid/opsdroid-desktop/\"\n                    \"releases\"\n                )\n            )\n            _LOGGER.info(\"=\" * 40)\n    except KeyError:\n        _LOGGER.warning(\n            _(\"'welcome-message: true/false' is missing in configuration.yaml\")\n        )\n", "path": "opsdroid/cli/utils.py"}, {"content": "\"\"\"The config subcommand for opsdroid cli.\"\"\"\n\nimport click\n\nfrom opsdroid.cli.utils import edit_files, warn_deprecated_cli_option\nfrom opsdroid.const import EXAMPLE_CONFIG_FILE\n\n\ndef print_example_config(ctx, param, value):\n    \"\"\"[Deprecated] Print out the example config.\"\"\"\n    if not value or ctx.resilient_parsing:\n        return\n    if ctx.command.name == \"cli\":\n        warn_deprecated_cli_option(\n            \"The flag --gen-config has been deprecated. \"\n            \"Please run `opsdroid config gen` instead.\"\n        )\n    with open(EXAMPLE_CONFIG_FILE, \"r\") as conf:\n        click.echo(conf.read())\n    ctx.exit(0)\n\n\n@click.group()\ndef config():\n    \"\"\"Subcommands related to opsdroid configuration.\"\"\"\n\n\n@config.command()\n@click.pass_context\ndef gen(ctx):\n    \"\"\"Print out the example config.\"\"\"\n    print_example_config(ctx, None, True)\n\n\n@config.command()\n@click.pass_context\ndef edit(ctx):\n    \"\"\"Print out the example config.\"\"\"\n    edit_files(ctx, None, \"config\")\n", "path": "opsdroid/cli/config.py"}], "after_files": [{"content": "\"\"\"Utilities for the opsdroid CLI commands.\"\"\"\n\nimport click\nimport gettext\nimport os\nimport logging\nimport subprocess\nimport sys\nimport time\nimport warnings\n\nfrom opsdroid.const import (\n    DEFAULT_LOG_FILENAME,\n    LOCALE_DIR,\n    DEFAULT_LANGUAGE,\n    DEFAULT_CONFIG_PATH,\n)\n\n_LOGGER = logging.getLogger(\"opsdroid\")\n\n\ndef edit_files(ctx, param, value):\n    \"\"\"Open config/log file with favourite editor.\n\n    Args:\n        ctx (:obj:`click.Context`): The current click cli context.\n        param (dict): a dictionary of all parameters pass to the click\n            context when invoking this function as a callback.\n        value (string): the value of this parameter after invocation.\n            It is either \"config\" or \"log\" depending on the program\n            calling this function.\n\n    Returns:\n        int: the exit code. Always returns 0 in this case.\n\n    \"\"\"\n\n    if value == \"config\":\n        file = DEFAULT_CONFIG_PATH\n        if ctx.command.name == \"cli\":\n            warn_deprecated_cli_option(\n                \"The flag -e/--edit-files has been deprecated. \"\n                \"Please run `opsdroid config edit` instead.\"\n            )\n    elif value == \"log\":\n        file = DEFAULT_LOG_FILENAME\n        if ctx.command.name == \"cli\":\n            warn_deprecated_cli_option(\n                \"The flag -l/--view-log has been deprecated. \"\n                \"Please run `opsdroid logs` instead.\"\n            )\n    else:\n        return\n\n    editor = os.environ.get(\"EDITOR\", \"vi\")\n    if editor == \"vi\":\n        click.echo(\n            \"You are about to edit a file in vim. \\n\"\n            \"Read the tutorial on vim at: https://bit.ly/2HRvvrB\"\n        )\n        time.sleep(3)\n\n    subprocess.run([editor, file])\n    ctx.exit(0)\n\n\ndef warn_deprecated_cli_option(text):\n    \"\"\"Warn users that the cli option they have used is deprecated.\"\"\"\n    print(f\"Warning: {text}\")\n    warnings.warn(text, DeprecationWarning)\n\n\ndef configure_lang(config):\n    \"\"\"Configure app language based on user config.\n\n    Args:\n        config: Language Configuration and it uses ISO 639-1 code.\n        for more info https://en.m.wikipedia.org/wiki/List_of_ISO_639-1_codes\n\n\n    \"\"\"\n    lang_code = config.get(\"lang\", DEFAULT_LANGUAGE)\n    if lang_code != DEFAULT_LANGUAGE:\n        lang = gettext.translation(\"opsdroid\", LOCALE_DIR, (lang_code,), fallback=True)\n        lang.install()\n\n\ndef check_dependencies():\n    \"\"\"Check for system dependencies required by opsdroid.\n\n    Returns:\n        int: the exit code. Returns 1 if the Python version installed is\n        below 3.6.\n\n    \"\"\"\n    if sys.version_info.major < 3 or sys.version_info.minor < 6:\n        logging.critical(_(\"Whoops! opsdroid requires python 3.6 or above.\"))\n        sys.exit(1)\n\n\ndef welcome_message(config):\n    \"\"\"Add welcome message if set to true in configuration.\n\n    Args:\n        config: config loaded by Loader\n\n    Raises:\n        KeyError: If 'welcome-message' key is not found in configuration file\n\n    \"\"\"\n    try:\n        if config[\"welcome-message\"]:\n            _LOGGER.info(\"=\" * 40)\n            _LOGGER.info(\n                _(\n                    \"You can customise your opsdroid by modifying \"\n                    \"your configuration.yaml\"\n                )\n            )\n            _LOGGER.info(\n                _(\"Read more at: \" \"http://opsdroid.readthedocs.io/#configuration\")\n            )\n            _LOGGER.info(_(\"Watch the Get Started Videos at: \" \"http://bit.ly/2fnC0Fh\"))\n            _LOGGER.info(\n                _(\n                    \"Install Opsdroid Desktop at: \\n\"\n                    \"https://github.com/opsdroid/opsdroid-desktop/\"\n                    \"releases\"\n                )\n            )\n            _LOGGER.info(\"=\" * 40)\n    except KeyError:\n        _LOGGER.warning(\n            _(\"'welcome-message: true/false' is missing in configuration.yaml\")\n        )\n", "path": "opsdroid/cli/utils.py"}, {"content": "\"\"\"The config subcommand for opsdroid cli.\"\"\"\n\nimport click\n\nfrom opsdroid.cli.utils import edit_files, warn_deprecated_cli_option\nfrom opsdroid.const import EXAMPLE_CONFIG_FILE\n\n\ndef print_example_config(ctx, param, value):\n    \"\"\"[Deprecated] Print out the example config.\n\n    Args:\n        ctx (:obj:`click.Context`): The current click cli context.\n        param (dict): a dictionary of all parameters pass to the click\n            context when invoking this function as a callback.\n        value (bool): the value of this parameter after invocation.\n            Defaults to False, set to True when this flag is called.\n\n    Returns:\n        int: the exit code. Always returns 0 in this case.\n\n    \"\"\"\n    if not value or ctx.resilient_parsing:\n        return\n    if ctx.command.name == \"cli\":\n        warn_deprecated_cli_option(\n            \"The flag --gen-config has been deprecated. \"\n            \"Please run `opsdroid config gen` instead.\"\n        )\n    with open(EXAMPLE_CONFIG_FILE, \"r\") as conf:\n        click.echo(conf.read())\n    ctx.exit(0)\n\n\n@click.group()\ndef config():\n    \"\"\"Subcommands related to opsdroid configuration.\"\"\"\n\n\n@config.command()\n@click.pass_context\ndef gen(ctx):\n    \"\"\"Print out the example config.\"\"\"\n    print_example_config(ctx, None, True)\n\n\n@config.command()\n@click.pass_context\ndef edit(ctx):\n    \"\"\"Print out the example config.\"\"\"\n    edit_files(ctx, None, \"config\")\n", "path": "opsdroid/cli/config.py"}]}