mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-24 11:42:51 +01:00
games: add service description & featured commands
This commit is contained in:
parent
7210161ece
commit
b2b4f33fe8
@ -9,7 +9,9 @@ from xml.etree import ElementTree
|
|||||||
from pylinkirc import utils
|
from pylinkirc import utils
|
||||||
from pylinkirc.log import log
|
from pylinkirc.log import log
|
||||||
|
|
||||||
gameclient = utils.registerService("Games", manipulatable=True)
|
mydesc = "The \x02Games\x02 plugin provides simple games for IRC."
|
||||||
|
|
||||||
|
gameclient = utils.registerService("Games", manipulatable=True, desc=mydesc)
|
||||||
reply = gameclient.reply # TODO find a better syntax for ServiceBot.reply()
|
reply = gameclient.reply # TODO find a better syntax for ServiceBot.reply()
|
||||||
|
|
||||||
# commands
|
# commands
|
||||||
@ -42,7 +44,7 @@ def dice(irc, source, args):
|
|||||||
reply(irc, s)
|
reply(irc, s)
|
||||||
|
|
||||||
gameclient.add_cmd(dice, 'd')
|
gameclient.add_cmd(dice, 'd')
|
||||||
gameclient.add_cmd(dice)
|
gameclient.add_cmd(dice, featured=True)
|
||||||
|
|
||||||
eightball_responses = ["It is certain.",
|
eightball_responses = ["It is certain.",
|
||||||
"It is decidedly so.",
|
"It is decidedly so.",
|
||||||
@ -70,15 +72,14 @@ def eightball(irc, source, args):
|
|||||||
Asks the Magic 8-ball a question.
|
Asks the Magic 8-ball a question.
|
||||||
"""
|
"""
|
||||||
reply(irc, random.choice(eightball_responses))
|
reply(irc, random.choice(eightball_responses))
|
||||||
gameclient.add_cmd(eightball)
|
gameclient.add_cmd(eightball, featured=True)
|
||||||
gameclient.add_cmd(eightball, '8ball')
|
gameclient.add_cmd(eightball, '8ball')
|
||||||
gameclient.add_cmd(eightball, '8b')
|
gameclient.add_cmd(eightball, '8b')
|
||||||
|
|
||||||
def fml(irc, source, args):
|
def fml(irc, source, args):
|
||||||
"""[<id>]
|
"""[<id>]
|
||||||
|
|
||||||
Displays an entry from fmylife.com. If <id>
|
Displays an entry from fmylife.com. If <id> is not given, fetch a random entry from the API."""
|
||||||
is not given, fetch a random entry from the API."""
|
|
||||||
try:
|
try:
|
||||||
query = args[0]
|
query = args[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
@ -119,7 +120,7 @@ def fml(irc, source, args):
|
|||||||
s = '\x02#%s [%s]\x02: %s - %s \x02<\x0311%s\x03>\x02' % \
|
s = '\x02#%s [%s]\x02: %s - %s \x02<\x0311%s\x03>\x02' % \
|
||||||
(fmlid, category, text, votes, url)
|
(fmlid, category, text, votes, url)
|
||||||
reply(irc, s)
|
reply(irc, s)
|
||||||
gameclient.add_cmd(fml)
|
gameclient.add_cmd(fml, featured=True)
|
||||||
|
|
||||||
def die(irc):
|
def die(irc):
|
||||||
utils.unregisterService('games')
|
utils.unregisterService('games')
|
||||||
|
Loading…
Reference in New Issue
Block a user