Skip to content

Commit 92e9374

Browse files
author
wimo7083
committed
gotta keep em in check
1 parent 844f97f commit 92e9374

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

pybot/endpoints/slack/messages.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ def create_endpoints(plugin):
1313
plugin.on_message(".*", message_changed, subtype="message_changed")
1414
plugin.on_message(".*", message_deleted, subtype="message_deleted")
1515
plugin.on_message(".*\!tech", tech_tips)
16-
16+
plugin.on_message(".*\<\!here\>", here_bad)
17+
plugin.on_message(".*\<\!channel\>", here_bad)
18+
plugin.on_message(".*\@here", here_bad)
19+
plugin.on_message(".*\@channel", here_bad)
20+
plugin.on_message(".*@here", here_bad)
21+
plugin.on_message(".*@channel", here_bad)
22+
plugin.on_message(".*codervets", not_named)
1723

1824
def not_bot_message(event: Message):
1925
return 'message' not in event or 'subtype' not in event['message'] or event['message']['subtype'] != 'bot_message'
@@ -22,6 +28,13 @@ def not_bot_message(event: Message):
2228
def not_bot_delete(event: Message):
2329
return 'previous_message' not in event or 'bot_id' not in event['previous_message']
2430

31+
async def not_named(event: Message, app: SirBot):
32+
response = {'channel': event['channel'], 'text': f'<@{event["user"]}> - How dare you utter the Dark Lord\'s name'}
33+
await app.plugins["slack"].api.query(methods.CHAT_POST_MESSAGE, data=response )
34+
35+
async def here_bad(event: Message, app: SirBot):
36+
response = {'channel': event['channel'], 'text': f'<@{event["user"]}> - you are a very bad person for using that command'}
37+
await app.plugins["slack"].api.query(methods.CHAT_POST_MESSAGE, data=response )
2538

2639
async def tech_tips(event: Message, app: SirBot):
2740
logger.info(

0 commit comments

Comments
 (0)