From 15198a5636b6390a5fd4818d37d9be1e71bbbf3d Mon Sep 17 00:00:00 2001 From: oddluck <39967334+oddluck@users.noreply.github.com> Date: Mon, 24 Feb 2020 20:21:56 +0000 Subject: [PATCH] Update READMEs for PluginDownloader info --- Azure/README.md | 4 +- BadWords/README.md | 4 +- BotLibre/README.md | 7 +- Cayenne/README.md | 4 +- Cobe/README.md | 4 +- Dice/README.md | 2 + DuckHunt/README.md | 2 + Fun/README.md | 2 + Geo/README.md | 4 +- HuntNFish/README.txt | 4 +- {IMDB => IMDb}/README.md | 6 +- {IMDB => IMDb}/__init__.py | 2 +- {IMDB => IMDb}/config.py | 14 +-- {IMDB => IMDb}/plugin.py | 20 ++--- {IMDB => IMDb}/requirements.txt | 0 Jeopardy/README.md | 2 +- Lyrics/README.md | 1 - Markovgen/README.md | 2 + NBA/README.md | 4 +- NHL/README.md | 4 +- RPG/README.md | 2 +- SpiffyTitles/README.md | 2 + TVMaze/README.md | 4 +- TextArt/README.md | 7 +- TimeBomb/README.md | 2 + Trackers/README.md | 4 +- TriviaTime/README.md | 2 + Tweety/README.md | 2 + Uno/README.txt => UNO/README.md | 2 + {Uno => UNO}/__init__.py | 4 +- {Uno => UNO}/config.py | 6 +- {Uno => UNO}/plugin.py | 146 ++++++++++++++------------------ Undercut/README.txt | 2 +- Undercut/__init__.py | 2 +- UndernetX/README.md | 7 +- Unicode/README.txt | 4 +- UrbanDictionary/README.md | 2 + Weed/README.md | 2 +- WolframAlpha/README.md | 2 + WordGames/README.md | 2 + WorldTime/README.md | 2 + 41 files changed, 157 insertions(+), 143 deletions(-) rename {IMDB => IMDb}/README.md (50%) rename {IMDB => IMDb}/__init__.py (97%) rename {IMDB => IMDb}/config.py (90%) rename {IMDB => IMDb}/plugin.py (93%) rename {IMDB => IMDb}/requirements.txt (100%) rename Uno/README.txt => UNO/README.md (91%) rename {Uno => UNO}/__init__.py (98%) rename {Uno => UNO}/config.py (95%) rename {Uno => UNO}/plugin.py (96%) diff --git a/Azure/README.md b/Azure/README.md index d79d1cd..a8a8213 100644 --- a/Azure/README.md +++ b/Azure/README.md @@ -1,5 +1,5 @@ +Access various Microsoft Azure APIs (translate, search, etc.). + ## Azure Plugin -This plugin connects to various Microsoft Azure APIs. - `config plugins.azure.translate.key` Set your key for the text translation API diff --git a/BadWords/README.md b/BadWords/README.md index b656f14..7602852 100644 --- a/BadWords/README.md +++ b/BadWords/README.md @@ -1,3 +1,3 @@ -This plugin ensures that the bot won't say or (optionally) respond to any words -the bot owner finds offensive. As an additional capability, it can (optionally) +This plugin ensures that the bot won't say or (optionally) respond to any words +the bot owner finds offensive. As an additional capability, it can (optionally) kick users who use such words from channels that have that capability enabled. diff --git a/BotLibre/README.md b/BotLibre/README.md index a0289fe..794fe36 100644 --- a/BotLibre/README.md +++ b/BotLibre/README.md @@ -1,4 +1,9 @@ -Use the Bot Libre API (Free) https://www.botlibre.com/api.jsp +Retrieve responses from the Bot Libre API. + +## BotLibre + +Register for an account: https://www.botlibre.com/api.jsp (FREE) + ``` config plugins.BotLibre.application (YOUR_APP_KEY_HERE) config plugins.BotLibre.instance (BOT_INSTANCE_ID_HERE) diff --git a/Cayenne/README.md b/Cayenne/README.md index ff5ba42..fc7ed91 100644 --- a/Cayenne/README.md +++ b/Cayenne/README.md @@ -1,6 +1,6 @@ -Forked from: https://github.com/butterscotchstallion/limnoria-plugins/tree/master/Cayenne +Displays cat facts or cat gifs. -Displays cat facts or cat gifs based on probability +Forked from: https://github.com/butterscotchstallion/limnoria-plugins/tree/master/Cayenne python3 compatible
uses https://catfact.ninja/ as cat facts source
diff --git a/Cobe/README.md b/Cobe/README.md index 1777a51..897c482 100644 --- a/Cobe/README.md +++ b/Cobe/README.md @@ -1,9 +1,11 @@ +Generate markov responses using the Cobe library. + Forked from https://github.com/waratte/supybot/tree/master/Cobe Cobe =============== -This is a plugin for Limnoria that allows your bot to use [Cobe](https://github.com/HubbeKing/cobe) +This is a plugin for Limnoria that allows your bot to use [Cobe](https://github.com/oddluck/cobe) A description of cobe: http://teichman.org/blog/2011/02/cobe.html diff --git a/Dice/README.md b/Dice/README.md index 968b122..74f5cf3 100644 --- a/Dice/README.md +++ b/Dice/README.md @@ -1,3 +1,5 @@ +Dice rolling plugin with many options. + Forked from https://github.com/wRAR/supybot-plugin-Dicebot Install dependencies: python3 -m pip install -r requirements.txt diff --git a/DuckHunt/README.md b/DuckHunt/README.md index aa87a15..4aeb1cf 100644 --- a/DuckHunt/README.md +++ b/DuckHunt/README.md @@ -1,3 +1,5 @@ +The classic game of IRC Duck Hunt. + Forked from https://github.com/veggiematts/supybot-duckhunt Requires Python3, Limnoria. diff --git a/Fun/README.md b/Fun/README.md index 80528b6..2772fbc 100644 --- a/Fun/README.md +++ b/Fun/README.md @@ -1,3 +1,5 @@ +Miscellaneous "fun" commands. + # Fun Limnoria plugin to return piglatin translation, play rock-paper-scissors. random; joke, cat fact, cat .gif, dev excuse, bofh excuse, useless fact, corporate buzzwords, startup idea, insult, mitch hedberg joke, chuck norris joke, or advice from various APIs and text files. diff --git a/Geo/README.md b/Geo/README.md index 0caa2d1..124bd33 100644 --- a/Geo/README.md +++ b/Geo/README.md @@ -1,6 +1,6 @@ -Forked from https://github.com/SpiderDave/spidey-supybot-plugins/tree/master/Plugins/Geo +Provides geographical information from an IP address, hostmask, nick (must be in channel), or URL. -Provides geographical information from an ip address, hostmask, nick (must be in channel), or url using GeoLite2. +Forked from https://github.com/SpiderDave/spidey-supybot-plugins/tree/master/Plugins/Geo Requires GeoIP2-python: ``` diff --git a/HuntNFish/README.txt b/HuntNFish/README.txt index 12ec7b1..700efa8 100644 --- a/HuntNFish/README.txt +++ b/HuntNFish/README.txt @@ -1,6 +1,6 @@ -Forked from https://github.com/resistivecorpse/supybot-plugins/tree/master/HuntNFish +A simple hunting and fishing game. -this is a basic hunting and fishing game for supybot +Forked from https://github.com/resistivecorpse/supybot-plugins/tree/master/HuntNFish chance of success is a % variable, 1 to 100. it is set with config plugins.HuntNFish.successRate diff --git a/IMDB/README.md b/IMDb/README.md similarity index 50% rename from IMDB/README.md rename to IMDb/README.md index 71cb195..d680acb 100644 --- a/IMDB/README.md +++ b/IMDb/README.md @@ -1,9 +1,9 @@ -Forked from https://github.com/butterscotchstallion/limnoria-plugins/tree/master/IMDB +Information about IMDb titles from the OMDB API. Search powered by Google. -Queries OMDB database for information about IMDB titles. Search powered by Google. +Forked from https://github.com/butterscotchstallion/limnoria-plugins/tree/master/IMDB https://omdbapi.com/apikey.aspx ``` -config plugins.IMDB.omdbAPI (your_api_key) +config plugins.IMDb.omdbAPI (your_api_key) ``` diff --git a/IMDB/__init__.py b/IMDb/__init__.py similarity index 97% rename from IMDB/__init__.py rename to IMDb/__init__.py index 88c5ef3..0710dd8 100644 --- a/IMDB/__init__.py +++ b/IMDb/__init__.py @@ -29,7 +29,7 @@ ### """ -IMDB: Queries OMDB database for information about IMDB titles +IMDb: Queries OMDB database for information about IMDb titles """ import supybot diff --git a/IMDB/config.py b/IMDb/config.py similarity index 90% rename from IMDB/config.py rename to IMDb/config.py index 95cd0db..4a61063 100644 --- a/IMDB/config.py +++ b/IMDb/config.py @@ -32,7 +32,7 @@ import supybot.conf as conf import supybot.registry as registry try: from supybot.i18n import PluginInternationalization - _ = PluginInternationalization('IMDB') + _ = PluginInternationalization('IMDb') except: # Placeholder that allows to run the plugin on a bot # without the i18n module @@ -45,20 +45,20 @@ 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('IMDB', True) + conf.registerPlugin('IMDb', True) -IMDB = conf.registerPlugin('IMDB') +IMDB = conf.registerPlugin('IMDb') -conf.registerGlobalValue(IMDB, 'template', - registry.String("\x02\x031,8 IMDb \x0F\x02 | $title ($year, $country, [$rated], $genre, $runtime) | IMDB: $imdbRating | MC: $metascore | RT: $tomatoMeter | http://imdb.com/title/$imdbID | $plot | Director: $director | Writer: $writer | Actors: $actors", _("""Template for the output of a search query."""))) +conf.registerGlobalValue(IMDb, 'template', + registry.String("\x02\x031,8 IMDb \x0F\x02 | $title ($year, $country, [$rated], $genre, $runtime) | IMDb: $imdbRating | MC: $metascore | RT: $tomatoMeter | http://imdb.com/title/$imdbID | $plot | Director: $director | Writer: $writer | Actors: $actors", _("""Template for the output of a search query."""))) # alternative template: # $title ($year - $director) :: [i:$imdbRating r:$tomatoMeter m:$metascore] $plot :: http://imdb.com/title/$imdbID -conf.registerGlobalValue(IMDB, 'noResultsMessage', +conf.registerGlobalValue(IMDb, 'noResultsMessage', registry.String("No results for that query.", _("""This message is sent when there are no results"""))) -conf.registerGlobalValue(IMDB, 'omdbAPI', +conf.registerGlobalValue(IMDb, 'omdbAPI', registry.String('', _("""OMDB API Key"""))) # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/IMDB/plugin.py b/IMDb/plugin.py similarity index 93% rename from IMDB/plugin.py rename to IMDb/plugin.py index 4295fef..fa3a25c 100644 --- a/IMDB/plugin.py +++ b/IMDb/plugin.py @@ -43,14 +43,14 @@ from bs4 import BeautifulSoup try: from supybot.i18n import PluginInternationalization - _ = PluginInternationalization('IMDB') + _ = PluginInternationalization('IMDb') except ImportError: # Placeholder that allows to run the plugin on a bot # without the i18n module _ = lambda x: x -class IMDB(callbacks.Plugin): - """Queries OMDB database for information about IMDB titles""" +class IMDb(callbacks.Plugin): + """Queries OMDB database for information about IMDb titles""" threaded = True def dosearch(self, query): @@ -87,7 +87,7 @@ class IMDB(callbacks.Plugin): ua = UserAgent() headers = {'User-Agent':str(ua.random)} - self.log.info("IMDB: requesting %s" % omdb_url) + self.log.info("IMDb: requesting %s" % omdb_url) try: request = requests.get(omdb_url, timeout=10, headers=headers) @@ -99,7 +99,7 @@ class IMDB(callbacks.Plugin): unknown_error = response["Response"] != "True" if not_found or unknown_error: - self.log.info("IMDB: OMDB error for %s" % (omdb_url)) + self.log.info("IMDb: OMDB error for %s" % (omdb_url)) else: meta = None tomato = None @@ -142,14 +142,14 @@ class IMDB(callbacks.Plugin): result = imdb_template else: - self.log.error("IMDB OMDB API %s - %s" % (request.status_code, request.text)) + self.log.error("IMDb OMDB API %s - %s" % (request.status_code, request.text)) except requests.exceptions.Timeout as e: - self.log.error("IMDB Timeout: %s" % (str(e))) + self.log.error("IMDb Timeout: %s" % (str(e))) except requests.exceptions.ConnectionError as e: - self.log.error("IMDB ConnectionError: %s" % (str(e))) + self.log.error("IMDb ConnectionError: %s" % (str(e))) except requests.exceptions.HTTPError as e: - self.log.error("IMDB HTTPError: %s" % (str(e))) + self.log.error("IMDb HTTPError: %s" % (str(e))) finally: if result is not None: irc.reply(result) @@ -158,7 +158,7 @@ class IMDB(callbacks.Plugin): imdb = wrap(imdb, ['text']) -Class = IMDB +Class = IMDb # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/IMDB/requirements.txt b/IMDb/requirements.txt similarity index 100% rename from IMDB/requirements.txt rename to IMDb/requirements.txt diff --git a/Jeopardy/README.md b/Jeopardy/README.md index 0fe5c2a..38a3234 100644 --- a/Jeopardy/README.md +++ b/Jeopardy/README.md @@ -1,4 +1,4 @@ -[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=T8E56M6SP9JH2) +A fully-featured and customizable IRC trivia game using an archive of Jeopardy! questions. **Come play in ##Jeopardy on Freenode.** diff --git a/Lyrics/README.md b/Lyrics/README.md index 688b90f..bb646b3 100644 --- a/Lyrics/README.md +++ b/Lyrics/README.md @@ -1,4 +1,3 @@ -# Lyrics Limnoria plugin to return song lyrics from http://lyrics.wikia.com/. Search powered by Google. load plugindownloader diff --git a/Markovgen/README.md b/Markovgen/README.md index a862c12..18a3664 100644 --- a/Markovgen/README.md +++ b/Markovgen/README.md @@ -1,3 +1,5 @@ +Generate markov replies to channel messages. + Forked from: https://github.com/ProgVal/Supybot-plugins/tree/master/Markovgen Additions: diff --git a/NBA/README.md b/NBA/README.md index 574d66e..c1bd830 100644 --- a/NBA/README.md +++ b/NBA/README.md @@ -1,6 +1,4 @@ -# NBAScores - -A [Limnoria](https://github.com/ProgVal/Limnoria) plugin to retrieve NBA basketball scores from NBA.com. +Retrieve NBA basketball scores from NBA.com ## Requirements * Python 3 diff --git a/NHL/README.md b/NHL/README.md index 3d4c327..00e8183 100644 --- a/NHL/README.md +++ b/NHL/README.md @@ -1,6 +1,4 @@ -#NHL - -A [Limnoria](https://github.com/ProgVal/Limnoria) plugin to retrieve NHL hockey scores from NHL.com. +Retrieve NHL hockey scores from NHL.com ## Requirements * Python 3 diff --git a/RPG/README.md b/RPG/README.md index 9f5212c..7a609ac 100644 --- a/RPG/README.md +++ b/RPG/README.md @@ -1,3 +1,3 @@ -RPG. Customizable Role Playing Game for IRC. +Customizable Role Playing Game for IRC. Forked from https://github.com/antb/StewieGriffin/tree/master/Rpg diff --git a/SpiffyTitles/README.md b/SpiffyTitles/README.md index 88c33e8..1a784e2 100644 --- a/SpiffyTitles/README.md +++ b/SpiffyTitles/README.md @@ -1,3 +1,5 @@ +Highly customizable and fully-featured link title snarfer with many URL handlers. + Forked from https://github.com/butterscotchstallion/limnoria-plugins/tree/master/SpiffyTitles If you're coming from another fork of SpiffyTitles, please note that some config variables have changed in this version. Everything is now grouped by url handler; spiffytitles.default, spiffytitles.youtube, spiffytitles.imdb, etc. diff --git a/TVMaze/README.md b/TVMaze/README.md index 01a3aee..7bd3c2d 100644 --- a/TVMaze/README.md +++ b/TVMaze/README.md @@ -1,6 +1,6 @@ -# TVMaze +Fetch TV show information and schedules from the TVMaze API. -## Limnoria plugin to fetch TV show information and schedules from tvmaze.com API +# TVMaze ### Instructions diff --git a/TextArt/README.md b/TextArt/README.md index 7592971..94afcd0 100644 --- a/TextArt/README.md +++ b/TextArt/README.md @@ -1,7 +1,12 @@ +Generate text art from images, text, or scroll text art links. + + [![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=T8E56M6SP9JH2) -Try the plugin out in #ircart on EFnet. irc://irc.efnet.org/#ircart +## Try the plugin out in #ircart on EFnet. + +irc://irc.efnet.org/#ircart TextArt Plugin
diff --git a/TimeBomb/README.md b/TimeBomb/README.md index cab29bc..ae2ece0 100644 --- a/TimeBomb/README.md +++ b/TimeBomb/README.md @@ -1,3 +1,5 @@ +The classic TimeBomb game for IRC. + Forked from https://github.com/quantumlemur/Supybot-Plugins/tree/master/Timebomb Python 3 compatible diff --git a/Trackers/README.md b/Trackers/README.md index 981fbdd..6a30f95 100644 --- a/Trackers/README.md +++ b/Trackers/README.md @@ -1,3 +1,3 @@ -Forked from https://github.com/ormanya/Supyiel/tree/master/Trackers - Provide tracker/site/IRC status for various torrent trackers. + +Forked from https://github.com/ormanya/Supyiel/tree/master/Trackers diff --git a/TriviaTime/README.md b/TriviaTime/README.md index 38895c0..8f91110 100644 --- a/TriviaTime/README.md +++ b/TriviaTime/README.md @@ -1,3 +1,5 @@ +A fully-featured and customizable trivia game similar to Spike's Trivia for eggdrop. + # Configuration Requires Limnoria and Python 3 diff --git a/Tweety/README.md b/Tweety/README.md index 2cd1e0e..455db9e 100644 --- a/Tweety/README.md +++ b/Tweety/README.md @@ -1,3 +1,5 @@ +Retrieve tweets and other assorted info from the Twitter API. + Forked from https://github.com/reticulatingspline/Tweety # Limnoria plugin for Twitter. diff --git a/Uno/README.txt b/UNO/README.md similarity index 91% rename from Uno/README.txt rename to UNO/README.md index 560efeb..9894155 100644 --- a/Uno/README.txt +++ b/UNO/README.md @@ -1,3 +1,5 @@ +The classic card game of UNO for IRC. Play against other chatters or the bot. + Forked from https://github.com/SpiderDave/spidey-supybot-plugins/tree/master/Plugins/Uno This is a Limnoria plugin implementation of UNO. diff --git a/Uno/__init__.py b/UNO/__init__.py similarity index 98% rename from Uno/__init__.py rename to UNO/__init__.py index a64433b..1993f2b 100644 --- a/Uno/__init__.py +++ b/UNO/__init__.py @@ -29,7 +29,7 @@ ### """ -UNO: the uno card game for Limnoria. +UNO: the UNO card game for Limnoria. """ import supybot @@ -62,7 +62,7 @@ if world.testing: from . import test Class = plugin.Class -Uno = config.Uno +UNO = config.UNO # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/Uno/config.py b/UNO/config.py similarity index 95% rename from Uno/config.py rename to UNO/config.py index a97eb68..eb8782b 100644 --- a/Uno/config.py +++ b/UNO/config.py @@ -32,7 +32,7 @@ import supybot.conf as conf import supybot.registry as registry try: from supybot.i18n import PluginInternationalization - _ = PluginInternationalization('Uno') + _ = PluginInternationalization('UNO') except: # Placeholder that allows to run the plugin on a bot # without the i18n module @@ -44,8 +44,8 @@ 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('Uno', True) + conf.registerPlugin('UNO', True) -Uno = conf.registerPlugin('Uno') +UNO = conf.registerPlugin('UNO') # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/Uno/plugin.py b/UNO/plugin.py similarity index 96% rename from Uno/plugin.py rename to UNO/plugin.py index 38cef3f..918f676 100644 --- a/Uno/plugin.py +++ b/UNO/plugin.py @@ -43,18 +43,18 @@ import pickle try: from supybot.i18n import PluginInternationalization - _ = PluginInternationalization('Uno') + _ = PluginInternationalization('UNO') except ImportError: # Placeholder that allows to run the plugin on a bot # without the i18n module _ = lambda x: x -class Uno(callbacks.Plugin): +class UNO(callbacks.Plugin): """ - Uno! + UNO! """ threaded = True - + game=[{},{},{},{},{}] channeloptions = {} @@ -65,9 +65,9 @@ class Uno(callbacks.Plugin): channeloptions['maxbots']=9 channeloptions['use_colors']=True channeloptions['use_notice']=True - + lastgame=time.time() - + def make_sure_path_exists(path): try: os.makedirs(path) @@ -80,9 +80,8 @@ class Uno(callbacks.Plugin): prefixChar = conf.supybot.reply.whenAddressedBy.chars()[0] def start(self, irc, msg, args, text): - """takes no arguments - - Start a new game of Uno. For the rules of the game, use the uno rules command. + """ + Start a new game of UNO. For the rules of the game, use the "uno rules" command. """ try: self._read_options(irc) @@ -109,7 +108,7 @@ class Uno(callbacks.Plugin): gametype=self.game[table].get('type').capitalize() irc.reply('Error: You are already in a game of %s.' % gametype) return - + table=self._getopentable() if table==None: irc.reply('Sorry, all the game tables are in use at the moment.') @@ -118,41 +117,37 @@ class Uno(callbacks.Plugin): self._cleanup(table) self.game[table]['channel']=msg.args[0] self.game[table]['type']=gametype - - + if gametype=='uno': self.game[table]['players'][nick]={} #self.game[table]['nplayers']=int(self.channeloptions[gametype+'_nplayers']) self.game[table]['nplayers']=int(self.channeloptions['nplayers']) irc.reply('%s has started a new game of %s at table %s. For the rules of the game, type "%suno rules". To accept this challenge, join with "%suno join". To add a cpu player, type "%suno join cpu".' % (nick, gametype.capitalize(), table+1, self.prefixChar,self.prefixChar,self.prefixChar), prefixNick=False) self.game[table]['phase']='join' - + start = wrap(start, ['public', optional('something')]) def begin(self, irc, msg, args): """ - begin uno game + Begin the UNO game. """ self._uno_begin(irc, msg.nick) begin = wrap(begin) def _uno_begin(self, irc, nick): - """ - test - """ table=self._gettablefromnick(nick) if table == None: irc.reply('Error: You are not playing a game at any of the tables.') return if self.game[table]['type'] != 'uno': - irc.reply('Error: Not an Uno game.') + irc.reply('Error: Not an UNO game.') return if self.game[table]['phase'] != 'join': irc.reply("Error: You can't use this command right now.") return nplayers= list(self.game[table]['players'].keys()) if len(nplayers) < 2: - irc.reply('Error: You need at least two players for Uno.') + irc.reply('Error: You need at least two players for UNO.') return # start things for real for n in list(self.game[table]['players'].keys()): @@ -178,15 +173,11 @@ class Uno(callbacks.Plugin): self._uno_cpu_play(irc, table) else: return - - + def _uno_tell_status(self, irc, nick): - """ - test - """ table=self._gettablefromnick(nick) if table==None: - irc.reply('Error: You are not playing Uno at any of the tables.') + irc.reply('Error: You are not playing UNO at any of the tables.') return channel=self.game[table]['channel'] opponents=[p for p in list(self.game[table]['players'].keys()) if p!=nick] @@ -265,7 +256,7 @@ class Uno(callbacks.Plugin): if discardcolor in c: return False return True - + unocolors=['Blue','Green','Red','Yellow'] for color in unocolors: if color in card: @@ -300,21 +291,13 @@ class Uno(callbacks.Plugin): def tellstatus(self, irc, msg, args): """ - ? + Tell current UNO status """ self._uno_tell_status(irc, msg.nick) tellstatus=wrap(tellstatus) - def test(self, irc, msg, args): - """ - ? - """ - prefixChar = conf.supybot.reply.whenAddressedBy.chars()[0] - irc.reply(chars) - test=wrap(test) - def rules(self, irc, msg, args, text): - """takes no arguments + """ Display rules for uno. Start a game of uno with the "uno start" command. """ if text: @@ -322,15 +305,14 @@ class Uno(callbacks.Plugin): else: gametype='uno' if gametype=='uno': - irc.reply('Rules for Uno: http://www.wonkavator.com/uno/unorules.html') + irc.reply('Rules for UNO: http://www.wonkavator.com/uno/unorules.html') else: irc.reply('Unknown game type.') rules=wrap(rules, [additional('text')]) - + def join(self, irc, msg, args, table, fakenick): """[] - - Join a game of Uno previously started with the "uno start" command. + Join a game of UNO previously started with the "uno start" command. Specify
if there is more than one game to join in that channel. """ try: @@ -391,11 +373,11 @@ class Uno(callbacks.Plugin): self.game[table]['players'][nick]={} if isfake==True: self.game[table]['players'][nick]['fake']=True - + if len(list(self.game[table]['players'].keys())) < self.game[table]['nplayers']: irc.reply('%s has joined the %s game at table %s. Use %suno begin to begin the game.' % (nick,self.game[table]['type'],table+1, self.prefixChar), prefixNick=False, to=self.game[table]['channel']) return - + for n in list(self.game[table]['players'].keys()): self.game[table]['players'][n]['hand']=[] # each player draws 7 initial cards @@ -420,9 +402,8 @@ class Uno(callbacks.Plugin): join = wrap(join, ['public', optional('int'), optional('something')]) def leave(self, irc, msg, args, fakenick): - """takes no arguments - - Leave a game of Uno. + """ + Leave a game of UNO. """ try: self._read_options(irc) @@ -439,7 +420,7 @@ class Uno(callbacks.Plugin): if table==None: irc.reply('Error: You are not playing a game at any of the tables.') return - + if self.game[table].get('type')=='uno': self._leavegame(irc, msg, nick) self._uno_do_cpu(irc, table) # only works if game type is uno @@ -447,9 +428,8 @@ class Uno(callbacks.Plugin): leave = wrap(leave, ['public', optional('something')]) def _leavegame(self, irc, msg, nick): - """takes no arguments - - Leave a game of Uno. + """ + Leave a game of UNO. """ try: self._read_options(irc) @@ -462,29 +442,28 @@ class Uno(callbacks.Plugin): table=self._gettablefromnick(nick) if table==None: return - - + channel=self.game[table]['channel'] - + # leaving a game when you're the only player if len(self.game[table]['players'])==1: irc.reply('There are no more players; The game is over.', to=channel) self.game[table]['phase']='gameover' self._cleanup(table) return - + # check if it's only bot players left Human=False for n in list(self.game[table]['players'].keys()): if not self.game[table]['players'][n].get('cpu'): if n!=nick: Human=True - + if not Human: irc.reply('There are no more human players; the game is over.', to=channel) self.game[table]['phase']='gameover' self._cleanup(table) return - + # ---- replace with cpu ---- oldnick=nick nick=self._uno_make_cpu(table) @@ -551,18 +530,18 @@ class Uno(callbacks.Plugin): def _uno_cpu_play(self, irc, table): channel=self.game[table]['channel'] - + Human=False for n in list(self.game[table]['players'].keys()): if not self.game[table]['players'][n].get('cpu'): Human=True - + if not Human: irc.reply('There are no more human players; the game is over.', to=channel) self.game[table]['phase']='gameover' self._cleanup(table) return - + nick=list(self.game[table]['players'].keys())[self.game[table]['turn']] discard=self.game[table]['discard'][-1] wildcolor = self.game[table].get('wildcolor') @@ -574,7 +553,7 @@ class Uno(callbacks.Plugin): # draw a card card=self._uno_draw_card(table, nick) self.game[table]['players'][nick]['hasdrawn']=True - + if self._uno_is_valid_play(table, card, discard, wildcolor)==True: # always play the card if possible ncards=len(self.game[table]['players'][nick]['hand']) @@ -651,12 +630,11 @@ class Uno(callbacks.Plugin): def play(self, irc, msg, args, text): """ - - Play a for the Uno game. Examples: "uno play red 0", "uno play wild blue", "uno play draw", "uno play done" + Play a for the UNO game. Examples: "uno play red 0", "uno play wild blue", "uno play draw", "uno play done" """ nick=msg.nick - + table=self._gettablefromnick(nick) if table==None: irc.reply('Error: You are not playing a game at any of the tables.') @@ -670,30 +648,30 @@ class Uno(callbacks.Plugin): fakenick=fakenick[0] nick=fakenick text=text.rsplit(' ',1)[:-1][0] - + if self.game[table]['phase']=='running': nplayers=len(list(self.game[table]['players'].keys())) if nick not in self.game[table]['players']: irc.reply("Error: You're not playing this game.") return opponent=[p for p in self.game[table]['players'] if p !=nick][0] - + turnplayer=list(self.game[table]['players'].keys())[self.game[table]['turn']] if nick!=turnplayer: # Note: it will prefix nick in notice -- need to fix that irc.reply("%s: It is %s's turn." % (nick, turnplayer), prefixNick=False) return - + text=text.strip() - + discard=self.game[table]['discard'][-1] wildcolor=self.game[table].get('wildcolor') novalid=True - + for c in self.game[table]['players'][nick]['hand']: if self._uno_is_valid_play(table, c, discard, wildcolor)==True: novalid=False - + if text.lower()=='draw': if self.game[table]['players'][nick].get('hasdrawn')==True: irc.reply('You have already drawn a card.') @@ -742,9 +720,9 @@ class Uno(callbacks.Plugin): self._uno_tell_status(irc, nn) self._uno_do_cpu(irc, table) return - + card=text - + card=[card for card in self.unodeck if card.lower()==text.lower()] validwild=['Wild Blue','Wild Green', 'Wild Red', 'Wild Yellow', 'Wild Draw 4 Blue','Wild Draw 4 Green', 'Wild Draw 4 Red', 'Wild Draw 4 Yellow'] @@ -769,16 +747,16 @@ class Uno(callbacks.Plugin): if card not in hand: irc.reply('That card is not in your hand.') return - + # check for illegal move if self._uno_is_valid_play(table, card, discard, wildcolor)==False: irc.reply("You can't play that card.") return - + # play the card self.game[table]['players'][nick]['hand'].remove(card) self.game[table]['discard'].append(card) - ncards=len(self.game[table]['players'][nick]['hand']) + ncards=len(self.game[table]['players'][nick]['hand']) if 'Wild' in card: self.game[table]['wildcolor']=newcolor card='%s (%s)' % (card, self.game[table]['wildcolor']) @@ -802,7 +780,7 @@ class Uno(callbacks.Plugin): self.game[table]['players'][nick]['hasdrawn']=False else: irc.reply('%s played %s (%s cards left in hand).' % (nick, card, ncards), to=channel) - + ncards = len(self.game[table]['players'][nick]['hand']) if ncards==0: irc.reply('The game is over. '+ircutils.bold('%s wins!' % nick), to=channel) @@ -812,7 +790,7 @@ class Uno(callbacks.Plugin): if 'Reverse' in card: self.game[table]['direction']*=-1 - + turn=self.game[table]['turn']+1*self.game[table]['direction'] if turn>nplayers-1:turn=0 if turn<0:turn=nplayers-1 @@ -844,9 +822,9 @@ class Uno(callbacks.Plugin): def setoption(self, irc, msg, args, channel, text, value): """