commit adf6e1d4cd75c164145c9c0b0fefd323e889b9bb Author: Adam Piontek Date: Sun Aug 26 11:50:25 2018 -0400 first commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..2ff2d74 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +# http://EditorConfig.org + +root = true + +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 4 +charset = utf-8 + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6aceb9d --- /dev/null +++ b/.gitignore @@ -0,0 +1,106 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# dotenv +.env + +# virtualenv +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5feec29 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Adam Piontek + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f8a765b --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# Catto + +This is a plugin for [Errbot](http://errbot.io/) that generates random hunky beefy hero names, in the spirit of a running joke in the "[Space Mutiny](http://mst3k.wikia.com/wiki/MST3K_820_-_Space_Mutiny)" episode of [Mystery Science Theater 3000](https://www.mst3k.com/) + +## Usage: +- `!myhero` Generates a hero name + +Alternately, this plugin listens for "hero" or "space mutiny" in chatrooms and responds by blurting out a hero name. diff --git a/myhero.plug b/myhero.plug new file mode 100644 index 0000000..05e4686 --- /dev/null +++ b/myhero.plug @@ -0,0 +1,9 @@ +[Core] +name = MyHero +module = myhero + +[Documentation] +description = Generates hero hunky names in the spirit of MST3k's running joke in their Space Mutiny episode + +[Python] +version = 3 diff --git a/myhero.py b/myhero.py new file mode 100644 index 0000000..069ad26 --- /dev/null +++ b/myhero.py @@ -0,0 +1,211 @@ +import re +import random +from errbot import BotPlugin, botcmd, re_botcmd + +CONFIG_TEMPLATE = { + 'HERO_NAMES_GROUP_1': ['Beat', + 'Big', + 'Blast', + 'Bold', + 'Bolt', + 'Brick', + 'Buck', + 'Buff', + 'Butch', + 'Dean', + 'Crud', + 'Crunch', + 'Burt', + 'Dirk', + 'Fist', + 'Flint', + 'Fridge', + 'Gristle', + 'Grind', + 'Hack', + 'Colt', + 'Major', + 'Fury', + 'Lump', + 'Punch', + 'Duke', + 'Blaze', + 'Blade', + 'Red', + 'Punt', + 'Reef', + 'Roll', + 'Rip', + 'Grim', + 'Jab', + 'Slab', + 'Scream', + 'Coal', + 'Slate', + 'Smash', + 'Fire', + 'Smoke', + 'Flash', + 'Steel', + 'Captain', + 'Splint', + 'Stump', + 'Rage', + 'Thick', + 'Touch', + 'Trunk', + 'Whip', + 'Zap'], + 'HERO_NAMES_GROUP_2': ['Punch', + 'Large', + 'Hard', + 'Thick', + 'Big', + 'Vander', + 'Crank', + 'Plank', + 'Drink', + 'Doom', + 'Dead', + 'Pound', + 'Knuckle', + 'Bone', + 'Savage', + 'Butt', + 'Fire', + 'Razor', + 'Rock', + 'Iron', + 'Grunt', + 'Grim', + 'Mad', + 'Thorn', + 'Blow', + 'Beef', + 'Wrestle', + 'Terror', + 'Side', + 'Rubble', + 'Speed', + 'Lightning', + 'Grit', + 'Slap', + 'Blast', + 'Fizzle', + 'Scar', + 'Granite', + 'Steak', + 'Tazer', + 'Snarl', + 'Bulk', + 'Dagger', + 'Squat', + 'SaberFist', + 'Slab', + 'Lamp', + 'Cram', + 'Cannon', + 'Tussle', + 'Man', + 'Chest', + 'Gut', + 'Rumble', + 'Fury', + 'Chunk', + 'Wreck', + 'Nail', + 'Run', + 'Rust', + 'Slam', + 'Slag', + 'Thunder', + 'Hazzard'], + 'HERO_NAMES_GROUP_3': ['Beef', + 'Huge', + 'Cheese', + 'Neck', + 'Flank', + 'Meat', + 'Delt', + 'Abs', + 'Heart', + 'Chest', + 'Roar', + 'Lots', + 'Back', + 'Nail', + 'Lift', + 'Fury', + 'Meal', + 'Stalk', + 'Steak', + 'Pec', + 'Bone', + 'Stag', + 'Body', + 'Fist', + 'Broth', + 'Groin', + 'Shot', + 'Cake', + 'Iron', + 'Chunk', + 'Face', + 'Head', + 'Thrust', + 'Crunch', + 'Rock', + 'Wad', + 'Jaw', + 'Muscle', + 'Hair', + 'Knob', + 'man', + 'Fast', + 'Rod', + 'Stone', + 'Cheek', + 'Lash'] + } + +class MyHero(BotPlugin): + """Generates hero hunky names in the spirit of MST3k's running joke in their Space Mutiny episode""" + min_err_version = '3.0.0' # Optional, but recommended + + HERO_NAMES_PREFIXES = ['Mc','von '], + + def get_configuration_template(self): + return CONFIG_TEMPLATE + + def configure(self, configuration): + if configuration is not None and configuration != {}: + config = dict(chain(CONFIG_TEMPLATE.items(), + configuration.items())) + else: + config = CONFIG_TEMPLATE + super(MyHero, self).configure(config) + + def get_prefix(self): + if not (random.randrange(0, 7) == 0): return "" + return self.HERO_NAMES_PREFIXES[(random.randrange(0, 3) == 2)] + + def get_hero_name(self): + # every once in a while, thrown one of these complete in-jokes + if (random.randrange(0,100) == 50): return "Bob Johnson" + if (random.randrange(0,250) == 50): return "Rowsdower" + return "{n1} {p}{n2}{n3}".format( + n1=random.choice(self.config['HERO_NAMES_GROUP_1']), + p=self.get_prefix(), + n2=random.choice(self.config['HERO_NAMES_GROUP_2']), + n3=random.choice(self.config['HERO_NAMES_GROUP_3']) + ) + + @botcmd() + def myhero(self, msg, args): + """Generates a special hunky hero name for you""" + return self.get_hero_name() + + @re_botcmd(pattern=r"space mutiny|hero", prefixed=False, flags=re.IGNORECASE) + def listen_for_talk_of_heroes(self, msg, match): + """Talk of heroes prompts a Space Hero Name...""" + return self.get_hero_name()