Repository: errbotio/errbot

Issue:
Plugin config through chat cannot contain a line break after the plugin name
### I am...

* [x] Reporting a bug
* [ ] Suggesting a new feature
* [ ] Requesting help with running my bot
* [ ] Requesting help writing plugins
* [ ] Here about something else

### I am running...

* Errbot version: 5.1.1
* OS version: Ubuntu 18.04.1
* Python version: 3.6.6
* Using a virtual environment: yes/no

### Issue description

When running `!plugin config <plugin-name>`, you get a help message:
>Default configuration for this plugin (you can copy and paste this directly as a command):

When configuring a plugin through chat (Slack backend), there can't be a line break after `!plugin config <plugin-name>`. This means that, because it contains a line break, you cannot copy and paste the default configuration template as the message suggests. If you put the configuration dict on the same line, all works fine; if you put the config on new line, you get:
>Unknown plugin or the plugin could not load \<plugin-name\>.

### Steps to reproduce

Configure a plugin from chat using the Slack backend (I'm not sure if applies to all backends), making sure to include a line break between the plugin name and config dict, like:

```
!plugin config foobar
{...}
```

You will get an error: `Unknown plugin or the plugin could not load <plugin-name>`.

Now remove the line break and try configuring again:

```
!plugin config foobar {...}
```

The configuration will succeed.

Discussion:

Solution patch:
diff --git a/CHANGES.rst b/CHANGES.rst
index 0c7da366..905e392f 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -23,6 +23,7 @@ fixes:
 - chore: update errbot-backend-slackv3 version to 0.3.1 (#1725)
 - fix: Close and join thread pools between tests (#1724)
 - fix: type hints (#1698)
+- fix: update plugin config message (#1727)
 
 
 v6.2.0 (2024-01-01)
diff --git a/errbot/core_plugins/plugins.py b/errbot/core_plugins/plugins.py
index 9f09e54e..b2038821 100644
--- a/errbot/core_plugins/plugins.py
+++ b/errbot/core_plugins/plugins.py
@@ -167,7 +167,7 @@ class Plugins(BotPlugin):
 
         if len(args) == 1:
             response = (
-                f"Default configuration for this plugin (you can copy and paste this directly as a command):"
+                f"Default configuration for this plugin (you can copy and paste this directly as a single line command):"
                 f"\n\n```\n{self._bot.prefix}plugin config {plugin_name} {pformat(template_obj)}\n```"
             )
 


Test patch:
diff --git a/tests/commands_test.py b/tests/commands_test.py
index 202349c8..5a111d0d 100644
--- a/tests/commands_test.py
+++ b/tests/commands_test.py
@@ -75,7 +75,7 @@ def test_config_cycle(testbot):
     testbot.push_message("!plugin config Webserver")
     m = testbot.pop_message()
     assert (
-        "Default configuration for this plugin (you can copy and paste this directly as a command)"
+        "Default configuration for this plugin (you can copy and paste this directly as a single line command)"
         in m
     )
     assert "Current configuration" not in m