Skip to content
Snippets Groups Projects
Commit b0a8f0ff authored by Bruce Cowan's avatar Bruce Cowan
Browse files

New plugin: xkcd substitutions

parents
No related branches found
No related tags found
No related merge requests found
__pycache__/
[Core]
name = XKCD
module = xkcd
[Documentation]
description = XKCD word substitutions
[Python]
version = 3
xkcd.py 0 → 100644
# Copyright © 2018 Bruce Cowan <bruce@bcowan.eu>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import re
from errbot import BotPlugin, re_botcmd
class Xkcd(BotPlugin):
"""XKCD word subsitutions."""
@re_botcmd(pattern=r'\ballegedly\b', prefixed=False, flags=re.IGNORECASE)
def on_allegedly(self, message, match):
rep = message.body.replace("allegedly", "kinda probably")
return "Did you mean: {}".format(rep)
@re_botcmd(pattern=r'\bcars?\b', prefixed=False, flags=re.IGNORECASE)
def on_car(self, message, match):
rep = message.body.replace("car", "cat")
return "Did you mean: {}".format(rep)
@re_botcmd(pattern=r'\bclouds?\b', prefixed=False, flags=re.IGNORECASE)
def on_cloud(self, message, match):
rep = message.body.replace("cloud", "butt")
return "Did you mean: {}".format(rep)
@re_botcmd(pattern=r'\belections?\b', prefixed=False, flags=re.IGNORECASE)
def on_election(self, message, match):
rep = message.body.replace("election", "eating contest")
return "Did you mean: {}".format(rep)
@re_botcmd(pattern=r'\bforces?\b', prefixed=False, flags=re.IGNORECASE)
def on_force(self, message, match):
rep = message.body.replace("force", "horse")
return "Did you mean: {}".format(rep)
@re_botcmd(pattern=r'\bkeyboards?\b', prefixed=False, flags=re.IGNORECASE)
def on_keyboard(self, message, match):
rep = message.body.replace("keyboard", "leopard")
return "Did you mean: {}".format(rep)
@re_botcmd(pattern=r'\bspace\b', prefixed=False, flags=re.IGNORECASE)
def on_space(self, message, match):
rep = message.body.replace("space", "spaaaaaace")
return "Did you mean: {}".format(rep)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment