Created
October 4, 2015 22:31
-
-
Save gbin/6cbce1ad86379a02eb10 to your computer and use it in GitHub Desktop.
Errbot recipes: Arguments parsing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from errbot import BotPlugin, botcmd | |
from pyfiglet import Figlet, FigletFont | |
class AsciiArt(BotPlugin): | |
""" Ascii Art related commands. """ | |
@botcmd(split_args_with=' ') | |
def big(self, mess, args): | |
""" Generates a big version of what you want to say.""" | |
fonts = FigletFont.getFonts() | |
if len(args) <= 1 or args[0] not in fonts: | |
return ('Syntax: `!big font message` with *font* in:\n`' + ', '.join(fonts) + '`') | |
font = args[0] | |
message = ' '.join(args[1:]) | |
return '```\n' + Figlet(font=font).renderText(message) + '\n```' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment