mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-25 12:31:07 -05:00
Renames and fixes for sports plugins.
This commit is contained in:
parent
45e988b9ce
commit
06734d17cb
1
CBB/README.md
Normal file
1
CBB/README.md
Normal file
@ -0,0 +1 @@
|
||||
Fetches NCAA Men's College Basketball scores
|
@ -6,7 +6,7 @@
|
||||
###
|
||||
|
||||
"""
|
||||
CFBScores: Fetches College Football scores
|
||||
CBB: Fetches College Basketball scores
|
||||
"""
|
||||
|
||||
import sys
|
@ -8,7 +8,7 @@
|
||||
from supybot import conf, registry
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('NewOdds')
|
||||
_ = PluginInternationalization('CBB')
|
||||
except:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
@ -21,12 +21,12 @@ 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('NewOdds', True)
|
||||
conf.registerPlugin('CBB', True)
|
||||
|
||||
|
||||
NewOdds = conf.registerPlugin('NewOdds')
|
||||
CBB = conf.registerPlugin('CBB')
|
||||
# This is where your configuration variables (if any) should go. For example:
|
||||
# conf.registerGlobalValue(NewOdds, 'someConfigVariableName',
|
||||
# conf.registerGlobalValue(CBB, 'someConfigVariableName',
|
||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
||||
|
||||
|
@ -14,7 +14,7 @@ from supybot import utils, plugins, ircutils, callbacks, conf, schedule, ircmsgs
|
||||
from supybot.commands import *
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('CBBScores')
|
||||
_ = PluginInternationalization('CBB')
|
||||
except ImportError:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
@ -24,52 +24,35 @@ SCOREBOARD = ('http://site.api.espn.com/apis/site/v2/sports/basketball/'
|
||||
'mens-college-basketball/scoreboard?lang=en®ion=us'
|
||||
'&calendartype=blacklist&limit=300&groups=50&dates={date}')
|
||||
|
||||
class CBBScores(callbacks.Plugin):
|
||||
class CBB(callbacks.Plugin):
|
||||
"""Fetches College Basketball scores"""
|
||||
threaded = True
|
||||
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(CBBScores, self)
|
||||
self.__parent = super(CBB, self)
|
||||
self.__parent.__init__(irc)
|
||||
#self.filename = conf.supybot.directories.data.dirize('CBBScores.db')
|
||||
def checkcbbscores():
|
||||
self.SCORES = self._checkscores()
|
||||
self.SCORES = self._checkscores()
|
||||
try: # check scores.
|
||||
schedule.addPeriodicEvent(checkcbbscores, 20,
|
||||
now=False, name='checkcbbscores')
|
||||
except AssertionError:
|
||||
try:
|
||||
schedule.removeEvent('checkcbbscores')
|
||||
except KeyError:
|
||||
pass
|
||||
schedule.addPeriodicEvent(checkcbbscores, 20,
|
||||
now=False, name='checkcbbscores')
|
||||
|
||||
def die(self):
|
||||
try:
|
||||
schedule.removeEvent('checkcbbscores')
|
||||
except KeyError:
|
||||
pass
|
||||
self.__parent.die()
|
||||
|
||||
####################
|
||||
# PUBLIC FUNCTIONS #
|
||||
####################
|
||||
|
||||
@wrap([getopts({'date': 'somethingWithoutSpaces'}),
|
||||
@wrap([getopts({'date': 'somethingWithoutSpaces', 'all':''}),
|
||||
optional('text')])
|
||||
def cbb(self, irc, msg, args, options, team=None):
|
||||
"""(--date YYYYMMDD) (team)
|
||||
Fetches college basketball scores for given date and/or team.
|
||||
Defaults to today and all teams if no input given.
|
||||
Ex: --date 20181117 MICH
|
||||
"""[--date] [--all] [team]
|
||||
Fetches college basketball scores/schedule for given date and/or team.
|
||||
Defaults to today and top 25 teams (if playing, otherwise shows all games).
|
||||
Use --all to show results for all teams.
|
||||
"""
|
||||
channel = msg.args[0]
|
||||
if channel == irc.nick:
|
||||
channel = msg.nick
|
||||
options = dict(options)
|
||||
date = options.get('date')
|
||||
if 'all' in options:
|
||||
all = True
|
||||
else:
|
||||
all = False
|
||||
if date:
|
||||
if date.lower() in ['yesterday', 'tomorrow', 'today']:
|
||||
if date.lower() in 'yesterday':
|
||||
@ -84,16 +67,26 @@ class CBBScores(callbacks.Plugin):
|
||||
except:
|
||||
irc.reply('Invalid date format')
|
||||
return
|
||||
SCORES = self._checkscores(date)
|
||||
if date not in SCORES:
|
||||
niceDate = pendulum.parse(date)
|
||||
niceDate = "{0}/{1}/{2}".format(niceDate.month, niceDate.day, niceDate.year)
|
||||
irc.reply('No games found for {}.'.format(date))
|
||||
else:
|
||||
date = pendulum.now().format('YYYYMMDD')
|
||||
today = pendulum.now().format('YYYYMMDD')
|
||||
yesterday = pendulum.yesterday().format('YYYYMMDD')
|
||||
tomorrow = date = pendulum.tomorrow().format('YYYYMMDD')
|
||||
SCORES = self._checkscores()
|
||||
if today in SCORES:
|
||||
date = today
|
||||
elif yesterday in SCORES:
|
||||
date = yesterday
|
||||
elif tomorrow in SCORES:
|
||||
date = tomorrow
|
||||
else:
|
||||
irc.reply('No games found.')
|
||||
return
|
||||
|
||||
if date not in self.SCORES:
|
||||
# fetch another day
|
||||
print('date not in scores db')
|
||||
SCORES = self._checkscores(cdate=date)
|
||||
else:
|
||||
SCORES = self.SCORES
|
||||
|
||||
if team:
|
||||
if len(team) > 2:
|
||||
reply = []
|
||||
@ -123,8 +116,16 @@ class CBBScores(callbacks.Plugin):
|
||||
irc.reply('ERROR: search string too short')
|
||||
return
|
||||
else:
|
||||
# all teams
|
||||
irc.sendMsg(ircmsgs.privmsg(channel, ' | '.join(value['short'] for item,value in SCORES[date].items() if value['top25'])))
|
||||
niceDate = pendulum.parse(date)
|
||||
niceDate = "{0}/{1}/{2}".format(niceDate.month, niceDate.day, niceDate.year)
|
||||
reply = ' | '.join(value['short'] for item,value in SCORES[date].items() if value['top25'])
|
||||
if reply and not all:
|
||||
irc.reply("Showing teams in the top 25 for {0}. Use --all to see more games.".format(niceDate), prefixNick = False)
|
||||
irc.reply(reply, prefixNick = False)
|
||||
else:
|
||||
reply = ' | '.join(value['short'] for item,value in SCORES[date].items())
|
||||
irc.reply("Showing all games for {0}.".format(niceDate), prefixNick = False)
|
||||
irc.reply(reply, prefixNick = False)
|
||||
return
|
||||
|
||||
return
|
||||
@ -144,11 +145,11 @@ class CBBScores(callbacks.Plugin):
|
||||
yesterday = pendulum.yesterday().format('YYYYMMDD')
|
||||
tomorrow = pendulum.tomorrow().format('YYYYMMDD')
|
||||
dates = [yesterday, today, tomorrow]
|
||||
|
||||
|
||||
data = collections.OrderedDict()
|
||||
for date in dates:
|
||||
tmp = requests.get(SCOREBOARD.format(date=date)).json()
|
||||
tmp_date = pendulum.parse(tmp['eventsDate']['date'],
|
||||
tmp_date = pendulum.parse(tmp['eventsDate']['date'],
|
||||
strict=False).in_tz('US/Eastern').format('YYYYMMDD')
|
||||
data[tmp_date] = tmp['events']
|
||||
|
||||
@ -241,7 +242,7 @@ class CBBScores(callbacks.Plugin):
|
||||
return games
|
||||
|
||||
|
||||
Class = CBBScores
|
||||
Class = CBB
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
@ -1 +0,0 @@
|
||||
Fetches College Basketball scores
|
@ -1,15 +0,0 @@
|
||||
###
|
||||
# Copyright (c) 2018, cottongin
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
###
|
||||
|
||||
from supybot.test import *
|
||||
|
||||
|
||||
class CBBScoresTestCase(PluginTestCase):
|
||||
plugins = ('CBBScores',)
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
1
CFB/README.md
Normal file
1
CFB/README.md
Normal file
@ -0,0 +1 @@
|
||||
Fetches NCAA College Football scores.
|
@ -6,7 +6,7 @@
|
||||
###
|
||||
|
||||
"""
|
||||
CBBScores: Fetches College Basketball scores
|
||||
CFB: Fetches College Football scores
|
||||
"""
|
||||
|
||||
import sys
|
@ -8,7 +8,7 @@
|
||||
from supybot import conf, registry
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('CBBScores')
|
||||
_ = PluginInternationalization('CFB')
|
||||
except:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
@ -21,12 +21,12 @@ 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('CBBScores', True)
|
||||
conf.registerPlugin('CFB', True)
|
||||
|
||||
|
||||
CBBScores = conf.registerPlugin('CBBScores')
|
||||
CFB = conf.registerPlugin('CFB')
|
||||
# This is where your configuration variables (if any) should go. For example:
|
||||
# conf.registerGlobalValue(CBBScores, 'someConfigVariableName',
|
||||
# conf.registerGlobalValue(CFB, 'someConfigVariableName',
|
||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
# CFBScores
|
||||
###
|
||||
# Copyright (c) 2018, cottongin
|
||||
# All rights reserved.
|
||||
@ -17,19 +16,19 @@ from supybot import utils, plugins, ircutils, callbacks, schedule
|
||||
from supybot.commands import *
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('CFBScores')
|
||||
_ = PluginInternationalization('CFB')
|
||||
except ImportError:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
_ = lambda x: x
|
||||
|
||||
|
||||
class CFBScores(callbacks.Plugin):
|
||||
class CFB(callbacks.Plugin):
|
||||
"""Fetches CFB scores"""
|
||||
threaded = True
|
||||
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(CFBScores, self)
|
||||
self.__parent = super(CFB, self)
|
||||
self.__parent.__init__(irc)
|
||||
|
||||
self.SCOREBOARD = ('http://site.api.espn.com/apis/site/v2/sports/'
|
||||
@ -49,19 +48,6 @@ class CFBScores(callbacks.Plugin):
|
||||
'https://raw.githubusercontent.com/diagonalfish/FootballBotX2/master/abbrv.json')
|
||||
self.abbrv = self.abbrv.json()
|
||||
|
||||
def periodicCheckGames():
|
||||
self.CFB_GAMES = self._fetchGames(None, '')
|
||||
|
||||
periodicCheckGames()
|
||||
|
||||
try: # check scores.
|
||||
schedule.addPeriodicEvent(periodicCheckGames, 20, now=False, name='fetchCFBscores')
|
||||
except AssertionError:
|
||||
try:
|
||||
schedule.removeEvent('fetchCFBscores')
|
||||
except KeyError:
|
||||
pass
|
||||
schedule.addPeriodicEvent(periodicCheckGames, 20, now=False, name='fetchCFBscores')
|
||||
|
||||
@wrap
|
||||
def cfbbyes(self, irc, msg, args):
|
||||
@ -500,7 +486,7 @@ class CFBScores(callbacks.Plugin):
|
||||
return ircutils.bold(ircutils.underline(string))
|
||||
|
||||
|
||||
Class = CFBScores
|
||||
Class = CFB
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
@ -1 +0,0 @@
|
||||
Fetches CFB scores
|
@ -1,15 +0,0 @@
|
||||
###
|
||||
# Copyright (c) 2018, cottongin
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
###
|
||||
|
||||
from supybot.test import *
|
||||
|
||||
|
||||
class CFBScoresTestCase(PluginTestCase):
|
||||
plugins = ('CFBScores',)
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
@ -1 +0,0 @@
|
||||
Fetches golf scores
|
@ -1,33 +0,0 @@
|
||||
###
|
||||
# Copyright (c) 2018, cottongin
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
###
|
||||
|
||||
from supybot import conf, registry
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('GolfScores')
|
||||
except:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
_ = lambda x: x
|
||||
|
||||
|
||||
def configure(advanced):
|
||||
# This will be called by supybot to configure this module. advanced is
|
||||
# a bool that specifies whether the user identified themself as an 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('GolfScores', True)
|
||||
|
||||
|
||||
GolfScores = conf.registerPlugin('GolfScores')
|
||||
# This is where your configuration variables (if any) should go. For example:
|
||||
# conf.registerGlobalValue(GolfScores, 'someConfigVariableName',
|
||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
@ -1,15 +0,0 @@
|
||||
###
|
||||
# Copyright (c) 2018, cottongin
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
###
|
||||
|
||||
from supybot.test import *
|
||||
|
||||
|
||||
class GolfScoresTestCase(PluginTestCase):
|
||||
plugins = ('GolfScores',)
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
@ -1 +0,0 @@
|
||||
Plugin to fetch MLB scores from the MLB.com API
|
@ -1,71 +0,0 @@
|
||||
###
|
||||
# Copyright (c) 2018, cottongin
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the author of this software nor the name of
|
||||
# contributors to this software may be used to endorse or promote products
|
||||
# derived from this software without specific prior written consent.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
###
|
||||
|
||||
"""
|
||||
MLBScores: Plugin to fetch MLB scores from the MLB.com API
|
||||
"""
|
||||
|
||||
import supybot
|
||||
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__ = ""
|
||||
|
||||
# XXX Replace this with an appropriate author or supybot.Author instance.
|
||||
__author__ = supybot.Author('cottongin', 'cottongin',
|
||||
'cottongin@cottongin.club')
|
||||
__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__ = {}
|
||||
|
||||
# This is a url where the most recent plugin package can be downloaded.
|
||||
__url__ = 'https://github.com/oddluck/limnoria-plugins/'
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
# In case we're being reloaded.
|
||||
reload(config)
|
||||
reload(plugin)
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
||||
if world.testing:
|
||||
from . import test
|
||||
|
||||
Class = plugin.Class
|
||||
configure = config.configure
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
@ -1,58 +0,0 @@
|
||||
###
|
||||
# Copyright (c) 2018, cottongin
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the author of this software nor the name of
|
||||
# contributors to this software may be used to endorse or promote products
|
||||
# derived from this software without specific prior written consent.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
###
|
||||
|
||||
import supybot.conf as conf
|
||||
import supybot.registry as registry
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('MLBScores')
|
||||
except:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
_ = lambda x: x
|
||||
|
||||
|
||||
def configure(advanced):
|
||||
# This will be called by supybot to configure this module. advanced is
|
||||
# a bool that specifies whether the user identified themself as an 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('MLBScores', True)
|
||||
|
||||
|
||||
MLBScores = conf.registerPlugin('MLBScores')
|
||||
# This is where your configuration variables (if any) should go. For example:
|
||||
# conf.registerGlobalValue(MLBScores, 'someConfigVariableName',
|
||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
||||
conf.registerGlobalValue(MLBScores, 'bitlyAPIKey',
|
||||
registry.String('', """Bit.ly API key.""", private=True))
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
@ -1,109 +0,0 @@
|
||||
import pendulum
|
||||
import re
|
||||
|
||||
_FUZZY_DAYS = ['yesterday', 'tonight', 'today', 'tomorrow',
|
||||
'sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']
|
||||
|
||||
def _parseDate(string):
|
||||
"""parse date"""
|
||||
date = string[:3].lower()
|
||||
if date in _FUZZY_DAYS or string.lower() in _FUZZY_DAYS:
|
||||
if date == 'yes':
|
||||
date_string = pendulum.yesterday('US/Pacific').format('YYYY-MM-DD')
|
||||
#print(date_string)
|
||||
return date_string
|
||||
elif date == 'tod' or date == 'ton':
|
||||
date_string = pendulum.now('US/Pacific').format('YYYY-MM-DD')
|
||||
return date_string
|
||||
elif date == 'tom':
|
||||
date_string = pendulum.tomorrow('US/Pacific').format('YYYY-MM-DD')
|
||||
return date_string
|
||||
elif date == 'sun':
|
||||
date_string = pendulum.now('US/Pacific').next(pendulum.SUNDAY).format('YYYY-MM-DD')
|
||||
return date_string
|
||||
elif date == 'mon':
|
||||
date_string = pendulum.now('US/Pacific').next(pendulum.MONDAY).format('YYYY-MM-DD')
|
||||
return date_string
|
||||
elif date == 'tue':
|
||||
date_string = pendulum.now('US/Pacific').next(pendulum.TUESDAY).format('YYYY-MM-DD')
|
||||
return date_string
|
||||
elif date == 'wed':
|
||||
date_string = pendulum.now('US/Pacific').next(pendulum.WEDNESDAY).format('YYYY-MM-DD')
|
||||
return date_string
|
||||
elif date == 'thu':
|
||||
date_string = pendulum.now('US/Pacific').next(pendulum.THURSDAY).format('YYYY-MM-DD')
|
||||
return date_string
|
||||
elif date == 'fri':
|
||||
date_string = pendulum.now('US/Pacific').next(pendulum.FRIDAY).format('YYYY-MM-DD')
|
||||
return date_string
|
||||
elif date == 'sat':
|
||||
date_string = pendulum.now('US/Pacific').next(pendulum.SATURDAY).format('YYYY-MM-DD')
|
||||
return date_string
|
||||
|
||||
def parseInput(args=None, _TEAM_BY_TRI=None, _TEAM_BY_NICK=None):
|
||||
"""parse user input from mlb2"""
|
||||
# return team, date, timezone
|
||||
|
||||
tz = 'US/Eastern'
|
||||
date = None
|
||||
team = None
|
||||
is_date = None
|
||||
|
||||
if not args:
|
||||
return team, date, tz
|
||||
|
||||
arg_array = []
|
||||
for arg in args.split(' '):
|
||||
arg_array.append(arg)
|
||||
|
||||
print(_TEAM_BY_TRI)
|
||||
|
||||
for idx, arg in enumerate(arg_array):
|
||||
#print(arg)
|
||||
if '--tz' in arg:
|
||||
#print(arg_array[idx+1])
|
||||
try:
|
||||
tz = arg_array[idx+1]
|
||||
except:
|
||||
tz = 'US/Eastern'
|
||||
if arg.lower() in _FUZZY_DAYS or arg[:3].lower() in _FUZZY_DAYS:
|
||||
date = _parseDate(arg)
|
||||
#print(date)
|
||||
#date = pendulum.parse(date).in_tz(tz)
|
||||
try:
|
||||
arg = arg.strip('-')
|
||||
arg = arg.strip('/')
|
||||
if arg[0].isdigit() and arg[1].isdigit() and arg[2].isalpha():
|
||||
if arg[-1].isdigit():
|
||||
yr = arg[-2:]
|
||||
mnth = " ".join(re.findall("[a-zA-Z]+", arg))
|
||||
#print(mnth,yr)
|
||||
rebuild = '{}-{}-{}'.format(mnth, arg[:2], yr)
|
||||
else:
|
||||
rebuild = arg[2:] + arg[:2]
|
||||
#print('both', rebuild)
|
||||
elif arg[0].isdigit() and arg[1].isalpha():
|
||||
rebuild = arg[1:] + arg[0]
|
||||
#print('one', rebuild)
|
||||
else:
|
||||
rebuild = arg
|
||||
|
||||
#print(rebuild)
|
||||
is_date = pendulum.parse(rebuild, strict=False)
|
||||
#print(is_date)
|
||||
except:
|
||||
is_date = None
|
||||
if is_date:
|
||||
date = is_date.format('YYYY-MM-DD')
|
||||
if _TEAM_BY_TRI and _TEAM_BY_NICK:
|
||||
if arg.upper() in _TEAM_BY_TRI:
|
||||
team = str(_TEAM_BY_TRI[arg.upper()])
|
||||
elif arg.lower() in _TEAM_BY_NICK:
|
||||
abbr = str(_TEAM_BY_NICK[arg.lower()])
|
||||
team = str(_TEAM_BY_TRI[abbr])
|
||||
#else:
|
||||
# team = arg.upper()
|
||||
|
||||
print(team)
|
||||
|
||||
return team, date, tz
|
4049
MLBScores/plugin.py
4049
MLBScores/plugin.py
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
||||
requests
|
||||
httplib2
|
||||
limnoria
|
||||
pytz
|
||||
python_dateutil
|
||||
pendulum
|
@ -1,38 +0,0 @@
|
||||
###
|
||||
# Copyright (c) 2018, cottongin
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the author of this software nor the name of
|
||||
# contributors to this software may be used to endorse or promote products
|
||||
# derived from this software without specific prior written consent.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
###
|
||||
|
||||
from supybot.test import *
|
||||
|
||||
|
||||
class MLBScoresTestCase(PluginTestCase):
|
||||
plugins = ('MLBScores',)
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
@ -1,6 +1,6 @@
|
||||
# NBAScores
|
||||
|
||||
A [Limnoria](https://github.com/ProgVal/Limnoria) plugin to retrieve NBA scores from NBA.com.
|
||||
A [Limnoria](https://github.com/ProgVal/Limnoria) plugin to retrieve NBA basketball scores from NBA.com.
|
||||
|
||||
## Requirements
|
||||
* Python 3
|
@ -29,7 +29,7 @@
|
||||
###
|
||||
|
||||
"""
|
||||
NBAScores: Get scores from NBA.com
|
||||
NBA: Get scores from NBA.com
|
||||
"""
|
||||
|
||||
import supybot
|
@ -32,7 +32,7 @@ import supybot.conf as conf
|
||||
import supybot.registry as registry
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('NBAScores')
|
||||
_ = PluginInternationalization('NBA')
|
||||
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('NBAScores', True)
|
||||
conf.registerPlugin('NBA', True)
|
||||
|
||||
|
||||
NBA = conf.registerPlugin('NBAScores')
|
||||
NBA = conf.registerPlugin('NBA')
|
||||
# This is where your configuration variables (if any) should go. For example:
|
||||
# conf.registerGlobalValue(NBA, 'someConfigVariableName',
|
||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
@ -1,6 +1,3 @@
|
||||
""" Limnoria plugin to retrieve results from NBA.com using their
|
||||
(undocumented) JSON API.
|
||||
"""
|
||||
###
|
||||
# Copyright (c) 2018, Santiago Gil
|
||||
#
|
||||
@ -27,7 +24,7 @@ import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('NBAScores')
|
||||
_ = PluginInternationalization('NBA')
|
||||
except ImportError:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
@ -40,7 +37,7 @@ import json
|
||||
import pytz
|
||||
from xml.etree import ElementTree
|
||||
|
||||
class NBAScores(callbacks.Plugin):
|
||||
class NBA(callbacks.Plugin):
|
||||
"""Get scores from NBA.com."""
|
||||
|
||||
_ENDPOINT_BASE_URL = 'https://data.nba.net'
|
||||
@ -63,7 +60,7 @@ class NBAScores(callbacks.Plugin):
|
||||
'BKN', 'POR', 'GSW', 'LAC', 'WAS'))
|
||||
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(NBAScores, self)
|
||||
self.__parent = super(NBA, self)
|
||||
self.__parent.__init__(irc)
|
||||
|
||||
self._http = httplib2.Http('.cache')
|
||||
@ -814,6 +811,6 @@ class NBAScores(callbacks.Plugin):
|
||||
return url
|
||||
|
||||
|
||||
Class = NBAScores
|
||||
Class = NBA
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
@ -1,38 +0,0 @@
|
||||
###
|
||||
# Copyright (c) 2016, Santiago Gil
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the author of this software nor the name of
|
||||
# contributors to this software may be used to endorse or promote products
|
||||
# derived from this software without specific prior written consent.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
###
|
||||
|
||||
from supybot.test import *
|
||||
|
||||
|
||||
class NBATestCase(PluginTestCase):
|
||||
plugins = ('NBAScores',)
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
1
NFL/README.md
Normal file
1
NFL/README.md
Normal file
@ -0,0 +1 @@
|
||||
Fetches NFL football scores and game information from NFL.com
|
@ -6,7 +6,7 @@
|
||||
###
|
||||
|
||||
"""
|
||||
NFLScores: Fetches scores and game information from NFL.com
|
||||
NFL: Fetches scores and game information from NFL.com
|
||||
"""
|
||||
|
||||
import sys
|
@ -8,7 +8,7 @@
|
||||
from supybot import conf, registry
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('NFLScores')
|
||||
_ = PluginInternationalization('NFL')
|
||||
except:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
@ -21,12 +21,12 @@ 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('NFLScores', True)
|
||||
conf.registerPlugin('NFL', True)
|
||||
|
||||
|
||||
NFLScores = conf.registerPlugin('NFLScores')
|
||||
NFL = conf.registerPlugin('NFL')
|
||||
# This is where your configuration variables (if any) should go. For example:
|
||||
# conf.registerGlobalValue(NFLScores, 'someConfigVariableName',
|
||||
# conf.registerGlobalValue(NFL, 'someConfigVariableName',
|
||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
||||
|
||||
|
@ -13,7 +13,7 @@ from supybot import utils, plugins, ircutils, callbacks
|
||||
from supybot.commands import *
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('NFLScores')
|
||||
_ = PluginInternationalization('NFL')
|
||||
except ImportError:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
@ -42,7 +42,7 @@ def getValidDateFmt(irc, msg, args, state):
|
||||
del args[0]
|
||||
addConverter('validDate', getValidDateFmt)
|
||||
|
||||
class NFLScores(callbacks.Plugin):
|
||||
class NFL(callbacks.Plugin):
|
||||
"""Fetches scores and game information from NFL.com"""
|
||||
threaded = True
|
||||
|
||||
@ -308,10 +308,10 @@ class NFLScores(callbacks.Plugin):
|
||||
print(player_id)
|
||||
|
||||
except:
|
||||
self.log.exception("ERROR :: NFLScores :: failed to get link for {0}".format(burl))
|
||||
self.log.exception("ERROR :: NFL :: failed to get link for {0}".format(burl))
|
||||
pass
|
||||
except Exception as e:
|
||||
self.log.info("ERROR :: NFLScores :: {0}".format(e))
|
||||
self.log.info("ERROR :: NFL :: {0}".format(e))
|
||||
pass
|
||||
|
||||
if not player_id:
|
||||
@ -512,7 +512,7 @@ class NFLScores(callbacks.Plugin):
|
||||
return ircutils.underline(string)
|
||||
|
||||
|
||||
Class = NFLScores
|
||||
Class = NFL
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
@ -1 +0,0 @@
|
||||
Fetches scores and game information from NFL.com
|
@ -1,15 +0,0 @@
|
||||
###
|
||||
# Copyright (c) 2019, cottongin
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
###
|
||||
|
||||
from supybot.test import *
|
||||
|
||||
|
||||
class NFLScoresTestCase(PluginTestCase):
|
||||
plugins = ('NFLScores',)
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
@ -1,6 +1,6 @@
|
||||
#NHL
|
||||
|
||||
A [Limnoria](https://github.com/ProgVal/Limnoria) plugin to retrieve NHL scores from NHL.com.
|
||||
A [Limnoria](https://github.com/ProgVal/Limnoria) plugin to retrieve NHL hockey scores from NHL.com.
|
||||
|
||||
## Requirements
|
||||
* Python 3
|
@ -29,7 +29,7 @@
|
||||
###
|
||||
|
||||
"""
|
||||
NHLScores: Get NHL scores
|
||||
NHL: Get NHL scores
|
||||
"""
|
||||
|
||||
import supybot
|
@ -32,7 +32,7 @@ import supybot.conf as conf
|
||||
import supybot.registry as registry
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('NHLScores')
|
||||
_ = PluginInternationalization('NHL')
|
||||
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('NHLScores', True)
|
||||
conf.registerPlugin('NHL', True)
|
||||
|
||||
|
||||
NHLScores = conf.registerPlugin('NHLScores')
|
||||
NHL = conf.registerPlugin('NHL')
|
||||
# This is where your configuration variables (if any) should go. For example:
|
||||
# conf.registerGlobalValue(NBA, 'someConfigVariableName',
|
||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
@ -1,4 +1,3 @@
|
||||
# NHLScores
|
||||
###
|
||||
# Limnoria plugin to retrieve results from NHL.com using their (undocumented)
|
||||
# JSON API.
|
||||
@ -26,7 +25,7 @@ import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('NHLScores')
|
||||
_ = PluginInternationalization('NHL')
|
||||
except ImportError:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
@ -40,10 +39,10 @@ import urllib.request
|
||||
import pendulum
|
||||
import requests
|
||||
|
||||
class NHLScores(callbacks.Plugin):
|
||||
class NHL(callbacks.Plugin):
|
||||
"""Get scores from NHL.com."""
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(NHLScores, self)
|
||||
self.__parent = super(NHL, self)
|
||||
self.__parent.__init__(irc)
|
||||
|
||||
self._SCOREBOARD_ENDPOINT = ("https://statsapi.web.nhl.com/api/v1/schedule?startDate={}&endDate={}" +
|
||||
@ -758,6 +757,6 @@ class NHLScores(callbacks.Plugin):
|
||||
|
||||
return date
|
||||
|
||||
Class = NHLScores
|
||||
Class = NHL
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
@ -1,38 +0,0 @@
|
||||
###
|
||||
# Copyright (c) 2016, Santiago Gil
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions, and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the author of this software nor the name of
|
||||
# contributors to this software may be used to endorse or promote products
|
||||
# derived from this software without specific prior written consent.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
###
|
||||
|
||||
from supybot.test import *
|
||||
|
||||
|
||||
class NBATestCase(PluginTestCase):
|
||||
plugins = ('NBA',)
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
@ -1 +0,0 @@
|
||||
Fetches odds
|
@ -1,15 +0,0 @@
|
||||
###
|
||||
# Copyright (c) 2018, cottongin
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
###
|
||||
|
||||
from supybot.test import *
|
||||
|
||||
|
||||
class NewOddsTestCase(PluginTestCase):
|
||||
plugins = ('NewOdds',)
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
1
Odds/README.md
Normal file
1
Odds/README.md
Normal file
@ -0,0 +1 @@
|
||||
Fetches sports odds for NFL, MLB, NHL, NBA, CFB, CBB games.
|
@ -6,7 +6,7 @@
|
||||
###
|
||||
|
||||
"""
|
||||
NewOdds: Fetches odds
|
||||
Odds: Fetches odds
|
||||
"""
|
||||
|
||||
import sys
|
@ -8,7 +8,7 @@
|
||||
from supybot import conf, registry
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('CFBScores')
|
||||
_ = PluginInternationalization('Odds')
|
||||
except:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
@ -21,12 +21,12 @@ 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('CFBScores', True)
|
||||
conf.registerPlugin('Odds', True)
|
||||
|
||||
|
||||
CFBScores = conf.registerPlugin('CFBScores')
|
||||
Odds = conf.registerPlugin('Odds')
|
||||
# This is where your configuration variables (if any) should go. For example:
|
||||
# conf.registerGlobalValue(CFBScores, 'someConfigVariableName',
|
||||
# conf.registerGlobalValue(Odds, 'someConfigVariableName',
|
||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
||||
|
||||
|
@ -12,19 +12,19 @@ from supybot import utils, plugins, ircutils, callbacks
|
||||
from supybot.commands import *
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('NewOdds')
|
||||
_ = PluginInternationalization('Odds')
|
||||
except ImportError:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
_ = lambda x: x
|
||||
|
||||
|
||||
class NewOdds(callbacks.Plugin):
|
||||
class Odds(callbacks.Plugin):
|
||||
"""Fetches odds"""
|
||||
threaded = True
|
||||
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(NewOdds, self)
|
||||
self.__parent = super(Odds, self)
|
||||
self.__parent.__init__(irc)
|
||||
|
||||
@wrap([getopts({'nfl': '', 'mlb': '', 'nhl': '', 'nba': '',
|
||||
@ -341,7 +341,7 @@ class NewOdds(callbacks.Plugin):
|
||||
|
||||
return number
|
||||
|
||||
Class = NewOdds
|
||||
Class = Odds
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
1
PGA/README.md
Normal file
1
PGA/README.md
Normal file
@ -0,0 +1 @@
|
||||
Fetches PGA Golf scores etc.
|
@ -6,7 +6,7 @@
|
||||
###
|
||||
|
||||
"""
|
||||
GolfScores: Fetches golf scores
|
||||
PGA: Fetches golf scores
|
||||
"""
|
||||
|
||||
import sys
|
33
PGA/config.py
Normal file
33
PGA/config.py
Normal file
@ -0,0 +1,33 @@
|
||||
###
|
||||
# Copyright (c) 2018, cottongin
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
###
|
||||
|
||||
from supybot import conf, registry
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('PGA')
|
||||
except:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
_ = lambda x: x
|
||||
|
||||
|
||||
def configure(advanced):
|
||||
# This will be called by supybot to configure this module. advanced is
|
||||
# a bool that specifies whether the user identified themself as an 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('PGA', True)
|
||||
|
||||
|
||||
PGA = conf.registerPlugin('PGA')
|
||||
# This is where your configuration variables (if any) should go. For example:
|
||||
# conf.registerGlobalValue(PGA, 'someConfigVariableName',
|
||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
@ -12,7 +12,7 @@ from supybot import utils, plugins, ircutils, callbacks
|
||||
from supybot.commands import *
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('GolfScores')
|
||||
_ = PluginInternationalization('PGA')
|
||||
except ImportError:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
@ -21,7 +21,7 @@ except ImportError:
|
||||
CURRENT_URL = 'https://statdata.pgatour.com/{trn_type}/current/message.json'
|
||||
SCOREBOARD = 'https://statdata.pgatour.com/{trn_type}/{trn_id}/leaderboard-v2mini.json'
|
||||
|
||||
class GolfScores(callbacks.Plugin):
|
||||
class PGA(callbacks.Plugin):
|
||||
"""Fetches golf scores"""
|
||||
threaded = True
|
||||
|
||||
@ -162,7 +162,7 @@ class GolfScores(callbacks.Plugin):
|
||||
return
|
||||
|
||||
|
||||
Class = GolfScores
|
||||
Class = PGA
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
11
README.md
11
README.md
@ -2,8 +2,15 @@
|
||||
|
||||
Limnoria (an IRC bot) plugins I wrote or forked. All working under Python 3.
|
||||
|
||||
repolist oddluck / install oddluck Plugin_Name
|
||||
Requires [Limnoria](https://github.com/ProgVal/Limnoria), obviously. Additional requirements in requirements.txt files
|
||||
|
||||
Requires Limnoria, obviously. Additional requirements in requirements.txt files
|
||||
Plugins assume Python 3.6+, though many may still work with older versions.
|
||||
|
||||
Easy installation:
|
||||
|
||||
load PluginDownloader<br />
|
||||
repolist oddluck<br />
|
||||
install oddluck PluginName<br />
|
||||
load PluginName<br />
|
||||
|
||||
gitlab mirror: https://gitlab.com/oddluck/limnoria-plugins
|
||||
|
6
Soccer/README.md
Normal file
6
Soccer/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
Fetches soccer scores and other information.
|
||||
|
||||
Leagues: epl, mls, ecl, uefac, uefae, efac, carabao, liga, bundesliga,
|
||||
seriea, ligue, bbva, fifawc, wc, nations, concacaf, africa, cl, etc.
|
||||
|
||||
|
52
Soccer/__init__.py
Normal file
52
Soccer/__init__.py
Normal file
@ -0,0 +1,52 @@
|
||||
###
|
||||
# Copyright (c) 2018, cottongin
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
###
|
||||
|
||||
"""
|
||||
Soccer: Fetches soccer scores and other information
|
||||
"""
|
||||
|
||||
import sys
|
||||
import supybot
|
||||
from supybot import 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__ = ""
|
||||
|
||||
# XXX Replace this with an appropriate author or supybot.Author instance.
|
||||
__author__ = supybot.Author('cottongin', 'cottongin',
|
||||
'cottongin@cottongin.club')
|
||||
__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__ = {}
|
||||
|
||||
# This is a url where the most recent plugin package can be downloaded.
|
||||
__url__ = 'https://github.com/oddluck/limnoria-plugins/'
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
if sys.version_info >= (3, 4):
|
||||
from importlib import reload
|
||||
else:
|
||||
from imp import reload
|
||||
# In case we're being reloaded.
|
||||
reload(config)
|
||||
reload(plugin)
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
||||
if world.testing:
|
||||
from . import test
|
||||
|
||||
Class = plugin.Class
|
||||
configure = config.configure
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
@ -8,7 +8,7 @@
|
||||
from supybot import conf, registry
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('SoccerScores')
|
||||
_ = PluginInternationalization('Soccer')
|
||||
except:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
@ -21,10 +21,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('SoccerScores', True)
|
||||
conf.registerPlugin('Soccer', True)
|
||||
|
||||
|
||||
Soccer = conf.registerPlugin('SoccerScores')
|
||||
Soccer = conf.registerPlugin('Soccer')
|
||||
# This is where your configuration variables (if any) should go. For example:
|
||||
# conf.registerGlobalValue(Soccer, 'someConfigVariableName',
|
||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
@ -1,4 +1,3 @@
|
||||
# Soccer
|
||||
###
|
||||
# Copyright (c) 2018, cottongin
|
||||
# All rights reserved.
|
||||
@ -11,7 +10,7 @@ from supybot import utils, plugins, ircutils, callbacks, schedule, conf
|
||||
from supybot.commands import *
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('SoccerScores')
|
||||
_ = PluginInternationalization('Soccer')
|
||||
except ImportError:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
@ -23,12 +22,12 @@ import pendulum
|
||||
import pickle
|
||||
|
||||
|
||||
class SoccerScores(callbacks.Plugin):
|
||||
class Soccer(callbacks.Plugin):
|
||||
"""Fetches soccer scores and other information"""
|
||||
threaded = True
|
||||
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(SoccerScores, self)
|
||||
self.__parent = super(Soccer, self)
|
||||
self.__parent.__init__(irc)
|
||||
|
||||
self.PICKLEFILE = conf.supybot.directories.data.dirize("soccer-leagues.db")
|
||||
@ -144,7 +143,7 @@ class SoccerScores(callbacks.Plugin):
|
||||
|
||||
if not league:
|
||||
irc.reply('ERROR: You must provide a league via --league <league>')
|
||||
doc = irc.getCallback('SoccerScores').soccer.__doc__
|
||||
doc = irc.getCallback('Soccer').soccer.__doc__
|
||||
doclines = doc.splitlines()
|
||||
s = '%s' % (doclines.pop(0))
|
||||
if doclines:
|
||||
@ -318,7 +317,7 @@ class SoccerScores(callbacks.Plugin):
|
||||
|
||||
|
||||
|
||||
Class = SoccerScores
|
||||
Class = Soccer
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
@ -1 +0,0 @@
|
||||
Fetches soccer scores and other information
|
@ -1,52 +0,0 @@
|
||||
###
|
||||
# Copyright (c) 2018, cottongin
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
###
|
||||
|
||||
"""
|
||||
SoccerScores: Fetches soccer scores and other information
|
||||
"""
|
||||
|
||||
import sys
|
||||
import supybot
|
||||
from supybot import 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__ = ""
|
||||
|
||||
# XXX Replace this with an appropriate author or supybot.Author instance.
|
||||
__author__ = supybot.Author('cottongin', 'cottongin',
|
||||
'cottongin@cottongin.club')
|
||||
__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__ = {}
|
||||
|
||||
# This is a url where the most recent plugin package can be downloaded.
|
||||
__url__ = 'https://github.com/oddluck/limnoria-plugins/'
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
if sys.version_info >= (3, 4):
|
||||
from importlib import reload
|
||||
else:
|
||||
from imp import reload
|
||||
# In case we're being reloaded.
|
||||
reload(config)
|
||||
reload(plugin)
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
||||
if world.testing:
|
||||
from . import test
|
||||
|
||||
Class = plugin.Class
|
||||
configure = config.configure
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
@ -1,15 +0,0 @@
|
||||
###
|
||||
# Copyright (c) 2018, cottongin
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
###
|
||||
|
||||
from supybot.test import *
|
||||
|
||||
|
||||
class SoccerTestCase(PluginTestCase):
|
||||
plugins = ('SoccerScores',)
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
Loading…
x
Reference in New Issue
Block a user