Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@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
@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
@thing.presenters.register(set(["name"]), order=-10)
def present(thing, context):
return u"{name}".format(name = ircutils.bold(thing.name))
@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
@presenters.register(set(["github"]))
def present(thing, context):
github = thing.facets["github"]
text = u"http://github.com/{0}".format(github.username)
return text
@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