facts: show the source of facts, if desired
This commit is contained in:
parent
fe3a5ede3d
commit
934f83b734
@ -2,6 +2,8 @@ from __future__ import unicode_literals
|
||||
|
||||
import logging
|
||||
|
||||
from irc.client import NickMask
|
||||
|
||||
from ircbot.lib import Plugin
|
||||
from facts.models import Fact
|
||||
|
||||
@ -38,7 +40,13 @@ class Facts(Plugin):
|
||||
|
||||
fact = Fact.objects.random_fact(category, regex)
|
||||
if fact:
|
||||
return self.bot.reply(event, fact.fact)
|
||||
if fact.category.show_source:
|
||||
nick = NickMask(fact.nickmask).nick
|
||||
msg = "{0:s} ({1:s})".format(fact.fact, nick)
|
||||
else:
|
||||
msg = fact.fact
|
||||
|
||||
return self.bot.reply(event, msg)
|
||||
|
||||
|
||||
plugin = Facts
|
||||
|
Loading…
Reference in New Issue
Block a user