-
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:Add plugin for saying no to 'sir'
we have added a plugin and related test to prevent any contributor from saying sir. Closes #337
- Loading branch information
1 parent
1de93b6
commit 7a7de3d
Showing
3 changed files
with
40 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Core] | ||
name = no_sir | ||
module = no_sir | ||
|
||
[Documentation] | ||
description = Tell people to not use 'sir' when they do. | ||
|
||
[Python] | ||
version = 3 | ||
|
||
[Errbot] |
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,18 @@ | ||
import re | ||
|
||
from errbot import BotPlugin, re_botcmd | ||
|
||
|
||
class no_sir(BotPlugin): | ||
""" | ||
Do not use sir | ||
""" | ||
def callback_message(self, msg): | ||
emots = [':D'] | ||
if match_sir: | ||
self.send( | ||
msg.frm, | ||
'@{}, Do not use sir in your conversation. {}'.format( | ||
msg.frm.nick, emots[0] | ||
) | ||
) |
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,11 @@ | ||
import os | ||
import no_sir | ||
from errbot.backends.test import testbot | ||
|
||
|
||
class Test_no_sir(object): | ||
extra_plugin_dir = '.' | ||
|
||
def test_no_sir(self, testbot): | ||
testbot.push_message('sir') | ||
assert 'Do not use sir in your conversation' in testbot.pop_message() |