mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-26 04:51:09 -05:00
Initial commit.
This commit is contained in:
parent
69b956580d
commit
8c6240fdb2
@ -1,4 +1,4 @@
|
||||
# NBA
|
||||
# NBAScores
|
||||
|
||||
A [Limnoria](https://github.com/ProgVal/Limnoria) plugin to retrieve NBA scores from NBA.com.
|
||||
|
@ -29,7 +29,7 @@
|
||||
###
|
||||
|
||||
"""
|
||||
NBA: Get scores from NBA.com
|
||||
NBAScores: Get scores from NBA.com
|
||||
"""
|
||||
|
||||
import supybot
|
||||
@ -37,17 +37,25 @@ import supybot.world as world
|
||||
|
||||
# Use this for the version of this plugin. You may wish to put a CVS keyword
|
||||
# in here if you're keeping the plugin in CVS or some similar system.
|
||||
__version__ = "0.1"
|
||||
__version__ = ""
|
||||
|
||||
# XXX Replace this with an appropriate author or supybot.Author instance.
|
||||
__author__ = supybot.authors.unknown
|
||||
__author__ = supybot.Author('Santiago Gil', 'santigl', '')
|
||||
__maintainer__ = getattr(supybot.authors, 'oddluck',
|
||||
supybot.Author('oddluck', 'oddluck', 'oddluck@riseup.net'))
|
||||
|
||||
# This is a dictionary mapping supybot.Author instances to lists of
|
||||
# contributions.
|
||||
__contributors__ = {}
|
||||
if not hasattr(supybot.authors, 'cottongin') or not hasattr(supybot.authors, 'santigl'):
|
||||
supybot.authors.cottongin = supybot.Author('cottongin', 'cottongin',
|
||||
'cottongin@cottongin.club')
|
||||
supybot.authors.santigl = supybot.Author('Santiago Gil', 'santigl', '')
|
||||
|
||||
__contributors__ = {supybot.authors.santigl: ['original plugin base'],
|
||||
supybot.authors.cottongin: ['code enhancement']}
|
||||
|
||||
# This is a url where the most recent plugin package can be downloaded.
|
||||
__url__ = 'https://github.com/santigl/limnoria-nba'
|
||||
__url__ = 'https://github.com/oddluck/limnoria-plugins/'
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
@ -32,7 +32,7 @@ import supybot.conf as conf
|
||||
import supybot.registry as registry
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('NBA')
|
||||
_ = PluginInternationalization('NBAScores')
|
||||
except:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
@ -45,10 +45,10 @@ def configure(advanced):
|
||||
# user or not. You should effect your configuration by manipulating the
|
||||
# registry as appropriate.
|
||||
from supybot.questions import expect, anything, something, yn
|
||||
conf.registerPlugin('NBA', True)
|
||||
conf.registerPlugin('NBAScores', True)
|
||||
|
||||
|
||||
NBA = conf.registerPlugin('NBA')
|
||||
NBA = conf.registerPlugin('NBAScores')
|
||||
# This is where your configuration variables (if any) should go. For example:
|
||||
# conf.registerGlobalValue(NBA, 'someConfigVariableName',
|
||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
@ -27,7 +27,7 @@ import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('NBA')
|
||||
_ = PluginInternationalization('NBAScores')
|
||||
except ImportError:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
@ -40,7 +40,7 @@ import json
|
||||
import pytz
|
||||
from xml.etree import ElementTree
|
||||
|
||||
class NBA(callbacks.Plugin):
|
||||
class NBAScores(callbacks.Plugin):
|
||||
"""Get scores from NBA.com."""
|
||||
|
||||
_ENDPOINT_BASE_URL = 'https://data.nba.net'
|
||||
@ -63,7 +63,7 @@ class NBA(callbacks.Plugin):
|
||||
'BKN', 'POR', 'GSW', 'LAC', 'WAS'))
|
||||
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(NBA, self)
|
||||
self.__parent = super(NBAScores, self)
|
||||
self.__parent.__init__(irc)
|
||||
|
||||
self._http = httplib2.Http('.cache')
|
||||
@ -131,7 +131,7 @@ class NBA(callbacks.Plugin):
|
||||
nba = wrap(nba, [optional('somethingWithoutSpaces'),
|
||||
optional('somethingWithoutSpaces')])
|
||||
|
||||
def tv(self, irc, msg, args, team):
|
||||
def nbatv(self, irc, msg, args, team):
|
||||
"""[<TTT>]
|
||||
|
||||
Given a team, if there is a game scheduled for today,
|
||||
@ -154,9 +154,9 @@ class NBA(callbacks.Plugin):
|
||||
broadcasters_string = self._broadcastersToString(game['tv_broadcasters'])
|
||||
irc.reply('{} on: {}'.format(game_string, broadcasters_string))
|
||||
|
||||
tv = wrap(tv, ['somethingWithoutSpaces'])
|
||||
nbatv = wrap(nbatv, ['somethingWithoutSpaces'])
|
||||
|
||||
def next(self, irc, msg, args, n, team, team2):
|
||||
def nbanext(self, irc, msg, args, n, team, team2):
|
||||
"""[<n>] <TTT> [<TTT>]
|
||||
|
||||
Get the next <n> games (1 by default; max. 10) for a given team
|
||||
@ -205,11 +205,11 @@ class NBA(callbacks.Plugin):
|
||||
irc.reply(self._upcomingGameToString(game))
|
||||
|
||||
|
||||
next = wrap(next, [optional('positiveInt'),
|
||||
nbanext = wrap(nbanext, [optional('positiveInt'),
|
||||
'somethingWithoutSpaces',
|
||||
optional('somethingWithoutSpaces')])
|
||||
|
||||
def last(self, irc, msg, args, n, team, team2):
|
||||
def nbalast(self, irc, msg, args, n, team, team2):
|
||||
"""[<n>] <TTT> [<TTT>]
|
||||
|
||||
Get the last <n> games (1 by default; max. 10) for a given team
|
||||
@ -259,7 +259,7 @@ class NBA(callbacks.Plugin):
|
||||
irc.reply(self._pastGameToString(game))
|
||||
|
||||
|
||||
last = wrap(last, [optional('positiveInt'),
|
||||
nbalast = wrap(nbalast, [optional('positiveInt'),
|
||||
'somethingWithoutSpaces',
|
||||
optional('somethingWithoutSpaces')])
|
||||
|
||||
@ -814,6 +814,6 @@ class NBA(callbacks.Plugin):
|
||||
return url
|
||||
|
||||
|
||||
Class = NBA
|
||||
Class = NBAScores
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
1
NBAScores/requirements.txt
Normal file
1
NBAScores/requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
pytz
|
@ -32,7 +32,7 @@ from supybot.test import *
|
||||
|
||||
|
||||
class NBATestCase(PluginTestCase):
|
||||
plugins = ('NBA',)
|
||||
plugins = ('NBAScores',)
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
@ -1 +0,0 @@
|
||||
# Stub so local is a module, used for third-party modules
|
Loading…
x
Reference in New Issue
Block a user