-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugins:Add plugin for saying no to 'sir' #651
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import re | ||
from errbot import BotPlugin | ||
|
||
|
||
class no_sir(BotPlugin): | ||
""" | ||
Do not use sir | ||
""" | ||
|
||
def callback_message(self, msg): | ||
emots = [':D'] | ||
match_sir = re.search(r'\bsir\b', '\bSir\b', msg.body) | ||
if match_sir: | ||
self.send( | ||
msg.frm, | ||
'@{}, Do not use sir in your conversation. {}'.format( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @KVGarg Definitely if you have any suggestions you could have written here :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we can frame a message somewhat like this
Something like this the message can be framed! |
||
msg.frm.nick | ||
|
||
) | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import plugins.no_sir | ||
|
||
|
||
class Test_no_sir(object): | ||
extra_plugin_dir = '.' | ||
|
||
def test_no_sir(self, testbot): | ||
testbot.push_message(r'\bsir\b', '\bSir\b', msg.body) | ||
assert 'Do not use sir in your conversation' in testbot.pop_message() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The assert statement does not match the bot output message, the test would always throw an assertion error because of the missing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sladyn98 it's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @meetmangukiya Yeah your right,so it would pass, but it would be better to keep the outputs same although it doesnt matter :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class name not starting with caps 😱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats by mistake @meetmangukiya i will correct all the issues now in this pr