-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plugins/explain.py: Added explanation for do not ask to ask
This patch adds response in case a user asks abrupt question. Closes #389
- Loading branch information
1 parent
340bf99
commit a0b1946
Showing
7 changed files
with
51 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[Core] | ||
name = deprecate_bot_prefixes | ||
module = deprecate_bot_prefixes | ||
|
||
[Documentation] | ||
description = A callback for every message that starts with depecrated prefix, hence, leaving a deprecation notice | ||
|
||
[Python] | ||
version = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from errbot import BotPlugin | ||
|
||
|
||
class DeprecateBotPrefixes(BotPlugin): | ||
""" | ||
A callback for every message that starts with depecrated prefix, hence, | ||
leaving a deprecation notice | ||
""" | ||
|
||
def callback_message(self, msg): | ||
""" | ||
Notify the user issuing the command that use deprecated prefix. | ||
""" | ||
|
||
for deprecated_prefix in self.bot_config.BOT_DEPRECATED_PREFIXES: | ||
if msg.body.startswith(deprecated_prefix): | ||
self.send( | ||
msg.frm, | ||
"@{} usage of {} has been deprecated, please use {} " | ||
"from now on.".format(msg.frm.nick, deprecated_prefix, | ||
self.bot_config.BOT_PREFIX) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
pytest_plugins = ['errbot.backends.test'] | ||
extra_plugin_dir = 'plugins' | ||
|
||
def test_deprecated_prefixes_other(testbot): | ||
testbot.bot_config.BOT_DEPRECATED_PREFIXES = ('oldbot', 'deprecatedbot') | ||
testbot.assertCommand('oldbot just a test', 'has been deprecated') | ||
testbot.assertCommand('deprecatedbot just a test', 'has been deprecated') |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.