How to use the karmabot.thing.presenters.register function in karmabot

To help you get started, we’ve selected a few karmabot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chromakode / karmabot / karmabot / extensions / reddit.py View on Github external
@thing.presenters.register(set(["redditor"]))
def present(thing, context):
    info = thing.facets["redditor"].get_info()
    text = u"http://reddit.com/user/{name} ({link_karma}/{comment_karma})".format(
        name=info["name"],
        link_karma=info["link_karma"],
        comment_karma=info["comment_karma"])
    return text
github chromakode / karmabot / karmabot / facets / bot.py View on Github external
@thing.presenters.register(set(["karmabot", "name", "karma", "description"]))
def present(thing, context):
    text = u"{name}[v{version}]({karma}): {descriptions} ({things} things)".format(
        name         = thing.describe(context, facets=set(["name"])),
        karma        = thing.facets["karma"].karma,
        descriptions = thing.facets["description"].present(),
        version      = karmabot.VERSION,
        things       = context.bot.things.count
    )
    return text
github chromakode / karmabot / karmabot / facets / name.py View on Github external
@thing.presenters.register(set(["name"]), order=-10)
def present(thing, context):
    return u"{name}".format(name = ircutils.bold(thing.name))
github chromakode / karmabot / karmabot / extensions / twitter.py View on Github external
@thing.presenters.register(set(["twitter"]))
def present(thing, context):
    twitter = thing.facets["twitter"]
    text = u"@{twitter_name}: \"{tweet}\"".format(
        twitter_name = twitter.username,
        tweet        = twitter.get_last_tweet())
    return text
github chromakode / karmabot / karmabot / extensions / github.py View on Github external
@presenters.register(set(["github"]))
def present(thing, context):
    github = thing.facets["github"]
    text = u"http://github.com/{0}".format(github.username)
    return text
github chromakode / karmabot / karmabot / extensions / twitter.py View on Github external
@thing.presenters.register(set(["name", "karma", "description", "twitter"]))
def present(thing, context):
    twitter = thing.facets["twitter"]
    name_display = thing.describe(context, facets=set(["name", "karma"]))
    text = u"{name} \"{tweet}\"{descriptions}".format(
        name         = name_display,
        tweet        = twitter.get_last_tweet(),
        descriptions = ": " + thing.facets["description"].present() 
                       if thing.facets["description"].descriptions else "")
    return text