first commit

This commit is contained in:
Adam Piontek 2018-08-26 11:50:25 -04:00
commit adf6e1d4cd
6 changed files with 369 additions and 0 deletions

14
.editorconfig Normal file
View file

@ -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

106
.gitignore vendored Normal file
View file

@ -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/

21
LICENSE Normal file
View file

@ -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.

8
README.md Normal file
View file

@ -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.

9
myhero.plug Normal file
View file

@ -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

211
myhero.py Normal file
View file

@ -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()