Skip to content

Commit

Permalink
plugins:Add plugin for saying no to 'sir'
Browse files Browse the repository at this point in the history
we have added a plugin and related test
to prevent any contributor from saying sir.

Closes #337
  • Loading branch information
AkshJain99 committed Mar 9, 2019
1 parent 1de93b6 commit 7a7de3d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
11 changes: 11 additions & 0 deletions plugins/no_sir.plug
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]
18 changes: 18 additions & 0 deletions plugins/no_sir.py
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]
)
)
11 changes: 11 additions & 0 deletions tests/no_sir_test.py
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()

0 comments on commit 7a7de3d

Please sign in to comment.