Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Emoji in Bot commands #1

Closed
lchi opened this issue Jun 1, 2015 · 3 comments
Closed

Add support for Emoji in Bot commands #1

lchi opened this issue Jun 1, 2015 · 3 comments
Assignees

Comments

@lchi
Copy link
Contributor

lchi commented Jun 1, 2015

I'd like to add support for emoji in bot commands. This would allow bots to receive messages likes bot: :scissors:.

One idea for implementation is to have the command decorator take in optional arguments, so you could write the following:

@Bot.command(name=':scissors:')
def scissors():
     ....

Thoughts?

@simon-weber
Copy link
Contributor

Sounds reasonable to me 👍

@simon-weber
Copy link
Contributor

Probably want to decorate the decorator to keep no-arg support. This is what we use in vcrutils:

def dual_decorator(func):
    """This is a decorator that converts a paramaterized decorator for no-param use.
    source: http://stackoverflow.com/questions/3888158
    """

    @wraps(func)
    def inner(*args, **kw):
        if ((len(args) == 1 and not kw and callable(args[0])
             and not (type(args[0]) == type and issubclass(args[0], BaseException)))):
            return func()(args[0])
        else:
            return func(*args, **kw)
    return inner

@lchi
Copy link
Contributor Author

lchi commented Jun 1, 2015

Cool, I'll post a PR when ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants