diff --git a/Azure/__init__.py b/Azure/__init__.py index a6a9f3e..03bb403 100644 --- a/Azure/__init__.py +++ b/Azure/__init__.py @@ -1,5 +1,5 @@ ### -# Copyright (c) 2020, oddluck +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,11 +25,10 @@ # 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. - ### """ -Access Azure APIs +Azure: Access Microsoft Azure APIs """ import supybot @@ -38,7 +37,7 @@ import imp # 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('oddluck', 'oddluck', 'oddluck@riseup.net') diff --git a/Azure/config.py b/Azure/config.py index 34e5e5b..0805066 100644 --- a/Azure/config.py +++ b/Azure/config.py @@ -1,6 +1,30 @@ ### -# Copyright (c) 2020, oddluck +# Copyright (c) 2020, oddluck # 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 diff --git a/Azure/plugin.py b/Azure/plugin.py index ba369c7..fd68775 100644 --- a/Azure/plugin.py +++ b/Azure/plugin.py @@ -1,5 +1,5 @@ ### -# Copyright (c) 2020, oddluck +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/BadWords/__init__.py b/BadWords/__init__.py index 484c47f..86000f4 100644 --- a/BadWords/__init__.py +++ b/BadWords/__init__.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2005, Jeremiah Fincher +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -28,8 +29,8 @@ ### """ -Filters bad words on outgoing messages from the bot, so the bot can't be made -to say bad words. +BadWords: filters bad words on outgoing/incoming messages so the bot can't be +made to say bad words. """ import supybot @@ -37,7 +38,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.authors.jemfinch diff --git a/BadWords/config.py b/BadWords/config.py index d3d81ac..893a20c 100644 --- a/BadWords/config.py +++ b/BadWords/config.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2005, Jeremiah Fincher +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/BadWords/plugin.py b/BadWords/plugin.py index baaa2a6..8e98a97 100644 --- a/BadWords/plugin.py +++ b/BadWords/plugin.py @@ -1,6 +1,7 @@ ### -# Copyright (c) 2002-2004, Jeremiah Fincher +# Copyright (c) 2004, Jeremiah Fincher # Copyright (c) 2009, James McCoy +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/BadWords/test.py b/BadWords/test.py index 06efc0d..e42adc0 100644 --- a/BadWords/test.py +++ b/BadWords/test.py @@ -1,5 +1,6 @@ ### -# Copyright (c) 2002-2004, Jeremiah Fincher +# Copyright (c) 2004, Jeremiah Fincher +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/BotLibre/__init__.py b/BotLibre/__init__.py index 315e181..6bfb9c3 100644 --- a/BotLibre/__init__.py +++ b/BotLibre/__init__.py @@ -1,67 +1,65 @@ -### -# Copyright (c) 2019, oddluck -# 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. - -### - -""" -Enables the bot to respond to humans via the -BotLibre 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('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 - -reload(config) -reload(plugin) - -if world.testing: - from . import test - -Class = plugin.Class -configure = config.configure - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: +### +# Copyright (c) 2020, oddluck +# 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. +### + +""" +BotLibre: Enables the bot to respond via the BotLibre 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__ = "2020.02.24+git" + +# XXX Replace this with an appropriate author or supybot.Author instance. +__author__ = 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 + +reload(config) +reload(plugin) + +if world.testing: + from . import test + +Class = plugin.Class +configure = config.configure + +# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/BotLibre/config.py b/BotLibre/config.py index 9dca1b6..cd0662c 100644 --- a/BotLibre/config.py +++ b/BotLibre/config.py @@ -1,56 +1,55 @@ -### -# Copyright (c) 2015, Michael Daniel Telatynski -# 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('BotLibre') -except: - _ = lambda x: x - -def configure(advanced): - from supybot.questions import expect, anything, something, yn - conf.registerPlugin('BotLibre', True) - if advanced: - output('The BotLibre Plugin allows you to interact with Bot Libre') - -BotLibre = conf.registerPlugin('BotLibre') - -conf.registerChannelValue(BotLibre, 'invalidCommand', - registry.Boolean(False, _("""Should I be invoked on Invalid Commands?"""))) -conf.registerGlobalValue(BotLibre, 'application', - registry.String('', _("""The BotLibre API Application String - (required)"""), private=True)) -conf.registerGlobalValue(BotLibre, 'instance', - registry.String('', _("""The BotLibre API Instance String - (required)"""), private=True)) - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: +### +# Copyright (c) 2020, oddluck +# 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('BotLibre') +except: + _ = lambda x: x + +def configure(advanced): + from supybot.questions import expect, anything, something, yn + conf.registerPlugin('BotLibre', True) + if advanced: + output('The BotLibre Plugin allows you to interact with Bot Libre') + +BotLibre = conf.registerPlugin('BotLibre') + +conf.registerChannelValue(BotLibre, 'invalidCommand', + registry.Boolean(False, _("""Should I be invoked on Invalid Commands?"""))) +conf.registerGlobalValue(BotLibre, 'application', + registry.String('', _("""The BotLibre API Application String + (required)"""), private=True)) +conf.registerGlobalValue(BotLibre, 'instance', + registry.String('', _("""The BotLibre API Instance String + (required)"""), private=True)) + +# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/BotLibre/plugin.py b/BotLibre/plugin.py index b6ba5be..37077f4 100644 --- a/BotLibre/plugin.py +++ b/BotLibre/plugin.py @@ -1,103 +1,102 @@ -### -# Copyright (c) 2019, oddluck -# 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.commands import * -import supybot.conf as conf -import supybot.utils as utils -import supybot.plugins as plugins -import supybot.callbacks as callbacks -import re - -import requests - -try: - from supybot.i18n import PluginInternationalization - _ = PluginInternationalization('BotLibre') -except ImportError: - _ = lambda x: x - - -class BotLibre(callbacks.Plugin): - """BotLibre API Interface""" - threaded = True - public = True - botNick = False - - def __init__(self, irc): - self.__parent = super(BotLibre, self) - self.__parent.__init__(irc) - self.url = 'https://www.botlibre.com/rest/json/chat' - self.conversation = {} - - def _queryBot(self, irc, channel, text): - text = re.sub('fuck', 'screw', text, flags=re.IGNORECASE) - text = re.sub('cunt', 'pussy', text, flags=re.IGNORECASE) - text = re.sub('bitch', '', text, flags=re.IGNORECASE) - text = re.sub('whore', 'slut', text, flags=re.IGNORECASE) - self.conversation.setdefault(channel, None) - if self.conversation[channel]: - payload = { - 'application': self.registryValue('application'), - 'instance': self.registryValue('instance'), - 'message': text, - 'conversation': self.conversation[channel] - } - else: - payload = { - 'application': self.registryValue('application'), - 'instance': self.registryValue('instance'), - 'message': text - } - try: - r = requests.post(self.url, json=payload) - j = r.json() - response = j['message'] - self.conversation[channel] = j['conversation'] - if response: - irc.reply(re.sub('<[^<]+?>', '', j['message'])) - except: - return - - def botlibre(self, irc, msg, args, text): - """Manual Call to the BotLibre API""" - channel = msg.args[0] - if not irc.isChannel(channel): - channel = msg.nick - self._queryBot(irc, channel, text) - botlibre = wrap(botlibre, ['text']) - - def invalidCommand(self, irc, msg, tokens): - chan = msg.args[0] - if irc.isChannel(chan) and self.registryValue('invalidCommand', chan): - self._queryBot(irc, chan, msg.args[1][1:].strip()) - -Class = BotLibre - -# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: +### +# Copyright (c) 2020, oddluck +# 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.commands import * +import supybot.conf as conf +import supybot.utils as utils +import supybot.plugins as plugins +import supybot.callbacks as callbacks +import re + +import requests + +try: + from supybot.i18n import PluginInternationalization + _ = PluginInternationalization('BotLibre') +except ImportError: + _ = lambda x: x + + +class BotLibre(callbacks.Plugin): + """BotLibre API Interface""" + threaded = True + public = True + botNick = False + + def __init__(self, irc): + self.__parent = super(BotLibre, self) + self.__parent.__init__(irc) + self.url = 'https://www.botlibre.com/rest/json/chat' + self.conversation = {} + + def _queryBot(self, irc, channel, text): + text = re.sub('fuck', 'screw', text, flags=re.IGNORECASE) + text = re.sub('cunt', 'pussy', text, flags=re.IGNORECASE) + text = re.sub('bitch', '', text, flags=re.IGNORECASE) + text = re.sub('whore', 'slut', text, flags=re.IGNORECASE) + self.conversation.setdefault(channel, None) + if self.conversation[channel]: + payload = { + 'application': self.registryValue('application'), + 'instance': self.registryValue('instance'), + 'message': text, + 'conversation': self.conversation[channel] + } + else: + payload = { + 'application': self.registryValue('application'), + 'instance': self.registryValue('instance'), + 'message': text + } + try: + r = requests.post(self.url, json=payload) + j = r.json() + response = j['message'] + self.conversation[channel] = j['conversation'] + if response: + irc.reply(re.sub('<[^<]+?>', '', j['message'])) + except: + return + + def botlibre(self, irc, msg, args, text): + """Manual Call to the BotLibre API""" + channel = msg.args[0] + if not irc.isChannel(channel): + channel = msg.nick + self._queryBot(irc, channel, text) + botlibre = wrap(botlibre, ['text']) + + def invalidCommand(self, irc, msg, tokens): + chan = msg.args[0] + if irc.isChannel(chan) and self.registryValue('invalidCommand', chan): + self._queryBot(irc, chan, msg.args[1][1:].strip()) + +Class = BotLibre + +# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/BotLibre/test.py b/BotLibre/test.py deleted file mode 100644 index 2d1e191..0000000 --- a/BotLibre/test.py +++ /dev/null @@ -1,36 +0,0 @@ -### -# Copyright (c) 2015, Michael Daniel Telatynski -# 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 ReplacerTestCase(PluginTestCase): - plugins = ('BotLibre',) - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/CAH/__init__.py b/CAH/__init__.py index 74dbfa1..43b1091 100644 --- a/CAH/__init__.py +++ b/CAH/__init__.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2012, James Scott +# Copyright (c) 2020, oddluck # 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. ### """ @@ -16,7 +39,7 @@ import importlib # 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('James Scott', 'jazzahn', '') diff --git a/CAH/cah.py b/CAH/cah.py index bfe26e6..1652011 100644 --- a/CAH/cah.py +++ b/CAH/cah.py @@ -1,3 +1,33 @@ +### +# Copyright (c) 2012, James Scott +# Copyright (c) 2020, oddluck +# 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 random import choice import os import json diff --git a/CAH/config.py b/CAH/config.py index b65d3f0..c646c54 100644 --- a/CAH/config.py +++ b/CAH/config.py @@ -1,7 +1,8 @@ ### # Copyright (c) 2012, James Scott +# Copyright (c) 2020, oddluck # All rights reserved. -# +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # @@ -25,7 +26,6 @@ # 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 diff --git a/CAH/plugin.py b/CAH/plugin.py index 09ab04a..6f2d793 100644 --- a/CAH/plugin.py +++ b/CAH/plugin.py @@ -1,7 +1,8 @@ ### # Copyright (c) 2012, James Scott +# Copyright (c) 2020, oddluck # All rights reserved. -# +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # @@ -25,8 +26,8 @@ # 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.utils as utils from supybot.commands import * import supybot.plugins as plugins diff --git a/CAH/test.py b/CAH/test.py index 3f25f52..e5200bb 100644 --- a/CAH/test.py +++ b/CAH/test.py @@ -1,93 +1,123 @@ -__author__ = 'Bear' - -from .cah import * - -def test_cards_will_be_unique(deck=None, player_list = None): - """ - Ensure that when a hand is created the proper cards are removed from the deck. - """ - if deck is None: - deck=Deck() - if player_list is None: - player_list = {'one': PlayerHand(deck),'two': PlayerHand(deck) } - for value in list(player_list.values()): - for card in value.card_list: - assert card.text not in deck.answerDb - -def test_card_parsing(deck=None): - """ - This test checks that the cards in a deck are correctly built Card objects - """ - if deck is None: - deck = Deck() - for deck_type in [deck.answerDb, deck.questionDb]: - for card in deck_type: - test_card(card) - -def test_game(): - game = Game(['Bear','Swim', 'Jazz']) - test_cards_will_be_unique(deck=game.deck, player_list= game.players) - for player in list(game.players.keys()): - hand = game.players[player] - test_player_hand(hand) - test_round_advancement(game) - - - -def test_round_advancement(game=None): - if game is None: - game = Game(['Bear','Swim', 'Jazz']) - assert game.round is None - assert game.question is None - while round < game.round_limit: - bot_gets = game.next_round() - assert isinstance(bot_gets, dict) - assert 'question' in bot_gets - assert 'question' in game - assert 'hands' in bot_gets - test_end_round(game) - -def build_end_round_data(game): - winner = choice(list(game.players.keys())) - cards_played = {} - #Get random cards from player's hand to satisfy the question card - for player in list(game.players.keys()): - player_cards = game.players[player].card_list[:game.question.answers] - cards_played[player] = player_cards #player_cards is a deque object -> tuple(list,maxlen) - return {'winner': winner, 'cards_played': cards_played} - -def test_end_round(game=None): - if game is None: - game = Game(['Bear','Swim', 'Jazz']) - game.next_round() - game.question.answers = 2 - fake_end_round = build_end_round_data(game) - game.end_round(fake_end_round['winner'],fake_end_round['cards_played']) - for player in list(game.players.keys()): - assert len(game.players[player].card_list) == 5 - if isinstance(fake_end_round['cards_played'][player], Card): - fake_end_round['cards_played'][player] = list(fake_end_round['cards_played'][player]) - for card in fake_end_round['cards_played'][player]: - assert card not in game.players[player].card_list - assert fake_end_round['winner'] in game.score - - -def test_player_hand(hand=None): - if hand is None: - hand = PlayerHand(Deck()) - assert type(hand) is PlayerHand - for count, card in enumerate(hand.card_list): - assert count < 5 - assert type(card) is Card - -def test_card(card=None): - if card is None: - card = Deck().drawCard('question') - assert type(card) is Card - assert type(card.id) is int - assert type(card.type) is str - assert card.type in ['answer', 'question'] - assert type(card.text) is str - assert card.text.find('\n') is -1 - if card.type is 'question': - assert type(card.answers) is int +### +# Copyright (c) 2012, James Scott +# Copyright (c) 2020, oddluck +# 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. +### + +__author__ = 'Bear' + +from .cah import * + +def test_cards_will_be_unique(deck=None, player_list = None): + """ + Ensure that when a hand is created the proper cards are removed from the deck. + """ + if deck is None: + deck=Deck() + if player_list is None: + player_list = {'one': PlayerHand(deck),'two': PlayerHand(deck) } + for value in list(player_list.values()): + for card in value.card_list: + assert card.text not in deck.answerDb + +def test_card_parsing(deck=None): + """ + This test checks that the cards in a deck are correctly built Card objects + """ + if deck is None: + deck = Deck() + for deck_type in [deck.answerDb, deck.questionDb]: + for card in deck_type: + test_card(card) + +def test_game(): + game = Game(['Bear','Swim', 'Jazz']) + test_cards_will_be_unique(deck=game.deck, player_list= game.players) + for player in list(game.players.keys()): + hand = game.players[player] + test_player_hand(hand) + test_round_advancement(game) + + + +def test_round_advancement(game=None): + if game is None: + game = Game(['Bear','Swim', 'Jazz']) + assert game.round is None + assert game.question is None + while round < game.round_limit: + bot_gets = game.next_round() + assert isinstance(bot_gets, dict) + assert 'question' in bot_gets + assert 'question' in game + assert 'hands' in bot_gets + test_end_round(game) + +def build_end_round_data(game): + winner = choice(list(game.players.keys())) + cards_played = {} + #Get random cards from player's hand to satisfy the question card + for player in list(game.players.keys()): + player_cards = game.players[player].card_list[:game.question.answers] + cards_played[player] = player_cards #player_cards is a deque object -> tuple(list,maxlen) + return {'winner': winner, 'cards_played': cards_played} + +def test_end_round(game=None): + if game is None: + game = Game(['Bear','Swim', 'Jazz']) + game.next_round() + game.question.answers = 2 + fake_end_round = build_end_round_data(game) + game.end_round(fake_end_round['winner'],fake_end_round['cards_played']) + for player in list(game.players.keys()): + assert len(game.players[player].card_list) == 5 + if isinstance(fake_end_round['cards_played'][player], Card): + fake_end_round['cards_played'][player] = list(fake_end_round['cards_played'][player]) + for card in fake_end_round['cards_played'][player]: + assert card not in game.players[player].card_list + assert fake_end_round['winner'] in game.score + + +def test_player_hand(hand=None): + if hand is None: + hand = PlayerHand(Deck()) + assert type(hand) is PlayerHand + for count, card in enumerate(hand.card_list): + assert count < 5 + assert type(card) is Card + +def test_card(card=None): + if card is None: + card = Deck().drawCard('question') + assert type(card) is Card + assert type(card.id) is int + assert type(card.type) is str + assert card.type in ['answer', 'question'] + assert type(card.text) is str + assert card.text.find('\n') is -1 + if card.type is 'question': + assert type(card.answers) is int diff --git a/CBB/__init__.py b/CBB/__init__.py index f10605f..55b5585 100644 --- a/CBB/__init__.py +++ b/CBB/__init__.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2018, cottongin +# Copyright (c) 2020, oddluck # 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. ### """ @@ -15,7 +38,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('cottongin', 'cottongin', diff --git a/CBB/config.py b/CBB/config.py index 9248f19..f601c8d 100644 --- a/CBB/config.py +++ b/CBB/config.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2018, cottongin +# Copyright (c) 2020, oddluck # 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 import conf, registry diff --git a/CBB/plugin.py b/CBB/plugin.py index e467a9f..c766dd7 100644 --- a/CBB/plugin.py +++ b/CBB/plugin.py @@ -1,9 +1,31 @@ ### # Copyright (c) 2018, cottongin +# Copyright (c) 2020, oddluck # All rights reserved. # -# SEE LICENSE.txt +# 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 pendulum diff --git a/CFB/__init__.py b/CFB/__init__.py index e35e03a..c69303a 100644 --- a/CFB/__init__.py +++ b/CFB/__init__.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2018, cottongin +# Copyright (c) 2020, oddluck # 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. ### """ @@ -15,7 +38,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('cottongin', 'cottongin', diff --git a/CFB/config.py b/CFB/config.py index 5f7d8c9..abc1a45 100644 --- a/CFB/config.py +++ b/CFB/config.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2018, cottongin +# Copyright (c) 2020, oddluck # 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 import conf, registry diff --git a/CFB/plugin.py b/CFB/plugin.py index b825d8d..fd2d488 100644 --- a/CFB/plugin.py +++ b/CFB/plugin.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2018, cottongin +# Copyright (c) 2020, oddluck # 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 requests diff --git a/Cayenne/__init__.py b/Cayenne/__init__.py index c00690c..9d57c48 100644 --- a/Cayenne/__init__.py +++ b/Cayenne/__init__.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2015, butterscotchstallion +# Copyright (c) 2020, oddluck # 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. ### """ @@ -14,7 +37,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('butterscotchstallion', 'butterscotchstallion', diff --git a/Cayenne/config.py b/Cayenne/config.py index 2d1855f..b242f32 100644 --- a/Cayenne/config.py +++ b/Cayenne/config.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2015, butterscotchstallion +# Copyright (c) 2020, oddluck # 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 diff --git a/Cayenne/plugin.py b/Cayenne/plugin.py index 4a0ea50..c0d681a 100644 --- a/Cayenne/plugin.py +++ b/Cayenne/plugin.py @@ -1,10 +1,33 @@ -# -*- coding: utf-8 -*- -""" -Cayenne - Displays cat facts or cat gifs based on probability +### +# Copyright (c) 2015, butterscotchstallion +# Copyright (c) 2020, oddluck +# 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. +### -Copyright (c) 2015, butterscotchstallion -All rights reserved. -""" import supybot.utils as utils from supybot.commands import * import supybot.ircmsgs as ircmsgs diff --git a/Cobe/__init__.py b/Cobe/__init__.py index a7a5bb5..9d2c173 100644 --- a/Cobe/__init__.py +++ b/Cobe/__init__.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2015, waratte +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -28,8 +29,7 @@ ### """ -Add a description of the plugin (to be presented to the user inside the wizard) -here. This should describe *what* the plugin does. +Cobe: Uses the Cobe library for Markov generation of chat replies """ import supybot @@ -37,7 +37,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('waratte', 'waratte', '') diff --git a/Cobe/config.py b/Cobe/config.py index 1284fa1..d0dce2a 100644 --- a/Cobe/config.py +++ b/Cobe/config.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2015, waratte +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/Cobe/plugin.py b/Cobe/plugin.py index 8269081..21f6a91 100644 --- a/Cobe/plugin.py +++ b/Cobe/plugin.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2015, waratte +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/Cobe/test.py b/Cobe/test.py deleted file mode 100644 index 57d055b..0000000 --- a/Cobe/test.py +++ /dev/null @@ -1,36 +0,0 @@ -### -# Copyright (c) 2015, waratte -# 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 CobeTestCase(PluginTestCase): - plugins = ('Cobe',) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/Dice/__init__.py b/Dice/__init__.py index ca1ef81..d8ff78d 100644 --- a/Dice/__init__.py +++ b/Dice/__init__.py @@ -1,5 +1,6 @@ ### -# Copyright (c) 2007-2010, Andrey Rahmatullin +# Copyright (c) 2010, Andrey Rahmatullin +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -28,7 +29,7 @@ ### """ -Dice +Dice: commands for dice rolling. """ import supybot @@ -36,7 +37,7 @@ 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__ = "" +__version__ = "2020.02.24+git" __author__ = supybot.Author('Andrey Rahmatullin', 'wRAR', 'wrar@wrar.name') __maintainer__ = getattr(supybot.authors, 'oddluck', diff --git a/Dice/config.py b/Dice/config.py index ce97dbd..9363e3d 100644 --- a/Dice/config.py +++ b/Dice/config.py @@ -1,5 +1,6 @@ ### -# Copyright (c) 2007-2008, Andrey Rahmatullin +# Copyright (c) 2008, Andrey Rahmatullin +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/Dice/deck.py b/Dice/deck.py index 7e28cf3..139b2f1 100644 --- a/Dice/deck.py +++ b/Dice/deck.py @@ -1,6 +1,7 @@ ### # Copyright (c) 2008, Anatoly Popov # Copyright (c) 2008, Andrey Rahmatullin +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/Dice/plugin.py b/Dice/plugin.py index e82dc7f..2b2e54c 100644 --- a/Dice/plugin.py +++ b/Dice/plugin.py @@ -1,5 +1,6 @@ ### -# Copyright (c) 2007-2010, Andrey Rahmatullin +# Copyright (c) 2008, Andrey Rahmatullin +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/Dice/sevenSea2EdRaiseRoller.py b/Dice/sevenSea2EdRaiseRoller.py index bce0563..63bfa1e 100644 --- a/Dice/sevenSea2EdRaiseRoller.py +++ b/Dice/sevenSea2EdRaiseRoller.py @@ -1,6 +1,7 @@ ### # Copyright (c) 2018, Anatoly Popov # Copyright (c) 2018, Andrey Rahmatullin +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/Dice/test.py b/Dice/tests/test.py similarity index 98% rename from Dice/test.py rename to Dice/tests/test.py index dba11b4..d304386 100644 --- a/Dice/test.py +++ b/Dice/tests/test.py @@ -1,5 +1,6 @@ ### -# Copyright (c) 2007-2010, Andrey Rahmatullin +# Copyright (c) 2010, Andrey Rahmatullin +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/Dice/test_Raise.py b/Dice/tests/test_Raise.py similarity index 97% rename from Dice/test_Raise.py rename to Dice/tests/test_Raise.py index 001736f..0a1b0e5 100644 --- a/Dice/test_Raise.py +++ b/Dice/tests/test_Raise.py @@ -1,6 +1,7 @@ ### # Copyright (c) 2018, Anatoly Popov # Copyright (c) 2018, Andrey Rahmatullin +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/Dice/test_RollResult.py b/Dice/tests/test_RollResult.py similarity index 98% rename from Dice/test_RollResult.py rename to Dice/tests/test_RollResult.py index 788278a..afb8168 100644 --- a/Dice/test_RollResult.py +++ b/Dice/tests/test_RollResult.py @@ -1,6 +1,7 @@ ### # Copyright (c) 2018, Anatoly Popov # Copyright (c) 2018, Andrey Rahmatullin +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/Dice/test_Roller.py b/Dice/tests/test_Roller.py similarity index 99% rename from Dice/test_Roller.py rename to Dice/tests/test_Roller.py index f4b9fac..0ebe367 100644 --- a/Dice/test_Roller.py +++ b/Dice/tests/test_Roller.py @@ -1,6 +1,7 @@ ### # Copyright (c) 2018, Anatoly Popov # Copyright (c) 2018, Andrey Rahmatullin +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/DuckHunt/__init__.py b/DuckHunt/__init__.py index 31ebeb2..a150954 100644 --- a/DuckHunt/__init__.py +++ b/DuckHunt/__init__.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2012, Matthias Meusburger +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,11 +26,10 @@ # 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. - ### """ -This is a DuckHunt game for supybot +DuckHunt: an IRC Duck Hunt game for Limnoria """ import supybot @@ -38,7 +38,7 @@ import importlib # 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('Matthias Meusburger', 'veggiematts', '') diff --git a/DuckHunt/config.py b/DuckHunt/config.py index 8260b0e..c4f3cdb 100644 --- a/DuckHunt/config.py +++ b/DuckHunt/config.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2012, Matthias Meusburger +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/DuckHunt/plugin.py b/DuckHunt/plugin.py index 5e7fbc3..8acdac1 100644 --- a/DuckHunt/plugin.py +++ b/DuckHunt/plugin.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2012, Matthias Meusburger +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/DuckHunt/test.py b/DuckHunt/test.py index 20ebafe..b92d3e3 100644 --- a/DuckHunt/test.py +++ b/DuckHunt/test.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2012, Matthias Meusburger +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/Fun/__init__.py b/Fun/__init__.py index 7363b76..671cf77 100644 --- a/Fun/__init__.py +++ b/Fun/__init__.py @@ -1,8 +1,30 @@ ### -# Copyright (c) 2019 oddluck +# Copyright (c) 2020, oddluck # 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. ### """ @@ -14,7 +36,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('oddluck', 'oddluck', diff --git a/Fun/config.py b/Fun/config.py index 2c6420e..2ef088a 100644 --- a/Fun/config.py +++ b/Fun/config.py @@ -1,8 +1,30 @@ ### -# Copyright (c) 2019, oddluck +# Copyright (c) 2020, oddluck # 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 diff --git a/Fun/plugin.py b/Fun/plugin.py index 30c6389..a9c0757 100644 --- a/Fun/plugin.py +++ b/Fun/plugin.py @@ -1,411 +1,433 @@ -### -# Copyright (c) 2019 oddluck -# All rights reserved. -# -# -### - -import supybot.utils as utils -from supybot.commands import * -import supybot.plugins as plugins -import supybot.ircutils as ircutils -import supybot.callbacks as callbacks -import supybot.ircmsgs as ircmsgs -import random -import requests -from bs4 import BeautifulSoup -import codecs -import os -import collections - -try: - from supybot.i18n import PluginInternationalization - _ = PluginInternationalization('Weed') -except ImportError: - # Placeholder that allows to run the plugin on a bot - # without the i18n module - _ = lambda x: x - -class Fun(callbacks.Plugin): - """Uses API to retrieve information""" - threaded = True - - def advice(self, irc, msg, args): - """ - Get some advice - """ - - channel = msg.args[0] - data = requests.get("https://api.adviceslip.com/advice").json() - irc.reply(data['slip']['advice']) - - advice = wrap(advice) - - def joke(self, irc, msg, args): - """ - Get a joke - """ - - channel = msg.args[0] - headers = { - 'Accept': 'application/json', - } - data = requests.get('https://icanhazdadjoke.com/', headers=headers).json() - irc.reply(data['joke'].replace('\n', '').replace('\r', '').replace('\t', '')) - - joke = wrap(joke) - - def catfact(self, irc, msg, args): - """ - Cat fact - """ - - channel = msg.args[0] - data = requests.get("https://catfact.ninja/fact").json() - irc.reply(data['fact']) - - catfact = wrap(catfact) - - def useless(self, irc, msg, args): - """ - Useless fact - """ - - channel = msg.args[0] - data = requests.get("https://uselessfacts.jsph.pl/random.json?language=en").json() - irc.reply(data['text']) - - useless = wrap(useless) - - def buzz(self, irc, msg, args): - """ - Corporate buzzord generator - """ - channel = msg.args[0] - data = requests.get("https://corporatebs-generator.sameerkumar.website").json() - irc.reply(data['phrase']) - buzz = wrap(buzz) - - def startup(self, irc, msg, args): - """ - Startup generator - """ - channel = msg.args[0] - data = requests.get("http://itsthisforthat.com/api.php?json").json() - vowels = ('a','e','i','o','u','A','E','I','O','U') - if data['this'].startswith(vowels): - response = "So, Basically, It\'s Like An {0} for {1}".format(data['this'], data['that']) - else: - response = "So, Basically, It\'s Like A {0} for {1}".format(data['this'], data['that']) - irc.reply(response) - startup = wrap(startup) - - def insult(self, irc, msg, args, nick): - """[] - Insult generator. Optionally send insult to ( must be in channel). - """ - channel = msg.args[0] - data = requests.get("https://insult.mattbas.org/api/en/insult.json").json() - if nick: - response = "{0}: {1}".format(nick, data['insult']) - irc.reply(response, prefixNick=False) - else: - irc.reply(data['insult']) - insult = wrap(insult, [additional('nickInChannel')]) - - def devexcuse(self, irc, msg, args): - """ - Returns an excuse from http://developerexcuses.com - """ - data = requests.get('http://developerexcuses.com') - if not data: # http fetch breaks. - irc.reply("ERROR") - return - soup = BeautifulSoup(data.text) - text = soup.find('center').getText() - irc.reply("{0}".format(text)) - devexcuse = wrap(devexcuse) - - def _pigword(self, word): - shouldCAP = (word[:1] == word[:1].upper()) - word = word.lower() - letters = "qwertyuiopasdfghjklzxcvbnm" - i = len(word) - 1 - while i >= 0 and letters.find(word[i]) == -1: - i = i - 1 - if i == -1: - return word - punctuation = word[i+1:] - word = word[:i+1] - - vowels = "aeiou" - if vowels.find(word[0]) >= 0: - word = word + "yay" + punctuation - else: - word = word[1:] + word[0] + "ay" + punctuation - - if shouldCAP: - return word[:1].upper() + word[1:] - else: - return word - - def piglatin(self, irc, msg, args, optinput): - """ - Convert text from English to Pig Latin. - """ - - l = optinput.split(" ") - for i in range(len(l)): - l[i] = self._pigword(l[i]) - - irc.reply(" ".join(l)) - piglatin = wrap(piglatin, [('text')]) - - - def bofh(self, irc, msg, args): - """ - BOFH (Bastard Operator From Hell) Excuse Generator - """ - data = open("{0}/excuses.txt".format(os.path.dirname(os.path.abspath(__file__)))) - text = data.read() - reply = text.splitlines() - excuse = random.randrange(0, len(reply)) - irc.reply(reply[excuse]) - bofh = wrap(bofh) - - def rock(self, irc, msg, args): - """takes no arguments - - Choose rock in Rock, Paper, Scissors. - """ - botchoice2 = random.randint(1, 3) - if botchoice2 == 1: - botchoice = "rock" - elif botchoice2 == 2: - botchoice = "paper" - elif botchoice2 == 3: - botchoice = "scissors" - userchoice = "rock" - if botchoice == userchoice: - irc.reply("I chose %s. Looks like we tied." % (botchoice)) - elif botchoice == "paper" and userchoice == "rock": - irc.reply("I chose %s. Looks like I won." % (botchoice)) - elif botchoice == "scissors" and userchoice == "rock": - irc.reply("I chose %s. Looks like you won." % (botchoice)) - rock = wrap(rock) - - def paper(self, irc, msg, args): - """takes no arguments - - Choose paper in Rock, Paper, Scissors. - """ - botchoice2 = random.randint(1, 3) - if botchoice2 == 1: - botchoice = "rock" - elif botchoice2 == 2: - botchoice = "paper" - elif botchoice2 == 3: - botchoice = "scissors" - userchoice = "paper" - if botchoice == userchoice: - irc.reply("I chose %s. Looks like we tied." % (botchoice)) - elif botchoice == "scissors" and userchoice == "paper": - irc.reply("I chose %s. Looks like I won." % (botchoice)) - elif botchoice == "rock" and userchoice == "paper": - irc.reply("I chose %s. Looks like you won." % (botchoice)) - paper = wrap(paper) - - def scissors(self, irc, msg, args): - """takes no arguments - - Choose scissors in Rock, Paper, Scissors. - """ - botchoice2 = random.randint(1, 3) - if botchoice2 == 1: - botchoice = "rock" - elif botchoice2 == 2: - botchoice = "paper" - elif botchoice2 == 3: - botchoice = "scissors" - userchoice = "scissors" - if botchoice == userchoice: - irc.reply("I chose %s. Looks like we tied." % (botchoice)) - elif botchoice == "rock" and userchoice == "scissors": - irc.reply("I chose %s. Looks like I won." % (botchoice)) - elif botchoice == "paper" and userchoice == "scissors": - irc.reply("I chose %s. Looks like you won." % (botchoice)) - scissors = wrap(scissors) - - def catgif(self, irc, msg, args): - """ - Get a random cat .gif - """ - try: - response = utils.web.getUrl("http://edgecats.net/random").decode("utf8") - # Expecting a link - if "http" in response: - irc.reply(response) - else: - self.log.error("Received unexpected response from http://edgecats.net/random") - except: - self.log.exception("Error fetching URL") - catgif = wrap(catgif) - - def mitch(self, irc, msg, args): - """ - Mitch Hedberg Jokes - """ - data = open("{0}/mitch_hedberg.txt".format(os.path.dirname(os.path.abspath(__file__)))) - text = data.read() - reply = text.splitlines() - excuse = random.randrange(0, len(reply)) - irc.reply(reply[excuse]) - mitch = wrap(mitch) - - def chuck(self, irc, msg, args): - """ - Chuck Norris Jokes - """ - data = open("{0}/chuck_norris.txt".format(os.path.dirname(os.path.abspath(__file__)))) - text = data.read() - reply = text.splitlines() - excuse = random.randrange(0, len(reply)) - irc.reply(reply[excuse]) - chuck = wrap(chuck) - - def rodney(self, irc, msg, args): - """ - Rodney Dangerfield Jokes - """ - data = open("{0}/rodney_dangerfield.txt".format(os.path.dirname(os.path.abspath(__file__)))) - text = data.read() - reply = text.splitlines() - excuse = random.randrange(0, len(reply)) - irc.reply(reply[excuse]) - rodney = wrap(rodney) - - def rot(self, irc, msg, args, text): - """ - Encode text with ROT13 - """ - irc.reply(codecs.encode(text, "rot_13")) - rot = wrap(rot, ['text']) - - def unrot(self, irc, msg, args, text): - """ - Decode ROT13 text - """ - irc.reply(codecs.decode(text, "rot_13")) - unrot = wrap(unrot, ['text']) - - def coin(self, irc, msg, args, optcoin): - """[coin] - Fetches current values for a given coin - """ - coin_url = 'https://min-api.cryptocompare.com/data/pricemultifull?fsyms={coins}&tsyms=USD' - coins = [] - coins.append(optcoin) - coins_str = ','.join(c.upper() for c in coins) - coin_data = requests.get(coin_url.format(coins=coins_str)) - coin_data = coin_data.json() - if 'RAW' not in coin_data: - irc.reply('ERROR: no coin found for {}'.format(optcoin)) - return - output = [] - tmp = {} - data = coin_data['RAW'] - data2 = collections.OrderedDict.fromkeys(sorted(data)) - for k,v in data.items(): - data2.update({k: v}) - output = self._parseCoins(data2, optcoin) - irc.reply(' | '.join(t for t in output)) - return - coin = wrap(coin, ['text']) - - def coins(self, irc, msg, args, optcoin): - """ - Fetches current values for top 10 coins (+ dogecoin) trading by volume - """ - volm_url = 'https://min-api.cryptocompare.com/data/top/totalvol?limit=10&tsym=USD' - coin_url = 'https://min-api.cryptocompare.com/data/pricemultifull?fsyms={coins}&tsyms=USD' - volm_data = requests.get(volm_url).json() - coins = [] - for thing in volm_data['Data']: - name = thing['CoinInfo']['Name'] - coins.append(name) - coins.append('DOGE') - coins_str = ','.join(c for c in coins) - coin_data = requests.get(coin_url.format(coins=coins_str)) - coin_data = coin_data.json() - output = [] - tmp = {} - data = coin_data['RAW'] - tmp['BTC'] = data.pop('BTC') - data2 = collections.OrderedDict.fromkeys(sorted(data)) - for k,v in data.items(): - data2.update({k: v}) - data2.update(tmp) - data2.move_to_end('BTC', last=False) - output = self._parseCoins(data2, optcoin) - irc.reply(' | '.join(t for t in output)) - return - coins = wrap(coins, [optional('somethingWithoutSpaces')]) - - def _parseCoins(self, data, optmarket=None): - - ticker = [] - - def _humifyCap(cap): - if not cap: - return cap - if cap > 1000000000000: - cap = cap / 1000000000000 - cap = '${:.2f}T'.format(cap) - return cap - elif cap > 1000000000: - cap = cap / 1000000000 - cap = '${:.2f}B'.format(cap) - elif cap > 1000000: - cap = cap / 1000000 - cap = '${:.2f}M'.format(cap) - else: - cap = '${:.2f}'.format(cap) - return cap - return cap - - for symbol in data: - name = symbol - name = ircutils.bold(name) - symbol = data[symbol]['USD'] - current_price = symbol['PRICE'] - change = symbol['CHANGEDAY'] - pct_change = symbol['CHANGEPCTDAY'] - high24 = '${:g}'.format(symbol['HIGH24HOUR']) - low24 = '${:g}'.format(symbol['LOW24HOUR']) - mcap = _humifyCap(symbol['MKTCAP']) - if 0 < pct_change < 0.5: - change = ircutils.mircColor('+{:g}'.format(change), 'yellow') - pct_change = ircutils.mircColor('+{:.2g}%'.format(pct_change), 'yellow') - elif pct_change >= 0.5: - change = ircutils.mircColor('+{:g}'.format(change), 'green') - pct_change = ircutils.mircColor('+{:.2g}%'.format(pct_change), 'green') - elif 0 > pct_change > -0.5: - change = ircutils.mircColor('{:g}'.format(change), 'orange') - pct_change = ircutils.mircColor('{:.2g}%'.format(pct_change), 'orange') - elif pct_change <= -0.5: - change = ircutils.mircColor('{:g}'.format(change), 'red') - pct_change = ircutils.mircColor('{:.2g}%'.format(pct_change), 'red') - else: - change = '{:g}'.format(change) - pct_change = '{:g}%'.format(pct_change) - string = '{} ${:g} {} ({})'.format(name, current_price, change, pct_change) - if optmarket: - if optmarket.lower() in name.lower(): - string += ' :: \x02Market Cap:\x02 {} | \x0224hr High:\x02 {} | \x0224hr Low:\x02 {}'.format( - mcap, ircutils.mircColor(high24, 'green'), ircutils.mircColor(low24, 'red')) - ticker.append(string) - else: - ticker.append(string) - return ticker - -Class = Fun +### +# Copyright (c) 2020, oddluck +# 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.utils as utils +from supybot.commands import * +import supybot.plugins as plugins +import supybot.ircutils as ircutils +import supybot.callbacks as callbacks +import supybot.ircmsgs as ircmsgs +import random +import requests +from bs4 import BeautifulSoup +import codecs +import os +import collections + +try: + from supybot.i18n import PluginInternationalization + _ = PluginInternationalization('Weed') +except ImportError: + # Placeholder that allows to run the plugin on a bot + # without the i18n module + _ = lambda x: x + +class Fun(callbacks.Plugin): + """Uses API to retrieve information""" + threaded = True + + def advice(self, irc, msg, args): + """ + Get some advice + """ + + channel = msg.args[0] + data = requests.get("https://api.adviceslip.com/advice").json() + irc.reply(data['slip']['advice']) + + advice = wrap(advice) + + def joke(self, irc, msg, args): + """ + Get a joke + """ + + channel = msg.args[0] + headers = { + 'Accept': 'application/json', + } + data = requests.get('https://icanhazdadjoke.com/', headers=headers).json() + irc.reply(data['joke'].replace('\n', '').replace('\r', '').replace('\t', '')) + + joke = wrap(joke) + + def catfact(self, irc, msg, args): + """ + Cat fact + """ + + channel = msg.args[0] + data = requests.get("https://catfact.ninja/fact").json() + irc.reply(data['fact']) + + catfact = wrap(catfact) + + def useless(self, irc, msg, args): + """ + Useless fact + """ + + channel = msg.args[0] + data = requests.get("https://uselessfacts.jsph.pl/random.json?language=en").json() + irc.reply(data['text']) + + useless = wrap(useless) + + def buzz(self, irc, msg, args): + """ + Corporate buzzord generator + """ + channel = msg.args[0] + data = requests.get("https://corporatebs-generator.sameerkumar.website").json() + irc.reply(data['phrase']) + buzz = wrap(buzz) + + def startup(self, irc, msg, args): + """ + Startup generator + """ + channel = msg.args[0] + data = requests.get("http://itsthisforthat.com/api.php?json").json() + vowels = ('a','e','i','o','u','A','E','I','O','U') + if data['this'].startswith(vowels): + response = "So, Basically, It\'s Like An {0} for {1}".format(data['this'], data['that']) + else: + response = "So, Basically, It\'s Like A {0} for {1}".format(data['this'], data['that']) + irc.reply(response) + startup = wrap(startup) + + def insult(self, irc, msg, args, nick): + """[] + Insult generator. Optionally send insult to ( must be in channel). + """ + channel = msg.args[0] + data = requests.get("https://insult.mattbas.org/api/en/insult.json").json() + if nick: + response = "{0}: {1}".format(nick, data['insult']) + irc.reply(response, prefixNick=False) + else: + irc.reply(data['insult']) + insult = wrap(insult, [additional('nickInChannel')]) + + def devexcuse(self, irc, msg, args): + """ + Returns an excuse from http://developerexcuses.com + """ + data = requests.get('http://developerexcuses.com') + if not data: # http fetch breaks. + irc.reply("ERROR") + return + soup = BeautifulSoup(data.text) + text = soup.find('center').getText() + irc.reply("{0}".format(text)) + devexcuse = wrap(devexcuse) + + def _pigword(self, word): + shouldCAP = (word[:1] == word[:1].upper()) + word = word.lower() + letters = "qwertyuiopasdfghjklzxcvbnm" + i = len(word) - 1 + while i >= 0 and letters.find(word[i]) == -1: + i = i - 1 + if i == -1: + return word + punctuation = word[i+1:] + word = word[:i+1] + + vowels = "aeiou" + if vowels.find(word[0]) >= 0: + word = word + "yay" + punctuation + else: + word = word[1:] + word[0] + "ay" + punctuation + + if shouldCAP: + return word[:1].upper() + word[1:] + else: + return word + + def piglatin(self, irc, msg, args, optinput): + """ + Convert text from English to Pig Latin. + """ + + l = optinput.split(" ") + for i in range(len(l)): + l[i] = self._pigword(l[i]) + + irc.reply(" ".join(l)) + piglatin = wrap(piglatin, [('text')]) + + + def bofh(self, irc, msg, args): + """ + BOFH (Bastard Operator From Hell) Excuse Generator + """ + data = open("{0}/excuses.txt".format(os.path.dirname(os.path.abspath(__file__)))) + text = data.read() + reply = text.splitlines() + excuse = random.randrange(0, len(reply)) + irc.reply(reply[excuse]) + bofh = wrap(bofh) + + def rock(self, irc, msg, args): + """takes no arguments + + Choose rock in Rock, Paper, Scissors. + """ + botchoice2 = random.randint(1, 3) + if botchoice2 == 1: + botchoice = "rock" + elif botchoice2 == 2: + botchoice = "paper" + elif botchoice2 == 3: + botchoice = "scissors" + userchoice = "rock" + if botchoice == userchoice: + irc.reply("I chose %s. Looks like we tied." % (botchoice)) + elif botchoice == "paper" and userchoice == "rock": + irc.reply("I chose %s. Looks like I won." % (botchoice)) + elif botchoice == "scissors" and userchoice == "rock": + irc.reply("I chose %s. Looks like you won." % (botchoice)) + rock = wrap(rock) + + def paper(self, irc, msg, args): + """takes no arguments + + Choose paper in Rock, Paper, Scissors. + """ + botchoice2 = random.randint(1, 3) + if botchoice2 == 1: + botchoice = "rock" + elif botchoice2 == 2: + botchoice = "paper" + elif botchoice2 == 3: + botchoice = "scissors" + userchoice = "paper" + if botchoice == userchoice: + irc.reply("I chose %s. Looks like we tied." % (botchoice)) + elif botchoice == "scissors" and userchoice == "paper": + irc.reply("I chose %s. Looks like I won." % (botchoice)) + elif botchoice == "rock" and userchoice == "paper": + irc.reply("I chose %s. Looks like you won." % (botchoice)) + paper = wrap(paper) + + def scissors(self, irc, msg, args): + """takes no arguments + + Choose scissors in Rock, Paper, Scissors. + """ + botchoice2 = random.randint(1, 3) + if botchoice2 == 1: + botchoice = "rock" + elif botchoice2 == 2: + botchoice = "paper" + elif botchoice2 == 3: + botchoice = "scissors" + userchoice = "scissors" + if botchoice == userchoice: + irc.reply("I chose %s. Looks like we tied." % (botchoice)) + elif botchoice == "rock" and userchoice == "scissors": + irc.reply("I chose %s. Looks like I won." % (botchoice)) + elif botchoice == "paper" and userchoice == "scissors": + irc.reply("I chose %s. Looks like you won." % (botchoice)) + scissors = wrap(scissors) + + def catgif(self, irc, msg, args): + """ + Get a random cat .gif + """ + try: + response = utils.web.getUrl("http://edgecats.net/random").decode("utf8") + # Expecting a link + if "http" in response: + irc.reply(response) + else: + self.log.error("Received unexpected response from http://edgecats.net/random") + except: + self.log.exception("Error fetching URL") + catgif = wrap(catgif) + + def mitch(self, irc, msg, args): + """ + Mitch Hedberg Jokes + """ + data = open("{0}/mitch_hedberg.txt".format(os.path.dirname(os.path.abspath(__file__)))) + text = data.read() + reply = text.splitlines() + excuse = random.randrange(0, len(reply)) + irc.reply(reply[excuse]) + mitch = wrap(mitch) + + def chuck(self, irc, msg, args): + """ + Chuck Norris Jokes + """ + data = open("{0}/chuck_norris.txt".format(os.path.dirname(os.path.abspath(__file__)))) + text = data.read() + reply = text.splitlines() + excuse = random.randrange(0, len(reply)) + irc.reply(reply[excuse]) + chuck = wrap(chuck) + + def rodney(self, irc, msg, args): + """ + Rodney Dangerfield Jokes + """ + data = open("{0}/rodney_dangerfield.txt".format(os.path.dirname(os.path.abspath(__file__)))) + text = data.read() + reply = text.splitlines() + excuse = random.randrange(0, len(reply)) + irc.reply(reply[excuse]) + rodney = wrap(rodney) + + def rot(self, irc, msg, args, text): + """ + Encode text with ROT13 + """ + irc.reply(codecs.encode(text, "rot_13")) + rot = wrap(rot, ['text']) + + def unrot(self, irc, msg, args, text): + """ + Decode ROT13 text + """ + irc.reply(codecs.decode(text, "rot_13")) + unrot = wrap(unrot, ['text']) + + def coin(self, irc, msg, args, optcoin): + """[coin] + Fetches current values for a given coin + """ + coin_url = 'https://min-api.cryptocompare.com/data/pricemultifull?fsyms={coins}&tsyms=USD' + coins = [] + coins.append(optcoin) + coins_str = ','.join(c.upper() for c in coins) + coin_data = requests.get(coin_url.format(coins=coins_str)) + coin_data = coin_data.json() + if 'RAW' not in coin_data: + irc.reply('ERROR: no coin found for {}'.format(optcoin)) + return + output = [] + tmp = {} + data = coin_data['RAW'] + data2 = collections.OrderedDict.fromkeys(sorted(data)) + for k,v in data.items(): + data2.update({k: v}) + output = self._parseCoins(data2, optcoin) + irc.reply(' | '.join(t for t in output)) + return + coin = wrap(coin, ['text']) + + def coins(self, irc, msg, args, optcoin): + """ + Fetches current values for top 10 coins (+ dogecoin) trading by volume + """ + volm_url = 'https://min-api.cryptocompare.com/data/top/totalvol?limit=10&tsym=USD' + coin_url = 'https://min-api.cryptocompare.com/data/pricemultifull?fsyms={coins}&tsyms=USD' + volm_data = requests.get(volm_url).json() + coins = [] + for thing in volm_data['Data']: + name = thing['CoinInfo']['Name'] + coins.append(name) + coins.append('DOGE') + coins_str = ','.join(c for c in coins) + coin_data = requests.get(coin_url.format(coins=coins_str)) + coin_data = coin_data.json() + output = [] + tmp = {} + data = coin_data['RAW'] + tmp['BTC'] = data.pop('BTC') + data2 = collections.OrderedDict.fromkeys(sorted(data)) + for k,v in data.items(): + data2.update({k: v}) + data2.update(tmp) + data2.move_to_end('BTC', last=False) + output = self._parseCoins(data2, optcoin) + irc.reply(' | '.join(t for t in output)) + return + coins = wrap(coins, [optional('somethingWithoutSpaces')]) + + def _parseCoins(self, data, optmarket=None): + + ticker = [] + + def _humifyCap(cap): + if not cap: + return cap + if cap > 1000000000000: + cap = cap / 1000000000000 + cap = '${:.2f}T'.format(cap) + return cap + elif cap > 1000000000: + cap = cap / 1000000000 + cap = '${:.2f}B'.format(cap) + elif cap > 1000000: + cap = cap / 1000000 + cap = '${:.2f}M'.format(cap) + else: + cap = '${:.2f}'.format(cap) + return cap + return cap + + for symbol in data: + name = symbol + name = ircutils.bold(name) + symbol = data[symbol]['USD'] + current_price = symbol['PRICE'] + change = symbol['CHANGEDAY'] + pct_change = symbol['CHANGEPCTDAY'] + high24 = '${:g}'.format(symbol['HIGH24HOUR']) + low24 = '${:g}'.format(symbol['LOW24HOUR']) + mcap = _humifyCap(symbol['MKTCAP']) + if 0 < pct_change < 0.5: + change = ircutils.mircColor('+{:g}'.format(change), 'yellow') + pct_change = ircutils.mircColor('+{:.2g}%'.format(pct_change), 'yellow') + elif pct_change >= 0.5: + change = ircutils.mircColor('+{:g}'.format(change), 'green') + pct_change = ircutils.mircColor('+{:.2g}%'.format(pct_change), 'green') + elif 0 > pct_change > -0.5: + change = ircutils.mircColor('{:g}'.format(change), 'orange') + pct_change = ircutils.mircColor('{:.2g}%'.format(pct_change), 'orange') + elif pct_change <= -0.5: + change = ircutils.mircColor('{:g}'.format(change), 'red') + pct_change = ircutils.mircColor('{:.2g}%'.format(pct_change), 'red') + else: + change = '{:g}'.format(change) + pct_change = '{:g}%'.format(pct_change) + string = '{} ${:g} {} ({})'.format(name, current_price, change, pct_change) + if optmarket: + if optmarket.lower() in name.lower(): + string += ' :: \x02Market Cap:\x02 {} | \x0224hr High:\x02 {} | \x0224hr Low:\x02 {}'.format( + mcap, ircutils.mircColor(high24, 'green'), ircutils.mircColor(low24, 'red')) + ticker.append(string) + else: + ticker.append(string) + return ticker + +Class = Fun diff --git a/Fun/test.py b/Fun/test.py deleted file mode 100644 index 8317613..0000000 --- a/Fun/test.py +++ /dev/null @@ -1,16 +0,0 @@ -### -# Copyright (c) 2019, oddluck -# All rights reserved. -# -# -### - -from supybot.test import * - - -class AdviceTestCase(PluginTestCase): - plugins = ('Fun',) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: - diff --git a/Geo/__init__.py b/Geo/__init__.py index 02e7128..1a905e2 100644 --- a/Geo/__init__.py +++ b/Geo/__init__.py @@ -1,9 +1,35 @@ ### -# by SpiderDave +# Copyright (c) SpiderDave +# Copyright (c) 2020, oddluck +# 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. ### """ -Plugin to Geoloacate an IP +Geo: Geolocate an IP/hostname """ import supybot @@ -12,7 +38,7 @@ import importlib # 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__ = "" +__version__ = "2020.02.24+git" __author__ = supybot.Author('SpiderDave', 'SpiderDave', '') __maintainer__ = getattr(supybot.authors, 'oddluck', diff --git a/Geo/config.py b/Geo/config.py index 159accd..6f672ba 100644 --- a/Geo/config.py +++ b/Geo/config.py @@ -1,3 +1,33 @@ +### +# Copyright (c) SpiderDave +# Copyright (c) 2020, oddluck +# 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 diff --git a/Geo/plugin.py b/Geo/plugin.py index 1bbd85f..646e4e8 100644 --- a/Geo/plugin.py +++ b/Geo/plugin.py @@ -1,6 +1,31 @@ ### -# Geo/plugin.py -# by SpiderDave +# Copyright (c) SpiderDave +# Copyright (c) 2020, oddluck +# 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 time diff --git a/HuntNFish/__init__.py b/HuntNFish/__init__.py index a6d956d..426d5a6 100644 --- a/HuntNFish/__init__.py +++ b/HuntNFish/__init__.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2012, resistivecorpse +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,12 +26,10 @@ # 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. - ### """ -Add a description of the plugin (to be presented to the user inside the wizard) -here. This should describe *what* the plugin does. +HuntNFish: a hunting and fishing IRC game """ import supybot @@ -39,7 +38,7 @@ import importlib # 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('resistivecorpse', 'resistivecorpse', diff --git a/HuntNFish/config.py b/HuntNFish/config.py index ee97445..0a596c1 100644 --- a/HuntNFish/config.py +++ b/HuntNFish/config.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2012, resistivecorpse +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,7 +26,6 @@ # 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 diff --git a/HuntNFish/plugin.py b/HuntNFish/plugin.py index f934f1e..24cb933 100644 --- a/HuntNFish/plugin.py +++ b/HuntNFish/plugin.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2012, resistivecorpse +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,7 +26,6 @@ # 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 os diff --git a/HuntNFish/test.py b/HuntNFish/test.py deleted file mode 100644 index 5ae054b..0000000 --- a/HuntNFish/test.py +++ /dev/null @@ -1,37 +0,0 @@ -### -# Copyright (c) 2012, resistivecorpse -# 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 HuntNFishTestCase(PluginTestCase): - plugins = ('HuntNFish',) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/IMDB/__init__.py b/IMDB/__init__.py index 985c5d8..88c5ef3 100644 --- a/IMDB/__init__.py +++ b/IMDB/__init__.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2015, butterscotchstallion +# Copyright (c) 2020, oddluck # 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. ### """ @@ -14,7 +37,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('butterscotchstallion', 'butterscotchstallion', diff --git a/IMDB/config.py b/IMDB/config.py index 062d45a..95cd0db 100644 --- a/IMDB/config.py +++ b/IMDB/config.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2015, butterscotchstallion +# Copyright (c) 2020, oddluck # 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 diff --git a/IMDB/plugin.py b/IMDB/plugin.py index 149050c..4295fef 100644 --- a/IMDB/plugin.py +++ b/IMDB/plugin.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2015, butterscotchstallion +# Copyright (c) 2020, oddluck # 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 sys diff --git a/IMDB/test.py b/IMDB/test.py deleted file mode 100644 index 174ce5b..0000000 --- a/IMDB/test.py +++ /dev/null @@ -1,15 +0,0 @@ -### -# Copyright (c) 2015, butterscotchstallion -# All rights reserved. -# -# -### - -from supybot.test import * - - -class IMDBTestCase(PluginTestCase): - plugins = ('IMDB',) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/Jeopardy/__init__.py b/Jeopardy/__init__.py index 58d10ed..4b9fea7 100644 --- a/Jeopardy/__init__.py +++ b/Jeopardy/__init__.py @@ -1,5 +1,7 @@ ### -# Copyright (c) 2019, oddluck +# Copyright (c) 2010, quantumlemur +# Copyright (c) 2011, Valentin Lorentz +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,12 +27,10 @@ # 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. - ### """ -Add a description of the plugin (to be presented to the user inside the wizard) -here. This should describe *what* the plugin does. +Jeopardy: a trivia game using Jeopardy! questions """ import supybot @@ -38,7 +38,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('oddluck', 'oddluck', diff --git a/Jeopardy/config.py b/Jeopardy/config.py index 94adc56..efee0b9 100644 --- a/Jeopardy/config.py +++ b/Jeopardy/config.py @@ -1,7 +1,7 @@ ### # Copyright (c) 2010, quantumlemur # Copyright (c) 2011, Valentin Lorentz -# Copyright (c) 2020, oddluck +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -27,7 +27,6 @@ # 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 diff --git a/Jeopardy/plugin.py b/Jeopardy/plugin.py index b63da38..2b989d8 100644 --- a/Jeopardy/plugin.py +++ b/Jeopardy/plugin.py @@ -1,7 +1,7 @@ ### # Copyright (c) 2010, quantumlemur # Copyright (c) 2011, Valentin Lorentz -# Copyright (c) 2020, oddluck +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/Lyrics/__init__.py b/Lyrics/__init__.py index 5c60720..89b962d 100644 --- a/Lyrics/__init__.py +++ b/Lyrics/__init__.py @@ -1,8 +1,30 @@ ### -# Copyright (c) 2019 oddluck +# Copyright (c) 2020, oddluck # 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. ### """ @@ -14,7 +36,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('oddluck', 'oddluck', diff --git a/Lyrics/config.py b/Lyrics/config.py index 06da2c3..b21222a 100644 --- a/Lyrics/config.py +++ b/Lyrics/config.py @@ -1,8 +1,30 @@ ### -# Copyright (c) 2019, oddluck +# Copyright (c) 2020, oddluck # 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 diff --git a/Lyrics/plugin.py b/Lyrics/plugin.py index 97a3cff..60170bf 100644 --- a/Lyrics/plugin.py +++ b/Lyrics/plugin.py @@ -1,77 +1,99 @@ -### -# Copyright (c) 2019 oddluck -# All rights reserved. -# -# -### - -import supybot.utils as utils -from supybot.commands import * -import supybot.plugins as plugins -import supybot.ircutils as ircutils -import supybot.callbacks as callbacks -import supybot.ircmsgs as ircmsgs -from bs4 import BeautifulSoup -import requests -import re -import pylyrics3 -from fake_useragent import UserAgent - -try: - from supybot.i18n import PluginInternationalization - _ = PluginInternationalization('Weed') -except ImportError: - # Placeholder that allows to run the plugin on a bot - # without the i18n module - _ = lambda x: x - -class Lyrics(callbacks.Plugin): - """Retrieves song lyrics""" - threaded = True - - def dosearch(self, lyric): - try: - searchurl = "https://www.google.com/search?&q={0} site:lyrics.fandom.com/wiki/".format(lyric) - ua = UserAgent() - header = {'User-Agent':str(ua.random)} - data = requests.get(searchurl, headers=header) - soup = BeautifulSoup(data.text) - elements = soup.select('.r a') - url = elements[0]['href'] - url = re.split('https?://', url)[-1] - url = re.sub("&rct=.*", "", url) - url = "https://{0}".format(url) - title = soup.find("h3").getText() - except Exception: - return - else: - return title, url - - def getlyrics(self, url): - try: - lyrics = pylyrics3.get_lyrics_from_url(url) - lyrics = re.sub('(? - Get song lyrics from Lyrics Wiki. Search powered by Google. - """ - try: - title, url = self.dosearch(lyric) - except Exception: - irc.reply("No results found for {0}".format(lyric)) - else: - try: - lyrics = self.getlyrics(url) - irc.reply(title.replace(":", " - ")) - irc.reply(lyrics) - except Exception: - irc.reply("Unable to retrieve lyrics from {0}".format(url)) - lyric = wrap(lyric, ['text']) - -Class = Lyrics +### +# Copyright (c) 2020, oddluck +# 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.utils as utils +from supybot.commands import * +import supybot.plugins as plugins +import supybot.ircutils as ircutils +import supybot.callbacks as callbacks +import supybot.ircmsgs as ircmsgs +from bs4 import BeautifulSoup +import requests +import re +import pylyrics3 +from fake_useragent import UserAgent + +try: + from supybot.i18n import PluginInternationalization + _ = PluginInternationalization('Weed') +except ImportError: + # Placeholder that allows to run the plugin on a bot + # without the i18n module + _ = lambda x: x + +class Lyrics(callbacks.Plugin): + """Retrieves song lyrics""" + threaded = True + + def dosearch(self, lyric): + try: + searchurl = "https://www.google.com/search?&q={0} site:lyrics.fandom.com/wiki/".format(lyric) + ua = UserAgent() + header = {'User-Agent':str(ua.random)} + data = requests.get(searchurl, headers=header) + soup = BeautifulSoup(data.text) + elements = soup.select('.r a') + url = elements[0]['href'] + url = re.split('https?://', url)[-1] + url = re.sub("&rct=.*", "", url) + url = "https://{0}".format(url) + title = soup.find("h3").getText() + except Exception: + return + else: + return title, url + + def getlyrics(self, url): + try: + lyrics = pylyrics3.get_lyrics_from_url(url) + lyrics = re.sub('(? + Get song lyrics from Lyrics Wiki. Search powered by Google. + """ + try: + title, url = self.dosearch(lyric) + except Exception: + irc.reply("No results found for {0}".format(lyric)) + else: + try: + lyrics = self.getlyrics(url) + irc.reply(title.replace(":", " - ")) + irc.reply(lyrics) + except Exception: + irc.reply("Unable to retrieve lyrics from {0}".format(url)) + lyric = wrap(lyric, ['text']) + +Class = Lyrics diff --git a/Lyrics/test.py b/Lyrics/test.py deleted file mode 100644 index d70fb03..0000000 --- a/Lyrics/test.py +++ /dev/null @@ -1,16 +0,0 @@ -### -# Copyright (c) 2019, oddluck -# All rights reserved. -# -# -### - -from supybot.test import * - - -class LyricsTestCase(PluginTestCase): - plugins = ('Lyrics',) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: - diff --git a/Markovgen/__init__.py b/Markovgen/__init__.py index 5d36702..9523426 100644 --- a/Markovgen/__init__.py +++ b/Markovgen/__init__.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2014, Valentin Lorentz +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,12 +26,10 @@ # 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. - ### """ -Add a description of the plugin (to be presented to the user inside the wizard) -here. This should describe *what* the plugin does. +Markovgen: reply to messages with markov generated text """ import supybot @@ -38,7 +37,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. diff --git a/Markovgen/config.py b/Markovgen/config.py index 31e56f7..d172aea 100644 --- a/Markovgen/config.py +++ b/Markovgen/config.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2014, Valentin Lorentz +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,7 +26,6 @@ # 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 diff --git a/Markovgen/local/__init__.py b/Markovgen/local/__init__.py deleted file mode 100644 index e86e97b..0000000 --- a/Markovgen/local/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Stub so local is a module, used for third-party modules diff --git a/Markovgen/plugin.py b/Markovgen/plugin.py index 3049199..e8dd51d 100644 --- a/Markovgen/plugin.py +++ b/Markovgen/plugin.py @@ -1,6 +1,6 @@ -# coding: utf8 ### # Copyright (c) 2014, Valentin Lorentz +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -26,7 +26,6 @@ # 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 os diff --git a/Markovgen/test.py b/Markovgen/test.py deleted file mode 100644 index e6c967d..0000000 --- a/Markovgen/test.py +++ /dev/null @@ -1,37 +0,0 @@ -### -# Copyright (c) 2014, Valentin Lorentz -# 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 MarkovgenTestCase(PluginTestCase): - plugins = ('Markovgen',) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/NBA/__init__.py b/NBA/__init__.py index 934b64f..b59076e 100644 --- a/NBA/__init__.py +++ b/NBA/__init__.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2016, Santiago Gil +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,7 +26,6 @@ # 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. - ### """ @@ -37,7 +37,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('Santiago Gil', 'santigl', '') diff --git a/NBA/config.py b/NBA/config.py index a203dc7..13c6417 100644 --- a/NBA/config.py +++ b/NBA/config.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2016, Santiago Gil +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,7 +26,6 @@ # 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 diff --git a/NBA/plugin.py b/NBA/plugin.py index c9bce85..fc86def 100644 --- a/NBA/plugin.py +++ b/NBA/plugin.py @@ -1,18 +1,31 @@ ### # Copyright (c) 2018, Santiago Gil +# Copyright (c) 2020, oddluck +# All rights reserved. # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# * 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. # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# 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.utils as utils diff --git a/NFL/__init__.py b/NFL/__init__.py index a90828f..c5f474d 100644 --- a/NFL/__init__.py +++ b/NFL/__init__.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2019, cottongin +# Copyright (c) 2020, oddluck # 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. ### """ @@ -15,7 +38,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('cottongin', 'cottongin', diff --git a/NFL/config.py b/NFL/config.py index ddbd040..cffa0b6 100644 --- a/NFL/config.py +++ b/NFL/config.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2019, cottongin +# Copyright (c) 2020, oddluck # 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 import conf, registry diff --git a/NFL/plugin.py b/NFL/plugin.py index 4e6a6e8..e740c78 100644 --- a/NFL/plugin.py +++ b/NFL/plugin.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2019, cottongin +# Copyright (c) 2020, oddluck # 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 pendulum diff --git a/NHL/__init__.py b/NHL/__init__.py index a06c29b..4ff2601 100644 --- a/NHL/__init__.py +++ b/NHL/__init__.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2016, Santiago Gil +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,7 +26,6 @@ # 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. - ### """ @@ -37,7 +37,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('Santiago Gil', 'santigl', '') diff --git a/NHL/config.py b/NHL/config.py index 33cdcef..c70a778 100644 --- a/NHL/config.py +++ b/NHL/config.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2016, Santiago Gil +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,7 +26,6 @@ # 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 diff --git a/NHL/plugin.py b/NHL/plugin.py index 9869934..a69d155 100644 --- a/NHL/plugin.py +++ b/NHL/plugin.py @@ -1,8 +1,6 @@ ### -# Limnoria plugin to retrieve results from NHL.com using their (undocumented) -# JSON API. # Copyright (c) 2016, Santiago Gil -# adapted by cottongin +# Copyright (c) 2020, oddluck # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/Odds/__init__.py b/Odds/__init__.py index 2dff427..3ba45fc 100644 --- a/Odds/__init__.py +++ b/Odds/__init__.py @@ -1,12 +1,35 @@ ### # Copyright (c) 2018, cottongin +# Copyright (c) 2020, oddluck # 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. ### """ -Odds: Fetches odds +Odds: Fetches sports odds """ import sys @@ -15,7 +38,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('cottongin', 'cottongin', diff --git a/Odds/config.py b/Odds/config.py index 91cf871..218482d 100644 --- a/Odds/config.py +++ b/Odds/config.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2018, cottongin +# Copyright (c) 2020, oddluck # 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 import conf, registry diff --git a/Odds/plugin.py b/Odds/plugin.py index 07e1c8b..50611c9 100644 --- a/Odds/plugin.py +++ b/Odds/plugin.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2018, cottongin +# Copyright (c) 2020, oddluck # 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 requests diff --git a/PGA/__init__.py b/PGA/__init__.py index bff88ed..867b699 100644 --- a/PGA/__init__.py +++ b/PGA/__init__.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2018, cottongin +# Copyright (c) 2020, oddluck # 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. ### """ @@ -15,7 +38,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('cottongin', 'cottongin', diff --git a/PGA/config.py b/PGA/config.py index c6ce510..3c999a7 100644 --- a/PGA/config.py +++ b/PGA/config.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2018, cottongin +# Copyright (c) 2020, oddluck # 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 import conf, registry diff --git a/PGA/plugin.py b/PGA/plugin.py index f0bc740..09b4c4d 100644 --- a/PGA/plugin.py +++ b/PGA/plugin.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2018, cottongin +# Copyright (c) 2020, oddluck # 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 pendulum diff --git a/RPG/__init__.py b/RPG/__init__.py index e5c086e..711b230 100644 --- a/RPG/__init__.py +++ b/RPG/__init__.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2011, Anthony Boot +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,12 +26,10 @@ # 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. - ### """ -Add a description of the plugin (to be presented to the user inside the wizard) -here. This should describe *what* the plugin does. +RPG: simple IRC role-playing game for Limnoria """ import supybot @@ -39,7 +38,7 @@ import importlib # 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('Anthiny Boot', 'antb', '') diff --git a/RPG/config.py b/RPG/config.py index 80e2d9c..290d287 100644 --- a/RPG/config.py +++ b/RPG/config.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2011, Anthony Boot +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,7 +26,6 @@ # 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 diff --git a/RPG/plugin.py b/RPG/plugin.py index fa1ac5d..4c59bd2 100644 --- a/RPG/plugin.py +++ b/RPG/plugin.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2011, Anthony Boot +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -14,7 +15,7 @@ # 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' +# 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 @@ -25,7 +26,6 @@ # 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.utils as utils diff --git a/RPG/test.py b/RPG/test.py deleted file mode 100644 index 0d50942..0000000 --- a/RPG/test.py +++ /dev/null @@ -1,37 +0,0 @@ -### -# Copyright (c) 2011, Anthony Boot -# 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 RpgTestCase(PluginTestCase): - plugins = ('RPG',) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/Soccer/__init__.py b/Soccer/__init__.py index 4c0f08b..8a466f2 100644 --- a/Soccer/__init__.py +++ b/Soccer/__init__.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2018, cottongin +# Copyright (c) 2020, oddluck # 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. ### """ @@ -15,7 +38,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('cottongin', 'cottongin', diff --git a/Soccer/config.py b/Soccer/config.py index 570a399..d40bcaa 100644 --- a/Soccer/config.py +++ b/Soccer/config.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2018, cottongin +# Copyright (c) 2020, oddluck # 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 import conf, registry diff --git a/Soccer/plugin.py b/Soccer/plugin.py index 5188ea3..33d167f 100644 --- a/Soccer/plugin.py +++ b/Soccer/plugin.py @@ -1,9 +1,31 @@ ### # Copyright (c) 2018, cottongin +# Copyright (c) 2020, oddluck # All rights reserved. # -# See LICENSE.txt +# 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 import utils, plugins, ircutils, callbacks, schedule, conf diff --git a/SpiffyTitles/__init__.py b/SpiffyTitles/__init__.py index 4d18bdc..d2a651e 100644 --- a/SpiffyTitles/__init__.py +++ b/SpiffyTitles/__init__.py @@ -1,12 +1,35 @@ ### # Copyright (c) 2015, butterscotchstallion +# Copyright (c) 2020, oddluck # 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. ### """ -SpiffyTitles: Displays link titles when posted in a channel +SpiffyTitles: displays link titles when posted in a channel """ import supybot @@ -14,7 +37,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('butterscotchstallion', 'butterscotchstallion', '') diff --git a/SpiffyTitles/config.py b/SpiffyTitles/config.py index 1fcdf1e..fd0e29f 100644 --- a/SpiffyTitles/config.py +++ b/SpiffyTitles/config.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2015, butterscotchstallion +# Copyright (c) 2020, oddluck # 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 diff --git a/SpiffyTitles/plugin.py b/SpiffyTitles/plugin.py index 77a8a56..347241b 100644 --- a/SpiffyTitles/plugin.py +++ b/SpiffyTitles/plugin.py @@ -1,9 +1,31 @@ -# -*- coding: utf-8 -*- ### # Copyright (c) 2015, butterscotchstallion +# Copyright (c) 2020, oddluck # 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.commands import * @@ -1126,12 +1148,10 @@ class SpiffyTitles(callbacks.Plugin): "writer": response["Writer"], "votes": response["imdbVotes"], "website": response["Website"], - "type": response["Type"], "language": response["Language"], "box_office": response["BoxOffice"], "production": response["Production"], "poster": response["Poster"], - "ratings": response["Ratings"], "imdb_logo": self.get_imdb_logo() } result = imdb_template.render(template_vars) diff --git a/SpiffyTitles/test.py b/SpiffyTitles/test.py deleted file mode 100644 index 1edcc94..0000000 --- a/SpiffyTitles/test.py +++ /dev/null @@ -1,20 +0,0 @@ -### -# Copyright (c) 2015, butterscotchstallion -# All rights reserved. -# -# -### - -from supybot.test import * - - -class SpiffyTitlesTestCase(ChannelPluginTestCase): - plugins = ('SpiffyTitles',) - - def setUp(self): - ChannelPluginTestCase.setUp(self) - - self.assertNotError('reload SpiffyTitles') - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/TVMaze/__init__.py b/TVMaze/__init__.py index ec5fd2e..ed4c141 100644 --- a/TVMaze/__init__.py +++ b/TVMaze/__init__.py @@ -1,12 +1,35 @@ ### # Copyright (c) 2019, cottongin +# Copyright (c) 2020, oddluck # 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. ### """ -TVMaze: Limnoria plugin to fetch TV show information and schedules from tvmaze.com API +TVMaze: plugin to fetch TV show information and schedules from the tvmaze.com API """ import sys @@ -15,7 +38,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('cottongin', 'cottongin', diff --git a/TVMaze/accountsdb.py b/TVMaze/accountsdb.py index 371c098..2cecd94 100644 --- a/TVMaze/accountsdb.py +++ b/TVMaze/accountsdb.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2019, James Lu +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/TVMaze/config.py b/TVMaze/config.py index 191b1ea..47d3580 100644 --- a/TVMaze/config.py +++ b/TVMaze/config.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2019, cottongin +# Copyright (c) 2020, oddluck # 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 import conf, registry diff --git a/TVMaze/plugin.py b/TVMaze/plugin.py index 2c4c7e9..abfd95c 100644 --- a/TVMaze/plugin.py +++ b/TVMaze/plugin.py @@ -1,9 +1,31 @@ -# TVMaze v0.0.1 ### # Copyright (c) 2019, cottongin +# Copyright (c) 2020, oddluck # All rights reserved. # -# See LICENSE.txt +# 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 requests diff --git a/TVMaze/test.py b/TVMaze/test.py deleted file mode 100644 index 4ae931e..0000000 --- a/TVMaze/test.py +++ /dev/null @@ -1,15 +0,0 @@ -### -# Copyright (c) 2019, cottongin -# All rights reserved. -# -# -### - -from supybot.test import * - - -class TVMazeTestCase(PluginTestCase): - plugins = ('TVMaze',) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/TextAdventures/__init__.py b/TextAdventures/__init__.py index 5ce2458..07abc6f 100644 --- a/TextAdventures/__init__.py +++ b/TextAdventures/__init__.py @@ -1,12 +1,34 @@ ### -# Copyright (c) 2019 oddluck +# Copyright (c) 2020, oddluck # 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. ### """ -TextAdventures: Play interactive fiction games +TextAdventures: Play interactive fiction (z-machine) games """ import supybot @@ -14,7 +36,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('oddluck', 'oddluck', diff --git a/TextAdventures/config.py b/TextAdventures/config.py index eb72fb9..0c74a26 100644 --- a/TextAdventures/config.py +++ b/TextAdventures/config.py @@ -1,8 +1,30 @@ ### -# Copyright (c) 2019, oddluck +# Copyright (c) 2020, oddluck # 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 diff --git a/TextAdventures/plugin.py b/TextAdventures/plugin.py index ddc45f9..035a775 100644 --- a/TextAdventures/plugin.py +++ b/TextAdventures/plugin.py @@ -1,8 +1,30 @@ ### -# Copyright (c) 2019 oddluck +# Copyright (c) 2020, oddluck # 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.utils as utils diff --git a/TextAdventures/test.py b/TextAdventures/test.py deleted file mode 100644 index d465cc4..0000000 --- a/TextAdventures/test.py +++ /dev/null @@ -1,16 +0,0 @@ -### -# Copyright (c) 2019, oddluck -# All rights reserved. -# -# -### - -from supybot.test import * - - -class InfocomTestCase(PluginTestCase): - plugins = ('TextAdventures',) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: - diff --git a/TextArt/__init__.py b/TextArt/__init__.py index d96712b..053cabe 100644 --- a/TextArt/__init__.py +++ b/TextArt/__init__.py @@ -1,44 +1,66 @@ -### -# Copyright (c) 2020 oddluck -# All rights reserved. -# -# -### - -""" -TextArt: Make IRC Art -""" - -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('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 - +### +# Copyright (c) 2020, oddluck +# 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. +### + +""" +TextArt: make IRC text art +""" + +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__ = "2020.02.24+git" + +# XXX Replace this with an appropriate author or supybot.Author instance. +__author__ = 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 + diff --git a/TextArt/config.py b/TextArt/config.py index ae7a043..85082c3 100644 --- a/TextArt/config.py +++ b/TextArt/config.py @@ -1,69 +1,91 @@ -### -# Copyright (c) 2020, oddluck -# All rights reserved. -# -# -### - -import supybot.conf as conf -import supybot.registry as registry -try: - from supybot.i18n import PluginInternationalization - _ = PluginInternationalization('TextArt') -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('TextArt', True) - -TextArt = conf.registerPlugin('TextArt') - -conf.registerGlobalValue(TextArt, 'pasteAPI', -registry.String('', _("""Paste.ee API Key"""))) - -conf.registerGlobalValue(TextArt, 'imgurAPI', -registry.String('', _("""Imgur Client ID"""))) - -conf.registerChannelValue(TextArt, 'pasteEnable', -registry.Boolean(False, _("""Turns on and off paste.ee support"""))) - -conf.registerChannelValue(TextArt, 'showStats', -registry.Boolean(False, _("""Turns on and off showing render stats."""))) - -conf.registerChannelValue(TextArt, 'delay', -registry.Float(1.0, _("""Set the time delay betwen lines. Not currently implemented."""))) - -conf.registerChannelValue(TextArt, 'quantize', -registry.Boolean(False, _("""Enable quantizing to 256 colors before rendering. Results in much faster rendering at a slight decrease in quality. Default: False"""))) - -conf.registerChannelValue(TextArt, 'resize', -registry.Integer(3, _("""Set the resize algorithm. 0 = nearest, 1 = lanczos, 2 = bilinear, 3 = bicubic, 4 = box, 5 = hamming"""))) - -conf.registerChannelValue(TextArt, 'speed', -registry.String('Slow', _("""Set the speed of the color rendering. 'Slow' (default) to use CIEDE2000 color difference. 'Fast' to use Euclidean color difference."""))) - -conf.registerChannelValue(TextArt, 'imgDefault', -registry.String('1/2', _("""Set the default art type for the img command. Options are 'ascii', '1/2' (default), '1/4', 'block', and 'no-color'"""))) - -conf.registerChannelValue(TextArt, 'asciiWidth', -registry.Integer(100, _("""Set the default column width for ascii art images"""))) - -conf.registerChannelValue(TextArt, 'blockWidth', -registry.Integer(80, _("""Set the default column width for 1/2 and 1/4 block art images"""))) - -conf.registerChannelValue(TextArt, 'colors', -registry.Integer(99, _("""Set the default number of colors to use. Options are 16 for colors 0-15 only, 83 for colors 16-98 only, and 99 (default) to use all available colors"""))) - -conf.registerChannelValue(TextArt, 'fg', -registry.Integer(99, _("""Set the default foreground color for ascii art images. 0-98. 99 is disabled (default)"""))) - -conf.registerChannelValue(TextArt, 'bg', -registry.Integer(99, _("""Set the default background color for ascii art images. 0-98. 99 is disabled (default)"""))) +### +# Copyright (c) 2020, oddluck +# 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('TextArt') +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('TextArt', True) + +TextArt = conf.registerPlugin('TextArt') + +conf.registerGlobalValue(TextArt, 'pasteAPI', +registry.String('', _("""Paste.ee API Key"""))) + +conf.registerGlobalValue(TextArt, 'imgurAPI', +registry.String('', _("""Imgur Client ID"""))) + +conf.registerChannelValue(TextArt, 'pasteEnable', +registry.Boolean(False, _("""Turns on and off paste.ee support"""))) + +conf.registerChannelValue(TextArt, 'showStats', +registry.Boolean(False, _("""Turns on and off showing render stats."""))) + +conf.registerChannelValue(TextArt, 'delay', +registry.Float(1.0, _("""Set the time delay betwen lines. Not currently implemented."""))) + +conf.registerChannelValue(TextArt, 'quantize', +registry.Boolean(False, _("""Enable quantizing to 256 colors before rendering. Results in much faster rendering at a slight decrease in quality. Default: False"""))) + +conf.registerChannelValue(TextArt, 'resize', +registry.Integer(3, _("""Set the resize algorithm. 0 = nearest, 1 = lanczos, 2 = bilinear, 3 = bicubic, 4 = box, 5 = hamming"""))) + +conf.registerChannelValue(TextArt, 'speed', +registry.String('Slow', _("""Set the speed of the color rendering. 'Slow' (default) to use CIEDE2000 color difference. 'Fast' to use Euclidean color difference."""))) + +conf.registerChannelValue(TextArt, 'imgDefault', +registry.String('1/2', _("""Set the default art type for the img command. Options are 'ascii', '1/2' (default), '1/4', 'block', and 'no-color'"""))) + +conf.registerChannelValue(TextArt, 'asciiWidth', +registry.Integer(100, _("""Set the default column width for ascii art images"""))) + +conf.registerChannelValue(TextArt, 'blockWidth', +registry.Integer(80, _("""Set the default column width for 1/2 and 1/4 block art images"""))) + +conf.registerChannelValue(TextArt, 'colors', +registry.Integer(99, _("""Set the default number of colors to use. Options are 16 for colors 0-15 only, 83 for colors 16-98 only, and 99 (default) to use all available colors"""))) + +conf.registerChannelValue(TextArt, 'fg', +registry.Integer(99, _("""Set the default foreground color for ascii art images. 0-98. 99 is disabled (default)"""))) + +conf.registerChannelValue(TextArt, 'bg', +registry.Integer(99, _("""Set the default background color for ascii art images. 0-98. 99 is disabled (default)"""))) diff --git a/TextArt/plugin.py b/TextArt/plugin.py index 0322624..f905901 100644 --- a/TextArt/plugin.py +++ b/TextArt/plugin.py @@ -1,1687 +1,1709 @@ -### -# Copyright (c) 2020 oddluck -# All rights reserved. -# -# -### - -import supybot.ansi as ansi -import supybot.utils as utils -from supybot.commands import * -import supybot.plugins as plugins -import supybot.ircutils as ircutils -import supybot.ircdb as ircdb -import supybot.callbacks as callbacks -import supybot.ircmsgs as ircmsgs -import os -import requests -from PIL import Image, ImageOps, ImageFont, ImageDraw, ImageEnhance -import numpy as np -import sys, math -from fake_useragent import UserAgent -import re -import pexpect -import time -import random as random -import pyimgur -from bs4 import BeautifulSoup - -try: - from supybot.i18n import PluginInternationalization - _ = PluginInternationalization('TextArt') -except ImportError: - # Placeholder that allows to run the plugin on a bot - # without the i18n module - _ = lambda x: x - -class TextArt(callbacks.Plugin): - """TextArt: Make Text Art""" - threaded = True - - def __init__(self, irc): - self.__parent = super(TextArt, self) - self.__parent.__init__(irc) - self.colors = 99 - self.stopped = {} - self.old_color = None - self.source_colors = 0 - self.rgbColors = [ - (255,255,255), - (0,0,0), - (0,0,127), - (0,147,0), - (255,0,0), - (127,0,0), - (156,0,156), - (252,127,0), - (255,255,0), - (0,252,0), - (0,147,147), - (0,255,255), - (0,0,252), - (255,0,255), - (127,127,127), - (210,210,210), - (71,0,0), - (71,33,0), - (71,71,0), - (50,71,0), - (0,71,0), - (0,71,44), - (0,71,71), - (0,39,71), - (0,0,71), - (46,0,71), - (71,0,71), - (71,0,42), - (116,0,0), - (116,58,0), - (116,116,0), - (81,116,0), - (0,116,0), - (0,116,73), - (0,116,116), - (0,64,116), - (0,0,116), - (75,0,116), - (116,0,116), - (116,0,69), - (181,0,0), - (181,99,0), - (181,181,0), - (125,181,0), - (0,181,0), - (0,181,113), - (0,181,181), - (0,99,181), - (0,0,181), - (117,0,181), - (181,0,181), - (181,0,107), - (255,0,0), - (255,140,0), - (255,255,0), - (178,255,0), - (0,255,0), - (0,255,160), - (0,255,255), - (0,140,255), - (0,0,255), - (165,0,255), - (255,0,255), - (255,0,152), - (255,89,89), - (255,180,89), - (255,255,113), - (207,255,96), - (111,255,111), - (101,255,201), - (109,255,255), - (89,180,255), - (89,89,255), - (196,89,255), - (255,102,255), - (255,89,188), - (255,156,156), - (255,211,156), - (255,255,156), - (226,255,156), - (156,255,156), - (156,255,219), - (156,255,255), - (156,211,255), - (156,156,255), - (220,156,255), - (255,156,255), - (255,148,211), - (0,0,0), - (19,19,19), - (40,40,40), - (54,54,54), - (77,77,77), - (101,101,101), - (129,129,129), - (159,159,159), - (188,188,188), - (226,226,226), - (255,255,255)] - self.colors83= { - (11.5497, 31.8768, 18.1739):16, - (17.5866, 15.7066, 25.9892):17, - (29.0208, -8.5776, 37.5533):18, - (27.2543, -19.015, 35.3673):19, - (25.2798, -34.2963, 32.8426):20, - (25.8276, -27.5812, 10.7515):21, - (26.6245, -19.1316, -5.6261):22, - (14.986, 1.2467, -23.6473):23, - (4.1091, 27.6851, -41.3905):24, - (9.2862, 34.8709, -32.6869):25, - (14.3696, 39.0991, -24.2113):26, - (12.6512, 34.8073, -6.066):27, - (22.699, 44.779, 34.3145):28, - (31.2054, 21.9979, 41.7676):29, - (47.2407, -12.0488, 52.8125):30, - (44.5753, -27.9355, 49.6338):31, - (41.9858, -48.1745, 46.4957):32, - (42.7207, -39.1444, 16.0528):33, - (43.8747, -26.8746, -7.9028):34, - (26.5278, 3.8603, -34.8152):35, - (11.0, 44.2673, -60.2918):36, - (19.0423, 48.637, -46.7161):37, - (26.6606, 54.9202, -34.0091):38, - (24.1377, 48.6121, -6.8774):39, - (37.5243, 61.9327, 51.9413):40, - (50.3904, 27.7338, 58.553):41, - (71.4677, -16.6651, 73.0447):42, - (67.5818, -39.987, 68.408):43, - (64.1995, -66.6294, 64.3075):44, - (65.1526, -54.8772, 23.9922):45, - (66.8122, -37.1703, -10.9303):46, - (41.6262, 7.9137, -50.0682):47, - (21.343, 61.2273, -83.3898):48, - (32.0743, 66.9878, -65.2716):49, - (43.0033, 75.9603, -47.0378):50, - (39.3866, 66.9043, -7.4929):51, - (53.2329, 80.1093, 67.2201):52, - (69.4811, 36.8308, 75.4949):53, - (97.1382, -21.5559, 94.4825):54, - (92.125, -51.6335, 88.501):55, - (87.737, -86.1846, 83.1812):56, - (88.9499, -71.2147, 31.6061):57, - (91.1165, -48.0796, -14.1381):58, - (58.0145, 11.3842, -65.6058):59, - (32.3026, 79.1967, -107.8637):60, - (45.9331, 86.4699, -84.8483):61, - (60.3199, 98.2542, -60.843):62, - (55.6111, 86.4597, -9.1916):63, - (60.8927, 62.8729, 35.0702):64, - (78.8241, 18.6736, 56.0796):65, - (97.6208, -17.6977, 66.4162):66, - (94.1539, -37.4631, 68.7023):67, - (89.8813, -66.1541, 56.3842):68, - (91.0093, -53.1765, 13.8066):69, - (92.571, -38.7824, -11.8131):70, - (70.8615, -4.4808, -45.0866):71, - (47.6091, 49.3215, -82.3961):72, - (58.1323, 68.3853, -64.8302):73, - (68.0079, 76.2368, -48.6298):74, - (63.3723, 71.7112, -18.3923):75, - (74.4686, 36.8822, 15.7988):76, - (87.1187, 8.2035, 33.0227):77, - (98.1056, -13.9188, 47.2642):78, - (96.0337, -24.7493, 44.2003):79, - (92.1264, -48.2196, 38.3812):80, - (93.3211, -36.9827, 8.0947):81, - (94.2302, -28.9926, -9.1665):82, - (82.3123, -6.9657, -27.1167):83, - (68.0684, 23.3938, -49.2364):84, - (73.6833, 41.0464, -40.0349):85, - (77.4342, 51.3197, -33.9217):86, - (74.2811, 48.1595, -14.7725):87, - (0.0, 0.0, 0.0):88, - (5.8822, 0.0022, -0.0022):89, - (16.1144, 0.0022, -0.0033):90, - (22.6151, 0.0018, -0.004):91, - (32.7476, 0.0018, -0.0044):92, - (42.7837, 0.0032, -0.0055):93, - (53.9767, 0.0034, -0.0063):94, - (65.4912, 0.0036, -0.0074):95, - (76.2461, 0.0044, -0.0083):96, - (89.8837, 0.0048, -0.0094):97, - (100.0, 0.0053, -0.0104):98} - self.colors16 = { - (100.0, 0.0053, -0.0104):0, - (0.0, 0.0, 0.0):1, - (12.8119, 47.2407, -64.3396):2, - (52.8041, -57.1624, 55.1703):3, - (53.2329, 80.1093, 67.2201):4, - (25.2966, 47.7847, 37.7562):5, - (36.8705, 68.0659, -42.1489):6, - (66.4237, 42.1616, 73.4335):7, - (97.1382, -21.5559, 94.4825):8, - (86.8105, -85.4149, 82.4382):9, - (55.0455, -31.8888, -9.3772):10, - (91.1165, -48.0796, -14.1381):11, - (31.8712, 78.4892, -106.9003):12, - (60.3199, 98.2542, -60.843):13, - (53.1928, 0.0029, -0.0061):14, - (84.1985, 0.0045, -0.0089):15} - self.colors99= { - (100.0, 0.0053, -0.0104):0, - (0.0, 0.0, 0.0):1, - (12.8119, 47.2407, -64.3396):2, - (52.8041, -57.1624, 55.1703):3, - (53.2329, 80.1093, 67.2201):4, - (25.2966, 47.7847, 37.7562):5, - (36.8705, 68.0659, -42.1489):6, - (66.4237, 42.1616, 73.4335):7, - (97.1382, -21.5559, 94.4825):8, - (86.8105, -85.4149, 82.4382):9, - (55.0455, -31.8888, -9.3772):10, - (91.1165, -48.0796, -14.1381):11, - (31.8712, 78.4892, -106.9003):12, - (60.3199, 98.2542, -60.843):13, - (53.1928, 0.0029, -0.0061):14, - (84.1985, 0.0045, -0.0089):15, - (11.5497, 31.8768, 18.1739):16, - (17.5866, 15.7066, 25.9892):17, - (29.0208, -8.5776, 37.5533):18, - (27.2543, -19.015, 35.3673):19, - (25.2798, -34.2963, 32.8426):20, - (25.8276, -27.5812, 10.7515):21, - (26.6245, -19.1316, -5.6261):22, - (14.986, 1.2467, -23.6473):23, - (4.1091, 27.6851, -41.3905):24, - (9.2862, 34.8709, -32.6869):25, - (14.3696, 39.0991, -24.2113):26, - (12.6512, 34.8073, -6.066):27, - (22.699, 44.779, 34.3145):28, - (31.2054, 21.9979, 41.7676):29, - (47.2407, -12.0488, 52.8125):30, - (44.5753, -27.9355, 49.6338):31, - (41.9858, -48.1745, 46.4957):32, - (42.7207, -39.1444, 16.0528):33, - (43.8747, -26.8746, -7.9028):34, - (26.5278, 3.8603, -34.8152):35, - (11.0, 44.2673, -60.2918):36, - (19.0423, 48.637, -46.7161):37, - (26.6606, 54.9202, -34.0091):38, - (24.1377, 48.6121, -6.8774):39, - (37.5243, 61.9327, 51.9413):40, - (50.3904, 27.7338, 58.553):41, - (71.4677, -16.6651, 73.0447):42, - (67.5818, -39.987, 68.408):43, - (64.1995, -66.6294, 64.3075):44, - (65.1526, -54.8772, 23.9922):45, - (66.8122, -37.1703, -10.9303):46, - (41.6262, 7.9137, -50.0682):47, - (21.343, 61.2273, -83.3898):48, - (32.0743, 66.9878, -65.2716):49, - (43.0033, 75.9603, -47.0378):50, - (39.3866, 66.9043, -7.4929):51, - (69.4811, 36.8308, 75.4949):53, - (92.125, -51.6335, 88.501):55, - (87.737, -86.1846, 83.1812):56, - (88.9499, -71.2147, 31.6061):57, - (58.0145, 11.3842, -65.6058):59, - (32.3026, 79.1967, -107.8637):60, - (45.9331, 86.4699, -84.8483):61, - (55.6111, 86.4597, -9.1916):63, - (60.8927, 62.8729, 35.0702):64, - (78.8241, 18.6736, 56.0796):65, - (97.6208, -17.6977, 66.4162):66, - (94.1539, -37.4631, 68.7023):67, - (89.8813, -66.1541, 56.3842):68, - (91.0093, -53.1765, 13.8066):69, - (92.571, -38.7824, -11.8131):70, - (70.8615, -4.4808, -45.0866):71, - (47.6091, 49.3215, -82.3961):72, - (58.1323, 68.3853, -64.8302):73, - (68.0079, 76.2368, -48.6298):74, - (63.3723, 71.7112, -18.3923):75, - (74.4686, 36.8822, 15.7988):76, - (87.1187, 8.2035, 33.0227):77, - (98.1056, -13.9188, 47.2642):78, - (96.0337, -24.7493, 44.2003):79, - (92.1264, -48.2196, 38.3812):80, - (93.3211, -36.9827, 8.0947):81, - (94.2302, -28.9926, -9.1665):82, - (82.3123, -6.9657, -27.1167):83, - (68.0684, 23.3938, -49.2364):84, - (73.6833, 41.0464, -40.0349):85, - (77.4342, 51.3197, -33.9217):86, - (74.2811, 48.1595, -14.7725):87, - (5.8822, 0.0022, -0.0022):89, - (16.1144, 0.0022, -0.0033):90, - (22.6151, 0.0018, -0.004):91, - (32.7476, 0.0018, -0.0044):92, - (42.7837, 0.0032, -0.0055):93, - (53.9767, 0.0034, -0.0063):94, - (65.4912, 0.0036, -0.0074):95, - (76.2461, 0.0044, -0.0083):96, - (89.8837, 0.0048, -0.0094):97} - self.x256colors99 = ['01','05','32','30','02','38','34','96','94','04','56','08','60','13','11','00','01','36','02','48','48','60','32','34','47','47','47','72','03','33','10','59','59','59','44','45','45','46','71','71','09','68','45','69','46','83','56','68','57','57','69','11','28','38','37','49','49','60','30','93','47','72','72','72','31','33','10','59','59','59','43','45','45','46','71','71','09','68','57','69','70','83','56','68','68','57','69','70','05','39','38','49','49','61','41','93','50','50','72','72','30','30','94','84','84','84','43','43','45','46','71','71','43','68','80','81','82','83','55','68','68','80','81','70','40','51','06','50','50','61','41','64','63','50','73','73','30','41','76','87','85','84','42','42','95','96','84','84','55','67','79','81','82','83','55','67','80','80','81','82','40','51','51','50','50','73','41','64','63','75','13','73','53','07','76','87','85','85','42','65','77','76','87','85','42','66','78','78','15','97','55','67','79','79','81','82','04','64','63','63','13','13','07','64','63','75','75','74','53','64','76','87','87','86','65','65','65','76','87','86','08','77','77','77','97','86','08','66','66','78','78','00','01','89','89','90','91','91','92','92','92','93','93','14','94','94','95','95','95','96','96','96','15','97','97','97'] - self.x256colors16 = ['01','05','03','03','02','06','10','15','14','04','09','08','12','13','11','00','01','02','02','02','12','12','03','10','12','12','12','12','03','10','10','10','14','14','03','03','10','10','10','10','09','09','09','11','11','11','09','09','09','09','11','11','05','06','02','12','12','12','03','14','14','12','12','12','03','03','10','14','14','14','03','03','10','10','10','15','09','09','09','11','11','11','09','09','09','09','11','11','05','06','06','06','06','12','14','14','06','06','06','13','03','14','14','14','14','13','03','03','03','11','11','11','09','09','09','11','11','11','09','09','09','09','11','11','05','06','06','06','06','06','07','04','06','13','13','13','07','07','14','14','13','13','08','08','15','15','15','15','08','09','09','15','15','15','09','09','09','09','11','11','04','06','06','06','13','13','07','04','13','13','13','13','07','07','04','13','13','13','08','07','07','15','15','13','08','08','08','15','15','15','08','08','08','09','00','00','04','04','13','13','13','13','07','04','13','13','13','13','07','07','04','13','13','13','07','07','07','15','15','13','08','08','08','15','15','15','08','08','08','08','00','00','01','01','01','01','01','01','01','14','14','14','14','14','14','14','14','14','15','15','15','15','15','15','15','00'] - self.x256colors83 = ['88','28','32','30','36','38','34','96','94','52','56','54','60','62','58','98','88','36','36','48','48','60','32','34','47','47','47','72','32','33','34','59','59','59','44','45','45','46','71','71','44','68','45','69','46','83','56','68','57','57','69','58','28','38','37','49','49','60','30','93','47','72','72','72','31','33','34','59','59','59','43','45','45','46','71','71','56','68','57','69','70','83','56','68','68','57','69','70','28','39','38','49','49','61','41','93','50','50','72','72','30','30','94','84','84','84','43','43','45','46','71','71','43','68','80','81','82','83','55','68','68','80','81','70','40','51','51','50','50','61','41','64','63','50','73','73','30','41','76','87','85','84','42','42','95','96','84','84','55','67','79','81','82','83','55','67','80','80','81','82','40','51','51','50','50','73','41','64','63','75','62','73','53','53','76','87','85','85','42','65','77','76','87','85','42','66','78','78','97','97','55','67','79','79','81','82','52','64','63','63','62','62','52','64','63','75','75','74','53','64','76','87','87','86','65','65','65','76','87','86','54','77','77','77','97','86','54','66','66','78','78','98','88','89','89','90','91','91','92','92','92','93','93','94','94','94','95','95','95','96','96','96','97','97','97','97'] - self.x16colors = { - '30':'01', - '31':'05', - '32':'03', - '33':'07', - '34':'02', - '35':'06', - '36':'10', - '37':'15', - '30;1':'14', - '31;1':'04', - '32;1':'09', - '33;1':'08', - '34;1':'12', - '35;1':'13', - '36;1':'11', - '37;1':'00', - '40':'01', - '41':'05', - '42':'03', - '43':'07', - '44':'02', - '45':'06', - '46':'10', - '47':'15', - '40;1':'14', - '41;1':'04', - '42;1':'09', - '43;1':'08', - '44;1':'12', - '45;1':'13', - '46;1':'11', - '47;1':'00'} - - def doPrivmsg(self, irc, msg): - channel = msg.args[0] - self.stopped.setdefault(channel, None) - if msg.args[1].lower().strip()[1:] == 'cq': - self.stopped[channel] = True - - def doPaste(self, description, paste): - try: - description = description.split('/')[-1] - apikey = self.registryValue('pasteAPI') - payload = {'description':description,'sections':[{'contents':paste}]} - headers = {'X-Auth-Token':apikey} - post_response = requests.post(url='https://api.paste.ee/v1/pastes', json=payload, headers=headers) - response = post_response.json() - return response['link'].replace('/p/', '/r/') - except: - return "Error. Did you set a valid Paste.ee API Key? https://paste.ee/account/api" - - def renderImage(self, text, size=18, defaultBg = 1, defaultFg = 0): - try: - if utf8 and not isinstance(text, unicode): - text = text.decode('utf-8') - except: - pass - text = text.replace('\t', ' ') - self.strip_colors_regex = re.compile('(\x03([0-9]{1,2})(,[0-9]{1,2})?)|[\x0f\x02\x1f\x03\x16]').sub - path = os.path.dirname(os.path.abspath(__file__)) - defaultFont = "{0}/DejaVu.ttf".format(path) - def strip_colors(string): - return self.strip_colors_regex('', string) - _colorRegex = re.compile('(([0-9]{1,2})(,([0-9]{1,2}))?)') - IGNORE_CHRS = ('\x16','\x1f','\x02', '\x03', '\x0f') - lineLens = [len(line) for line in strip_colors(text).splitlines()] - maxWidth, height = max(lineLens), len(lineLens) - font = ImageFont.truetype(defaultFont, size) - fontX = 10 - fontY = 20 - imageX, imageY = maxWidth * fontX, height * fontY - image = Image.new('RGB', (imageX, imageY), self.rgbColors[defaultBg]) - draw = ImageDraw.Draw(image) - dtext, drect, match, x, y, fg, bg = draw.text, draw.rectangle, _colorRegex.match, 0, 0, defaultFg, defaultBg - start = time.time() - for text in text.split('\n'): - ll, i = len(text), 0 - while i < ll: - chr = text[i] - if chr == "\x03": - m = match(text[i+1:i+6]) - if m: - i+= len(m.group(1)) - fg = int(m.group(2)) - if m.group(4) is not None: - bg = int(m.group(4)) - else: - bg, fg = defaultBg, defaultFg - elif chr == "\x0f": - fg, bg = defaultFg, defaultBg - elif chr not in IGNORE_CHRS: - if bg != defaultBg: # bg is not white, render it - drect((x, y, x+fontX, y+fontY), fill=self.rgbColors[bg]) - if bg != fg: # text will show, render it. this saves a lot of time! - dtext((x, y), chr, font=font, fill=self.rgbColors[fg]) - x += fontX - i += 1 - y += fontY - fg, bg, x = defaultFg, defaultBg, 0 - return image, imageX, imageY - - def getColor(self, pixel, speed): - pixel = tuple(pixel) - try: - return self.matches[pixel] - except KeyError: - if self.colors == 16: - colors = list(self.colors16.keys()) - elif self.colors == 99: - colors = list(self.colors99.keys()) - else: - colors = list(self.colors83.keys()) - closest_colors = sorted(colors, key=lambda color: self.distance(color, self.rgb2lab(pixel), speed)) - closest_color = closest_colors[0] - if self.colors == 16: - self.matches[pixel] = self.colors16[closest_color] - elif self.colors == 99: - self.matches[pixel] = self.colors99[closest_color] - else: - self.matches[pixel] = self.colors83[closest_color] - self.source_colors += 1 - return self.matches[pixel] - - def rgb2lab (self, inputColor) : - try: - return self.labmatches[inputColor] - except: - num = 0 - RGB = [0, 0, 0] - for value in inputColor : - value = float(value) / 255 - if value > 0.04045 : - value = ( ( value + 0.055 ) / 1.055 ) ** 2.4 - else : - value = value / 12.92 - RGB[num] = value * 100 - num = num + 1 - XYZ = [0, 0, 0,] - X = RGB [0] * 0.4124 + RGB [1] * 0.3576 + RGB [2] * 0.1805 - Y = RGB [0] * 0.2126 + RGB [1] * 0.7152 + RGB [2] * 0.0722 - Z = RGB [0] * 0.0193 + RGB [1] * 0.1192 + RGB [2] * 0.9505 - XYZ[ 0 ] = round( X, 4 ) - XYZ[ 1 ] = round( Y, 4 ) - XYZ[ 2 ] = round( Z, 4 ) - XYZ[ 0 ] = float( XYZ[ 0 ] ) / 95.047 # ref_X = 95.047 Observer= 2°, Illuminant= D65 - XYZ[ 1 ] = float( XYZ[ 1 ] ) / 100.0 # ref_Y = 100.000 - XYZ[ 2 ] = float( XYZ[ 2 ] ) / 108.883 # ref_Z = 108.883 - num = 0 - for value in XYZ : - if value > 0.008856 : - value = value ** ( 0.3333333333333333 ) - else : - value = ( 7.787 * value ) + ( 16 / 116 ) - XYZ[num] = value - num = num + 1 - Lab = [0, 0, 0] - L = ( 116 * XYZ[ 1 ] ) - 16 - a = 500 * ( XYZ[ 0 ] - XYZ[ 1 ] ) - b = 200 * ( XYZ[ 1 ] - XYZ[ 2 ] ) - Lab [ 0 ] = round( L, 4 ) - Lab [ 1 ] = round( a, 4 ) - Lab [ 2 ] = round( b, 4 ) - self.labmatches[inputColor] = Lab - return self.labmatches[inputColor] - - def ciede2000(self, lab1, lab2): - """ CIEDE2000 color difference formula. https://peteroupc.github.io/colorgen.html""" - dl=lab2[0]-lab1[0] - hl=lab1[0]+dl*0.5 - sqb1=lab1[2]*lab1[2] - sqb2=lab2[2]*lab2[2] - c1=math.sqrt(lab1[1]*lab1[1]+sqb1) - c2=math.sqrt(lab2[1]*lab2[1]+sqb2) - hc7=math.pow((c1+c2)*0.5,7) - trc=math.sqrt(hc7/(hc7+6103515625)) - t2=1.5-trc*0.5 - ap1=lab1[1]*t2 - ap2=lab2[1]*t2 - c1=math.sqrt(ap1*ap1+sqb1) - c2=math.sqrt(ap2*ap2+sqb2) - dc=c2-c1 - hc=c1+dc*0.5 - hc7=math.pow(hc,7) - trc=math.sqrt(hc7/(hc7+6103515625)) - h1=math.atan2(lab1[2],ap1) - if h1<0: - h1=h1+math.pi*2 - h2=math.atan2(lab2[2],ap2) - if h2<0: - h2=h2+math.pi*2 - hdiff=h2-h1 - hh=h1+h2 - if abs(hdiff)>math.pi: - hh=hh+math.pi*2 - if h2<=h1: - hdiff=hdiff+math.pi*2 - else: - hdiff=hdiff-math.pi*2 - hh=hh*0.5 - t2=1-0.17*math.cos(hh-math.pi/6)+0.24*math.cos(hh*2) - t2=t2+0.32*math.cos(hh*3+math.pi/30) - t2=t2-0.2*math.cos(hh*4-math.pi*63/180) - dh=2*math.sqrt(c1*c2)*math.sin(hdiff*0.5) - sqhl=(hl-50)*(hl-50) - fl=dl/(1+(0.015*sqhl/math.sqrt(20+sqhl))) - fc=dc/(hc*0.045+1) - fh=dh/(t2*hc*0.015+1) - dt=30*math.exp(-math.pow(36*hh-55*math.pi,2)/(25*math.pi*math.pi)) - r=-2*trc*math.sin(2*dt*math.pi/180) - return math.sqrt(fl*fl+fc*fc+fh*fh+r*fc*fh) - - def distance(self, c1, c2, speed): - if speed == 'fast': - delta_e = math.sqrt((c1[0] - c2[0]) **2 + (c1[1] - c2[1]) ** 2 + (c1[2] - c2[2]) **2) - elif speed == 'slow': - delta_e = self.ciede2000(c1, c2) - return delta_e - - def process_ansi(self, ansi): - if self.colors == 16: - colors = self.x256colors16 - elif self.colors == 99: - colors = self.x256colors99 - else: - colors = self.x256colors83 - x16color1 = None - x16color2 = None - x256color1 = None - x256color2 = None - effect = None - ansi = ansi.lower().strip('\x1b[').strip('m').split(';') - if len(ansi) > 1: - i = 0 - while i < len(ansi): - if i >= len(ansi): - break - elif ansi[i]== '0': - effect = 0 - i += 1 - continue - elif ansi[i] == '1': - effect = 1 - i += 1 - continue - elif ansi[i] == '4': - effect = 4 - i += 1 - continue - elif ansi[i] == '2': - effect = 2 - i += 1 - continue - elif int(ansi[i]) > 29 and int(ansi[i]) < 38: - if effect == 1 or ansi[-1] == '1': - x16color1 = self.x16colors['{0};1'.format(ansi[i])] - effect = None - i += 1 - continue - else: - x16color1 = self.x16colors[ansi[i]] - i += 1 - continue - elif int(ansi[i]) > 39 and int(ansi[i]) < 48: - if effect == 1 or ansi[-1] == '1': - x16color2 = self.x16colors['{0};1'.format(ansi[i])] - effect = None - i += 1 - continue - else: - x16color2 = self.x16colors[ansi[i]] - i += 1 - continue - elif ansi[i] == '38': - x256color1 = colors[int(ansi[i+2])] - i += 3 - continue - elif ansi[i] == '48': - x256color2 = colors[int(ansi[i+2])] - i += 3 - continue - else: - i += 1 - continue - if x16color1 and x16color2: - color = '\x03{0},{1}'.format(x16color1, x16color2) - elif x256color1 and x256color2: - color = '\x03{0},{1}'.format(x256color1, x256color2) - elif x16color1: - color = '\x03{0}'.format(x16color1) - elif x16color2: - color = '\x0399,{0}'.format(x16color2) - elif x256color1: - color = '\x03{0}'.format(x256color1) - elif x256color2: - color = '\x0399,{0}'.format(x256color2) - else: - color = '' - if effect == 1: - color += '\x02' - if effect == 4: - color += '\x1F' - elif len(ansi[0]) > 0: - if ansi[0] == '0': - color = '\x0F' - elif ansi[0] == '1' or ansi[0] == '2': - color = '\x02' - elif ansi[0] == '4': - color = '\x1F' - elif int(ansi[0]) > 29 and int(ansi[0]) < 38: - color = '\x03{0}'.format(self.x16colors[ansi[0]]) - elif int(ansi[0]) > 39 and int(ansi[0]) < 48: - color = '\x0399,{0}'.format(self.x16colors[ansi[0]]) - elif ansi[0][-1] == 'c': - color = ' ' * int(ansi[0][:-1]) - else: - color = '' - else: - color = '' - if color != self.old_color: - self.old_color = color - return color - else: - return '' - - def ansi2irc(self, output): - output = output.replace('\x1b(B\x1b[m', '\x1b[0m') - output = output.replace('\x1b\x1b', '\x1b') - output = re.sub(r'\x1B\[[0-?]*[ -/]*[@-~]', lambda m: self.process_ansi(m.group(0)), output) - output = re.sub('\x0399,(\d\d)\x03(\d\d)', '\x03\g<2>,\g<1>', output) - output = output.replace('\x0F\x03', '\x03') - return output - - def png(self, irc, msg, args, optlist, url): - """[--bg] [--fg] - Generate PNG from text file - """ - optlist = dict(optlist) - if 'bg' in optlist: - bg = optlist.get('bg') - else: - bg = 1 - if 'fg' in optlist: - fg = optlist.get('fg') - else: - fg = 0 - if url.startswith("https://paste.ee/p/"): - url = re.sub("https://paste.ee/p/", "https://paste.ee/r/", url) - ua = UserAgent() - header = {'User-Agent':str(ua.random)} - r = requests.head(url, headers=header) - if "text/plain" in r.headers["content-type"] or url.startswith('https://paste.ee/r/'): - file = requests.get(url, headers=header) - else: - irc.reply("Invalid file type.", private=False, notice=False) - return - try: - file = file.content.decode() - except: - file = file.content.decode('cp437') - file = re.sub('(\x03(\d+).*)\x03,', '\g<1>\x03\g<2>,', file).replace('\r\n','\n') - im, x, y = self.renderImage(file, 18, bg, fg) - path = os.path.dirname(os.path.abspath(__file__)) - filepath = "{0}/tmp/tldr.png".format(path) - im.save(filepath, "PNG") - CLIENT_ID = self.registryValue('imgurAPI') - imgur = pyimgur.Imgur(CLIENT_ID) - uploaded_image = imgur.upload_image(filepath, title=url) - irc.reply(uploaded_image.link, noLengthCheck=True, private=False, notice=False) - png = wrap(png, [getopts({'bg':'int', 'fg':'int'}), ('text')]) - - def artii(self, irc, msg, args, channel, optlist, text): - """[] [--font ] [--color ] [] - Text to ASCII figlet fonts using the artii API - """ - if not channel: - channel = msg.args[0] - channel = msg.args[0] - optlist = dict(optlist) - font = None - words = [] - if text: - text = text.strip() - if '|' in text: - words = text.split('|') - if 'color' in optlist: - color = optlist.get('color') - if "," in color: - color = color.split(",") - color1 = color[0].strip() - color2 = color[1].strip() - else: - color1 = color - color2 = None - else: - color1 = None - color2 = None - if 'font' in optlist: - font = optlist.get('font') - if words: - for word in words: - if word.strip(): - data = requests.get("https://artii.herokuapp.com/make?text={0}&font={1}".format(word.strip(), font)) - for line in data.text.splitlines(): - if line.strip(): - irc.reply(ircutils.mircColor(line, color1, color2), prefixNick=False, private=False, notice=False) - else: - data = requests.get("https://artii.herokuapp.com/make?text={0}&font={1}".format(text, font)) - for line in data.text.splitlines(): - if line.strip(): - irc.reply(ircutils.mircColor(line, color1, color2), prefixNick=False, private=False, notice=False, to=channel) - elif 'font' not in optlist: - if words: - for word in words: - if word.strip(): - data = requests.get("https://artii.herokuapp.com/make?text={0}&font=univers".format(word.strip())) - for line in data.text.splitlines(): - if line.strip(): - irc.reply(ircutils.mircColor(line, color1, color2), prefixNick=False, private=False, notice=False, to=channel) - else: - data = requests.get("https://artii.herokuapp.com/make?text={0}&font=univers".format(text)) - for line in data.text.splitlines(): - if line.strip(): - irc.reply(ircutils.mircColor(line, color1, color2), prefixNick=False, private=False, notice=False, to=channel) - - artii = wrap(artii, [optional('channel'), getopts({'font':'text', 'color':'text'}), ('text')]) - - def fontlist(self, irc, msg, args): - """ - Get list of artii figlet fonts. - """ - fontlist = requests.get("https://artii.herokuapp.com/fonts_list") - response = sorted(fontlist.text.split('\n')) - irc.reply(str(response).replace('\'', '').replace('[', '').replace(']', '')) - fontlist = wrap(fontlist) - - def img(self, irc, msg, args, channel, optlist, url): - """[<#channel>] [--delay #.#] [--w <###>] [--s <#.#] [--16] [--99] [--83] [--ascii] [--block] [--1/2] [--chars ] [--ramp ] [--bg <0-98>] [--fg <0-98>] [--no-color] [--invert] - Image to IRC art. - --w columns. - --s saturation (1.0). - --16 colors 0-15. - --99 colors 0-98. - --83 colors 16-98. - --ascii color ascii. - --block space block. - --1/2 for 1/2 block - --chars color text. - --ramp set ramp (".:-=+*#%@"). - --bg <0-98> set bg. - --fg <0-99> set fg. - --no-color greyscale ascii. - --invert inverts ramp. - """ - if not channel: - channel = msg.args[0] - if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): - irc.errorNoCapability('admin') - return - optlist = dict(optlist) - gscale = "\xa0" - if '16' in optlist: - self.colors = 16 - elif '83' in optlist: - self.colors = 83 - elif '99' in optlist: - self.colors = 99 - else: - self.colors = self.registryValue('colors', msg.args[0]) - if 'fast' in optlist: - speed = 'fast' - elif 'slow' in optlist: - speed = 'slow' - else: - speed = self.registryValue('speed', msg.args[0]).lower() - if 'delay' in optlist: - delay = optlist.get('delay') - else: - delay = self.registryValue('delay', msg.args[0]) - if 'quantize' in optlist: - quantize = True - elif 'no-quantize' in optlist: - quantize = False - else: - quantize = self.registryValue('quantize', msg.args[0]) - if 'bg' in optlist: - bg = optlist.get('bg') - else: - bg = self.registryValue('bg', msg.args[0]) - if 'fg' in optlist: - fg = optlist.get('fg') - else: - fg = self.registryValue('fg', msg.args[0]) - if 'chars' in optlist: - type = 'ascii' - gscale = optlist.get('chars') - elif 'ramp' in optlist: - type = 'ascii' - gscale = optlist.get('ramp') - elif 'ascii' in optlist and bg == 0 or bg == 98: - type = 'ascii' - gscale = "$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\|()1{}[]?-_+~<>i!lI;:\"^`'." - elif 'ascii' in optlist: - type = 'ascii' - gscale = ".'`^\":;Il!i><~+_-?][}{1)(|\/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$" - elif '1/2' in optlist: - type = '1/2' - elif 'block' in optlist: - type = 'ascii' - gscale = '\xa0' - else: - type = self.registryValue('imgDefault', msg.args[0]).lower() - if 'no-color' in optlist and 'ramp' not in optlist and bg == 0 or bg == 98: - type = 'no-color' - gscale = "@%#*+=-:. " - elif 'no-color' in optlist and 'ramp' not in optlist: - type = 'no-color' - gscale = " .:-=+*#%@" - elif 'no-color' in optlist and 'chars' not in optlist: - type = 'no-color' - if not gscale.strip(): - gscale = '\xa0' - if 'invert' in optlist and 'chars' not in optlist and gscale != '\xa0': - gscale = gscale[::-1] - if 'w' in optlist: - cols = optlist.get('w') - elif type == 'ascii' or type == 'no-color' or type == 'block': - cols = self.registryValue('asciiWidth', msg.args[0]) - else: - cols = self.registryValue('blockWidth', msg.args[0]) - if 's' in optlist: - s = float(optlist.get('s')) - path = os.path.dirname(os.path.abspath(__file__)) - filepath = "{0}/tmp".format(path) - filename = "{0}/{1}".format(filepath, url.split('/')[-1]) - ua = UserAgent() - header = {'User-Agent':str(ua.random)} - image_formats = ("image/png", "image/jpeg", "image/jpg", "image/gif") - r = requests.head(url, headers=header) - if r.headers["content-type"] in image_formats: - response = requests.get(url, headers=header) - else: - irc.reply("Invalid file type.", private=False, notice=False) - return - if response.status_code == 200: - with open("{0}".format(filename), 'wb') as f: - f.write(response.content) - # open image and convert to grayscale - start_time = time.time() - self.source_colors = 0 - image = Image.open(filename) - if image.mode == 'RGBA': - if bg == 99: - newbg = 1 - else: - newbg = bg - image = Image.alpha_composite(Image.new("RGBA", image.size, self.rgbColors[newbg] + (255,)), image) - if image.mode != 'RGB': - image = image.convert('RGB') - try: - os.remove(filename) - except: - pass - # store dimensions - W, H = image.size[0], image.size[1] - # compute width of tile - w = W/cols - # compute tile height based on aspect ratio and scale - if type == '1/2': - scale = 1.0 - else: - scale = 0.5 - h = w/scale - # compute number of rows - rows = int(H/h) - if 'resize' in optlist: - resize = optlist.get('resize') - else: - resize = self.registryValue('resize', msg.args[0]) - if type != 'no-color': - image2 = image.resize((cols, rows), resize) - if 's' in optlist: - image2 = ImageEnhance.Color(image2).enhance(s) - if quantize: - image2 = image2.quantize(dither=None) - image2 = image2.convert('RGB') - colormap = np.array(image2) - self.matches = {} - self.labmatches = {} - # ascii image is a list of character strings - aimg = [] - if type == '1/2': - k = 0 - for j in range(0, rows - 1, 2): - # append an empty string - aimg.append("") - old_color1 = "99" - old_color2 = "99" - old_char = None - for i in range(cols): - color1 = '%02d' % self.getColor(colormap[j][i].tolist(), speed) - color2 = '%02d' % self.getColor(colormap[j+1][i].tolist(), speed) - if color1 == color2: - gsval = " " - else: - gsval = "▀" - if color1 == old_color1 and color2 == old_color2: - aimg[k] += gsval - old_char = gsval - elif gsval == " " and color1 == old_color2: - aimg[k] += " " - old_char = gsval - elif gsval == " " and color1 == old_color1 and old_char == '█': - aimg[k] = aimg[k][:-1] - aimg[k] += "\x0301,{0} ".format(color1) - old_color1 = "01" - old_color2 = color1 - old_char = gsval - elif gsval == " " and color1 == old_color1 and old_char == '^█': - aimg[k] = aimg[k][:-4] - aimg[k] += "\x0301,{0} ".format(color1) - old_color1 = "01" - old_color2 = color1 - old_char = gsval - elif gsval == " " and color1 == old_color1 and old_char == "^^▀" and 'tops' not in optlist: - aimg[k] = aimg[k][:-7] - aimg[k] += "\x03{0},{1}▄ ".format(old_color2, color1) - old_color1 = old_color2 - old_color2 = color1 - old_char = gsval - elif gsval == " " and color1 == old_color1 and old_char != '█' and 'tops' not in optlist: - aimg[k] += "█" - old_char = '█' - elif gsval == " " and 'tops' not in optlist: - aimg[k] += "\x03{0}█".format(color1) - old_color1 = color1 - old_char = '^█' - elif gsval != " " and color1 == old_color1 and old_char == '^█' and 'tops' not in optlist: - aimg[k] = aimg[k][:-4] - aimg[k] += "\x03{0},{1} ▄".format(color2, color1) - old_color1 = color2 - old_color2 = color1 - old_char = '▄' - elif gsval != " " and color2 == old_color1 and old_char == '^█': - aimg[k] = aimg[k][:-4] - aimg[k] += "\x03{0},{1} ▀".format(color1, color2) - old_color1 = color1 - old_color2 = color2 - old_char = gsval - elif gsval != " " and color1 == old_color2 and color2 == old_color1 and old_char == "^^▀" and 'tops' not in optlist: - aimg[k] = aimg[k][:-7] - aimg[k] += "\x03{0},{1}▄▀".format(color1, color2) - old_color1 = color1 - old_color2 = color2 - old_char = gsval - elif gsval != " " and color1 == old_color1 and color2 != old_color2 and old_char == "^^▀" and 'tops' not in optlist: - aimg[k] = aimg[k][:-7] - aimg[k] += "\x03{0},{1}▄\x03{2}▄".format(old_color2, color1, color2) - old_color1 = color2 - old_color2 = color1 - old_char = '▄' - elif gsval != " " and color1 == old_color1 and color2 != old_color2 and old_char == "^▀" and 'tops' not in optlist: - aimg[k] = aimg[k][:-4] - aimg[k] += "\x03{0},{1}▄\x03{2}▄".format(old_color2, color1, color2) - old_color1 = color2 - old_color2 = color1 - old_char = '▄' - elif gsval != " " and color1 == old_color2 and color2 == old_color1 and 'tops' not in optlist: - aimg[k] += "▄" - old_char = '▄' - elif gsval != " " and color1 == old_color2 and 'tops' not in optlist: - aimg[k] += "\x03{0}▄".format(color2) - old_color1 = color2 - old_char = '▄' - elif color1 != old_color1 and color2 == old_color2: - aimg[k] += "\x03{0}{1}".format(color1, gsval) - old_color1 = color1 - if gsval == ' ': - old_char = gsval - else: - old_char = '^▀' - else: - aimg[k] += "\x03{0},{1}{2}".format(color1, color2, gsval) - old_color1 = color1 - old_color2 = color2 - if gsval == ' ': - old_char = gsval - else: - old_char = '^^▀' - if 'tops' in optlist: - aimg[k] = re.sub("\x03\d\d,(\d\d\s+\x03)", "\x0301,\g<1>", aimg[k]) - aimg[k] = re.sub("\x03\d\d,(\d\d\s+$)", "\x0301,\g<1>", aimg[k]) - aimg[k] = re.sub("\x03\d\d,(\d\d\s\x03)", "\x0301,\g<1>", aimg[k]) - aimg[k] = re.sub("\x0301,(\d\d)(\s+)\x03(\d\d)([^,])", "\x03\g<3>,\g<1>\g<2>\g<4>", aimg[k]) - for i in range(0,98): - i = '%02d' % i - aimg[k] = aimg[k].replace("{0}".format(i), "{0}".format(int(i))) - k += 1 - else: - if 'chars' not in optlist and gscale != '\xa0': - image = image.resize((cols, rows), resize) - image = image.convert('L') - lumamap = np.array(image) - # generate list of dimensions - char = 0 - for j in range(rows): - # append an empty string - aimg.append("") - old_color = None - for i in range(cols): - if 'chars' not in optlist and gscale != '\xa0': - # get average luminance - avg = int(np.average(lumamap[j][i])) - # look up ascii char - gsval = gscale[int((avg * (len(gscale) - 1))/255)] - elif 'chars' in optlist and gscale != '\xa0': - if char < len(gscale): - gsval = gscale[char] - char += 1 - else: - char = 0 - gsval = gscale[char] - char += 1 - else: - gsval = '\xa0' - # get color value - if type != 'no-color' and gscale != '\xa0' and i == 0: - color = self.getColor(colormap[j][i].tolist(), speed) - old_color = color - if bg != 99: - color = "{0},{1}".format(color, "{:02d}".format(int(bg))) - if gsval != '\xa0': - aimg[j] += "\x03{0}{1}".format(color, gsval) - else: - aimg[j] += "\x030,{0} ".format(int(color)) - elif type == 'no-color' and i == 0: - if bg != 99 and fg != 99: - aimg[j] += "\x03{0},{1}{2}".format("{:02d}".format(int(fg)), "{:02d}".format(int(bg)), gsval) - elif fg != 99: - aimg[j] += "\x03{0}{1}".format("{:02d}".format(int(fg)), gsval) - elif bg != 99: - aimg[j] += "\x03{0},{1}{2}".format("{:02d}".format(int(fg)), "{:02d}".format(int(bg)), gsval) - elif type != 'no-color' and gsval != ' ': - color = self.getColor(colormap[j][i].tolist(), speed) - if color != old_color: - old_color = color - # append ascii char to string - if gsval != '\xa0': - if gsval.isdigit(): - color = "{:02d}".format(int(color)) - aimg[j] += "\x03{0}{1}".format(color, gsval) - else: - aimg[j] += "\x03{0}{1}".format(int(color), gsval) - else: - aimg[j] += "\x030,{0} ".format(int(color)) - else: - aimg[j] += "{0}".format(gsval) - else: - aimg[j] += "{0}".format(gsval) - output = aimg - paste = "" - self.stopped[msg.args[0]] = False - end_time = time.time() - for line in output: - if self.registryValue('pasteEnable', msg.args[0]): - paste += line + "\n" - if not self.stopped[msg.args[0]]: - time.sleep(delay) - irc.reply(line, prefixNick=False, noLengthCheck=True, private=False, notice=False, to=channel) - if self.registryValue('showStats', msg.args[0]): - longest = len(max(output, key=len).encode('utf-8')) - render_time = "{0:.2f}".format(end_time - start_time) - irc.reply("[Source Colors: {0}, Render Time: {1} seconds, Longest Line: {2} bytes]".format(self.source_colors, render_time, longest), prefixNick=False) - if self.registryValue('pasteEnable', msg.args[0]): - irc.reply(self.doPaste(url, paste), private=False, notice=False, to=channel) - img = wrap(img,[optional('channel'), getopts({'w':'int', 'invert':'', 'fast':'', 'slow':'', '16':'', '99':'', '83':'', 'delay':'float', 'resize':'int', 'quantize':'', 'no-quantize':'', 'chars':'text', 'bg':'int', 'fg':'int', 'ramp':'text', 'no-color':'', 'block':'', 'ascii':'', '1/2':'', 's':'float', 'tops':''}), ('text')]) - - def scroll(self, irc, msg, args, channel, optlist, url): - """[] [--delay] - Play IRC art files from web links. - """ - if not channel: - channel = msg.args[0] - if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): - irc.errorNoCapability('admin') - return - optlist = dict(optlist) - self.stopped[msg.args[0]] = False - if 'delay' in optlist: - delay = optlist.get('delay') - else: - delay = self.registryValue('delay', msg.args[0]) - if url.startswith("https://paste.ee/p/"): - url = url.replace("https://paste.ee/p/", "https://paste.ee/r/") - elif url.startswith("https://pastebin.com/") and '/raw/' not in url: - url = url.replace("https://pastebin.com/", "https://pastebin.com/raw/") - ua = UserAgent() - header = {'User-Agent':str(ua.random)} - r = requests.head(url, headers=header) - if "text/plain" in r.headers["content-type"]: - file = requests.get(url, headers=header) - else: - irc.reply("Invalid file type.", private=False, notice=False) - return - file = file.content.decode().replace('\r\n','\n') - for line in file.split('\n'): - if line.strip() and not self.stopped[msg.args[0]]: - time.sleep(delay) - irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - scroll = wrap(scroll, [optional('channel'), getopts({'delay':'float'}), ('text')]) - - def a2m(self, irc, msg, args, channel, optlist, url): - """[] [--delay] [--l] [--r] [--n] [--p] [--t] [--w] - Convert ANSI files to IRC formatted text. https://github.com/tat3r/a2m - """ - if not channel: - channel = msg.args[0] - if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): - irc.errorNoCapability('admin') - return - optlist = dict(optlist) - opts = '' - if 'l' in optlist: - l = optlist.get('l') - opts += '-l {0} '.format(l) - if 'r' in optlist: - r = optlist.get('r') - opts += '-r {0} '.format(r) - if 'n' in optlist: - opts += '-n '.format(n) - if 'p' in optlist: - opts += '-p ' - if 't' in optlist: - t = optlist.get('t') - opts += '-t {0} '.format(t) - if 'w' in optlist: - w = optlist.get('w') - opts += '-w {0} '.format(w) - else: - opts += '-w 80 ' - if 'delay' in optlist: - delay = optlist.get('delay') - else: - delay = self.registryValue('delay', msg.args[0]) - ua = UserAgent() - header = {'User-Agent':str(ua.random)} - r = requests.head(url, headers=header) - try: - if "text/plain" in r.headers["content-type"] or "application/octet-stream" in r.headers["content-type"] and int(r.headers["content-length"]) < 1000000: - path = os.path.dirname(os.path.abspath(__file__)) - filepath = "{0}/tmp".format(path) - filename = "{0}/{1}".format(filepath, url.split('/')[-1]) - r = requests.get(url, headers=header) - open(filename, 'wb').write(r.content.replace(b';5;', b';')) - try: - output = pexpect.run('a2m {0} {1}'.format(opts.strip(), str(filename))) - try: - os.remove(filename) - except: - pass - except: - irc.reply("Error. Have you installed A2M? https://github.com/tat3r/a2m", private=False, notice=False) - return - else: - irc.reply("Invalid file type.") - return - except: - irc.reply("Invalid file type.") - return - paste = "" - self.stopped[msg.args[0]] = False - output = re.sub('(\x03(\d+).*)\x03,', '\g<1>\x03\g<2>,', output.decode()) - for line in output.splitlines(): - if self.registryValue('pasteEnable', msg.args[0]): - paste += line + "\n" - if line.strip() and not self.stopped[msg.args[0]]: - time.sleep(delay) - irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - elif not line.strip() and not self.stopped[msg.args[0]]: - time.sleep(delay) - irc.reply('\xa0', prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - else: - return - if self.registryValue('pasteEnable', msg.args[0]): - irc.reply(self.doPaste(url, paste), private=False, notice=False, to=channel) - a2m = wrap(a2m, [optional('channel'), getopts({'l':'int', 'r':'int', 't':'int', 'w':'int', 'p':'', 'delay':'float'}), ('text')]) - - def p2u(self, irc, msg, args, channel, optlist, url): - """[] [--b] [--f] [--p] [--s] [--t] [--w] [--delay] - Picture to Unicode. https://git.trollforge.org/p2u/about/ - """ - if not channel: - channel = msg.args[0] - if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): - irc.errorNoCapability('admin') - return - optlist = dict(optlist) - opts = '' - if 'b' in optlist: - b = optlist.get('b') - opts += '-b {0} '.format(b) - if 'f' in optlist: - f = optlist.get('f') - opts += '-f {0} '.format(f) - else: - opts += '-f m ' - if 'p' in optlist: - p = optlist.get('p') - opts += '-p {0} '.format(p) - else: - opts += '-p x ' - if 's' in optlist: - s = optlist.get('s') - opts += '-s {0} '.format(s) - if 't' in optlist: - t = optlist.get('t') - opts += '-t {0} '.format(t) - if 'w' in optlist: - w = optlist.get('w') - opts += '-w {0} '.format(w) - else: - w = self.registryValue('blockWidth', msg.args[0]) - opts += '-w {0} '.format(w) - if 'delay' in optlist: - delay = optlist.get('delay') - else: - delay = self.registryValue('delay', msg.args[0]) - path = os.path.dirname(os.path.abspath(__file__)) - filepath = "{0}/tmp".format(path) - filename = "{0}/{1}".format(filepath, url.split('/')[-1]) - ua = UserAgent() - header = {'User-Agent':str(ua.random)} - image_formats = ("image/png", "image/jpeg", "image/jpg", "image/gif") - r = requests.head(url, headers=header) - if r.headers["content-type"] in image_formats: - response = requests.get(url, headers=header) - else: - irc.reply("Invalid file type.", private=False, notice=False) - return - if response.status_code == 200: - with open("{0}".format(filename), 'wb') as f: - f.write(response.content) - try: - output = pexpect.run('p2u -f m {0} {1}'.format(opts.strip(), str(filename))) - try: - os.remove(filename) - except: - pass - except: - irc.reply("Error. Have you installed p2u? https://git.trollforge.org/p2u", private=False, notice=False) - return - paste = "" - self.stopped[msg.args[0]] = False - for line in output.splitlines(): - line = line.decode() - line = re.sub('^\x03 ', ' ', line) - if self.registryValue('pasteEnable', msg.args[0]): - paste += line + "\n" - if line.strip() and not self.stopped[msg.args[0]]: - time.sleep(delay) - irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - if self.registryValue('pasteEnable', msg.args[0]): - irc.reply(self.doPaste(url, paste), private=False, notice=False, to=channel) - else: - irc.reply("Unexpected file type or link format", private=False, notice=False) - p2u = wrap(p2u, [optional('channel'), getopts({'b':'int', 'f':'text', 'p':'text', 's':'int', 't':'int', 'w':'int', 'delay':'float'}), ('text')]) - - def tdf(self, irc, msg, args, channel, optlist, text): - """[] [--f] [--j] [--w] [--e] [--r] [--i][--delay] - Text to TheDraw ANSI Fonts. http://www.roysac.com/thedrawfonts-tdf.html - --f [font] Specify font file used. - --j l|r|c Justify left, right, or center. Default is left. - --w n Set screen width. Default is 80. - --c a|m Color format ANSI or mirc. Default is ANSI. - --i Print font details. - --r Use random font. - """ - if not channel: - channel = msg.args[0] - if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): - irc.errorNoCapability('admin') - return - optlist = dict(optlist) - opts = '' - if 'f' in optlist: - f = optlist.get('f') - opts += '-f {0} '.format(f.lower()) - else: - opts += '-r ' - if 'j' in optlist: - j = optlist.get('j') - opts += '-j {0} '.format(j) - if 'w' in optlist: - w = optlist.get('w') - opts += '-w {0} '.format(w) - else: - opts += '-w 80 ' - if 'e' in optlist: - e = optlist.get('e') - opts += '-e {0} '.format(e) - if 'r' in optlist: - opts += '-r ' - if 'delay' in optlist: - delay = optlist.get('delay') - else: - delay = self.registryValue('delay', msg.args[0]) - if 'i' in optlist: - opts += '-i ' - try: - output = pexpect.run('tdfiglet -c m {0} {1}'.format(opts.strip(), r'{}'.format(text))) - except: - irc.reply("Error. Have you installed tdfiglet? https://github.com/tat3r/tdfiglet", private=False, notice=False) - return - paste = "" - self.stopped[msg.args[0]] = False - output = output.decode().replace('\r\r\n', '\r\n') - for line in output.splitlines(): - line = re.sub('\x03\x03\s*', '\x0F ', line) - line = re.sub('\x0F\s*\x03$', '', line) - if self.registryValue('pasteEnable', msg.args[0]): - paste += line + "\n" - if not line.strip() and not self.stopped[msg.args[0]]: - time.sleep(delay) - irc.reply('\xa0', prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - elif not self.stopped[msg.args[0]]: - time.sleep(delay) - irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - if self.registryValue('pasteEnable', msg.args[0]): - irc.reply(self.doPaste(text, paste), private=False, notice=False, to=channel) - tdf = wrap(tdf, [optional('channel'), getopts({'f':'text', 'j':'text', 'w':'int', 'e':'text', 'r':'', 'i':'', 'delay':'float'}), ('text')]) - - def toilet(self, irc, msg, args, channel, optlist, text): - """[] [--f fontname] [--F filter1,filter2,etc.] [--w] [--delay] - Text to toilet figlets. -f to select font. -F to select filters. Separate multiple filters with a comma. - """ - if not channel: - channel = msg.args[0] - if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): - irc.errorNoCapability('admin') - return - optlist = dict(optlist) - opts = '' - if 'f' in optlist: - f = optlist.get('f') - opts += '-f {0} '.format(f) - if 'F' in optlist: - filter = optlist.get('F') - if ',' in filter: - filter = filter.split(',') - for i in range(len(filter)): - opts += '-F {0} '.format(filter[i]) - else: - opts += '-F {0} '.format(filter) - if 'w' in optlist: - w = optlist.get('w') - opts += '-w {0} '.format(w) - elif 'W' in optlist: - opts += '-W ' - else: - opts += '-w 100 ' - if 's' in optlist: - opts += '-s ' - elif 'k' in optlist: - opts += '-k ' - elif 'o' in optlist: - opts += '-o ' - elif 'S' in optlist: - opts += '-S ' - if 'delay' in optlist: - delay = optlist.get('delay') - else: - delay = self.registryValue('delay', msg.args[0]) - try: - output = pexpect.run('toilet --irc {0} {1}'.format(opts.strip(), text)) - except: - irc.reply("Error. Have you installed toilet?", private=False, notice=False) - return - paste = "" - self.stopped[msg.args[0]] = False - output = output.decode().replace('\r\r\n', '\r\n') - for line in output.splitlines(): - if self.registryValue('pasteEnable', msg.args[0]): - paste += line + "\n" - if not line.strip() and not self.stopped[msg.args[0]]: - time.sleep(delay) - irc.reply('\xa0', prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - elif not self.stopped[msg.args[0]]: - time.sleep(delay) - irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - if self.registryValue('pasteEnable', msg.args[0]): - irc.reply(self.doPaste(text, paste), private=False, notice=False, to=channel) - toilet = wrap(toilet, [optional('channel'), getopts({'f':'text', 'F':'text', 's':'', 'S':'', 'k':'', 'w':'int', 'W':'', 'o':'', 'delay':'float'}), ('text')]) - - def fonts(self, irc, msg, args, optlist): - """[--toilet] - List figlets. Default list are tdf fonts. --toilet for toilet fonts - """ - optlist = dict(optlist) - if 'toilet' in optlist: - try: - reply = ", ".join(sorted(os.listdir("/usr/share/figlet"))) - irc.reply(reply, prefixNick=False) - except: - irc.reply("Sorry, unable to access font directory /usr/share/figlet") - else: - try: - reply = ", ".join(sorted(os.listdir("/usr/local/share/tdfiglet/fonts/"))) - irc.reply("http://www.roysac.com/thedrawfonts-tdf.html", prefixNick=False) - irc.reply(reply, prefixNick=False) - except FileNotFoundError: - reply = ", ".join(sorted(os.listdir("/usr/share/figlet"))) - irc.reply(reply, prefixNick=False) - except: - irc.reply("Sorry, unable to access font directories /usr/local/share/tdfiglet/fonts/ or /usr/share/figlet") - fonts = wrap(fonts, [getopts({'toilet':''})]) - - def wttr(self, irc, msg, args, channel, optlist, location): - """[] [--16] [--99] - IRC art weather report from wttr.in for . - --16 for 16 colors (default). - --99 for 99 colors. - Get moon phase with 'wttr moon'. - ?u (use imperial units). - ?m (metric). - ?<1-3> (number of days) - """ - if not channel: - channel = msg.args[0] - if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): - irc.errorNoCapability('admin') - return - optlist = dict(optlist) - if 'delay' in optlist: - delay = optlist.get('delay') - else: - delay = self.registryValue('delay', msg.args[0]) - if '16' in optlist: - self.colors = 16 - elif '99' in optlist: - self.colors = 99 - else: - self.colors = self.registryValue('colors', msg.args[0]) - if 'fast' in optlist: - speed = 'fast' - elif 'slow' in optlist: - speed = 'slow' - else: - speed = 'fast' - file = requests.get("http://wttr.in/{0}".format(location)) - output = file.content.decode() - output = self.ansi2irc(output) - output = re.sub('⚡', '☇ ', output) - output = re.sub('‘‘', '‘ ', output) - paste = "" - self.stopped[msg.args[0]] = False - for line in output.splitlines(): - line = line.strip('\x0F') - if not line.strip(): - line = '\xa0' - if self.registryValue('pasteEnable', msg.args[0]) and not line.startswith("Follow"): - paste += line + "\n" - if line.strip() and not self.stopped[msg.args[0]] and not line.startswith("Follow"): - time.sleep(delay) - irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - if self.registryValue('pasteEnable', msg.args[0]): - irc.reply(self.doPaste(location, paste), private=False, notice=False, to=channel) - wttr = wrap(wttr, [optional('channel'), getopts({'delay':'float', '16':'', '99':'', 'fast':'', 'slow':''}), ('text')]) - - def rate(self, irc, msg, args, channel, optlist, coin): - """[] [--16] [--99] [--sub ] [coin] - Crypto exchange rate info from rate.sx. http://rate.sx/:help. Use --sub to set subdomain e.g. eur, btc, etc. - Get a graph with [coin] e.g. 'rate btc'. - --16 for 16 colors (default). - --99 for 99 colors. - """ - if not channel: - channel = msg.args[0] - if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): - irc.errorNoCapability('admin') - return - optlist = dict(optlist) - if 'delay' in optlist: - delay = optlist.get('delay') - else: - delay = self.registryValue('delay', msg.args[0]) - if '16' in optlist: - self.colors = 16 - elif '99' in optlist: - self.colors = 99 - else: - self.colors = self.registryValue('colors', msg.args[0]) - if 'fast' in optlist: - speed = 'fast' - elif 'slow' in optlist: - speed = 'slow' - else: - speed = 'fast' - if 'sub' in optlist: - sub = optlist.get('sub') - else: - sub = 'usd' - if not coin: - coin = '' - file = requests.get("http://{0}.rate.sx/{1}".format(sub, coin)) - output = file.content.decode() - output = self.ansi2irc(output) - output = output.replace('\x1b(B', '') - paste = "" - self.stopped[msg.args[0]] = False - for line in output.splitlines(): - line = line.strip('\x0F') - if not line.strip() and not self.stopped[msg.args[0]]: - if self.registryValue('pasteEnable', msg.args[0]): - paste += line + "\n" - time.sleep(delay) - irc.reply('\xa0', prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - elif line.strip() and not self.stopped[msg.args[0]] and "Follow @igor_chubin" not in line: - if self.registryValue('pasteEnable', msg.args[0]): - paste += line + "\n" - time.sleep(delay) - irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - if self.registryValue('pasteEnable', msg.args[0]): - irc.reply(self.doPaste(coin, paste), private=False, notice=False, to=channel) - rate = wrap(rate, [optional('channel'), getopts({'delay':'float', '16':'', '99':'', 'sub':'text', 'fast':'', 'slow':''}), optional('text')]) - - def cow(self, irc, msg, args, channel, optlist, text): - """[] [--delay] [--type ] - Cowsay - """ - if not channel: - channel = msg.args[0] - if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): - irc.errorNoCapability('admin') - return - optlist = dict(optlist) - if 'delay' in optlist: - delay = optlist.get('delay') - else: - delay = self.registryValue('delay', msg.args[0]) - if 'type' in optlist: - type = optlist.get('type') - else: - type = 'default' - data = requests.get("https://easyapis.soue.tk/api/cowsay?text={0}&type={1}".format(text, type)) - self.stopped[msg.args[0]] = False - paste = '' - for line in data.text.splitlines(): - if self.registryValue('pasteEnable', msg.args[0]): - paste += line + "\n" - if not line.strip() and not self.stopped[msg.args[0]]: - time.sleep(delay) - irc.reply('\xa0', prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - elif line.strip() and not self.stopped[msg.args[0]] and "Follow @igor_chubin" not in line: - time.sleep(delay) - irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - if self.registryValue('pasteEnable', msg.args[0]): - irc.reply(self.doPaste(text, paste), private=False, notice=False, to=channel) - cow = wrap(cow, [optional('channel'), getopts({'delay':'float', 'type':'text'}), ('text')]) - - def fortune(self, irc, msg, args, channel, optlist): - """[] - Returns random art fortune from http://www.asciiartfarts.com/fortune.txt - """ - if not channel: - channel = msg.args[0] - if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): - irc.errorNoCapability('admin') - return - optlist = dict(optlist) - if 'delay' in optlist: - delay = optlist.get('delay') - else: - delay = self.registryValue('delay', msg.args[0]) - self.stopped[msg.args[0]] = False - data = requests.get("http://www.asciiartfarts.com/fortune.txt") - fortunes = data.text.split('%\n') - fortune = random.randrange(0, len(fortunes)) - for line in fortunes[fortune].splitlines(): - if not line.strip() and not self.stopped[msg.args[0]]: - time.sleep(delay) - irc.reply('\xa0', prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - elif line.strip() and not self.stopped[msg.args[0]] and "Follow @igor_chubin" not in line: - time.sleep(delay) - irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - fortune = wrap(fortune, [optional('channel'), getopts({'delay':'float'})]) - - def mircart(self, irc, msg, args, channel, optlist, search): - """[] (search text) - Search https://mircart.org/ and scroll first result - """ - if not channel: - channel = msg.args[0] - if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): - irc.errorNoCapability('admin') - return - optlist = dict(optlist) - if 'delay' in optlist: - delay = optlist.get('delay') - else: - delay = self.registryValue('delay', msg.args[0]) - self.stopped[msg.args[0]] = False - ua = UserAgent() - header = {'User-Agent':str(ua.random)} - data = requests.get("https://mircart.org/?s={0}".format(search), headers=header) - soup = BeautifulSoup(data.text) - url = soup.find(href=re.compile(".txt")) - data = requests.get(url.get('href'), headers=header) - output = data.content.decode() - for line in output.splitlines(): - if not line.strip() and not self.stopped[msg.args[0]]: - time.sleep(delay) - irc.reply('\xa0', prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - elif line.strip() and not self.stopped[msg.args[0]] and "Follow @igor_chubin" not in line: - time.sleep(delay) - irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) - irc.reply(url.get('href')) - mircart = wrap(mircart, [optional('channel'), getopts({'delay':'float'}), ('text')]) - - def cq(self, irc, msg, args): - """ - Stop the scroll. - """ - if not self.stopped[msg.args[0]]: - irc.reply("Stopping.") - self.stopped[msg.args[0]] = True - cq = wrap(cq) - - def codes(self, irc, msg, args): - """ - Show a grid of IRC color codes. - """ - irc.reply("\x031,0000\x031,0101\x031,0202\x031,0303\x031,0404\x031,0505\x031,0606\x031,0707\x031,0808\x031,0909\x031,1010\x031,1111\x031,1212\x031,1313\x031,1414\x031,1515", prefixNick=False) - irc.reply("\x031,1616\x031,1717\x031,1818\x031,1919\x031,2020\x031,2121\x031,2222\x031,2323\x031,2424\x031,2525\x031,2626\x031,2727", prefixNick=False) - irc.reply("\x031,2828\x031,2929\x031,3030\x031,3131\x031,3232\x031,3333\x031,3434\x031,3535\x031,3636\x031,3737\x031,3838\x031,3939", prefixNick=False) - irc.reply("\x031,4040\x031,4141\x031,4242\x031,4343\x031,4444\x031,4545\x031,4646\x031,4747\x031,4848\x031,4949\x031,5050\x031,5151", prefixNick=False) - irc.reply("\x031,5252\x031,5353\x031,5454\x031,5555\x031,5656\x031,5757\x031,5858\x031,5959\x031,6060\x031,6161\x031,6262\x031,6363", prefixNick=False) - irc.reply("\x031,6464\x031,6565\x031,6666\x031,6767\x031,6868\x031,6969\x031,7070\x031,7171\x031,7272\x031,7373\x031,7474\x031,7575", prefixNick=False) - irc.reply("\x031,7676\x031,7777\x031,7878\x031,7979\x031,8080\x031,8181\x031,8282\x031,8383\x031,8484\x031,8585\x031,8686\x031,8787", prefixNick=False) - irc.reply("\x031,8888\x031,8989\x031,9090\x031,9191\x031,9292\x031,9393\x031,9494\x031,9595\x031,9696\x031,9797\x031,9898\x031,9999", prefixNick=False) - codes = wrap(codes) - -Class = TextArt +### +# Copyright (c) 2020, oddluck +# 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.ansi as ansi +import supybot.utils as utils +from supybot.commands import * +import supybot.plugins as plugins +import supybot.ircutils as ircutils +import supybot.ircdb as ircdb +import supybot.callbacks as callbacks +import supybot.ircmsgs as ircmsgs +import os +import requests +from PIL import Image, ImageOps, ImageFont, ImageDraw, ImageEnhance +import numpy as np +import sys, math +from fake_useragent import UserAgent +import re +import pexpect +import time +import random as random +import pyimgur +from bs4 import BeautifulSoup + +try: + from supybot.i18n import PluginInternationalization + _ = PluginInternationalization('TextArt') +except ImportError: + # Placeholder that allows to run the plugin on a bot + # without the i18n module + _ = lambda x: x + +class TextArt(callbacks.Plugin): + """TextArt: Make Text Art""" + threaded = True + + def __init__(self, irc): + self.__parent = super(TextArt, self) + self.__parent.__init__(irc) + self.colors = 99 + self.stopped = {} + self.old_color = None + self.source_colors = 0 + self.rgbColors = [ + (255,255,255), + (0,0,0), + (0,0,127), + (0,147,0), + (255,0,0), + (127,0,0), + (156,0,156), + (252,127,0), + (255,255,0), + (0,252,0), + (0,147,147), + (0,255,255), + (0,0,252), + (255,0,255), + (127,127,127), + (210,210,210), + (71,0,0), + (71,33,0), + (71,71,0), + (50,71,0), + (0,71,0), + (0,71,44), + (0,71,71), + (0,39,71), + (0,0,71), + (46,0,71), + (71,0,71), + (71,0,42), + (116,0,0), + (116,58,0), + (116,116,0), + (81,116,0), + (0,116,0), + (0,116,73), + (0,116,116), + (0,64,116), + (0,0,116), + (75,0,116), + (116,0,116), + (116,0,69), + (181,0,0), + (181,99,0), + (181,181,0), + (125,181,0), + (0,181,0), + (0,181,113), + (0,181,181), + (0,99,181), + (0,0,181), + (117,0,181), + (181,0,181), + (181,0,107), + (255,0,0), + (255,140,0), + (255,255,0), + (178,255,0), + (0,255,0), + (0,255,160), + (0,255,255), + (0,140,255), + (0,0,255), + (165,0,255), + (255,0,255), + (255,0,152), + (255,89,89), + (255,180,89), + (255,255,113), + (207,255,96), + (111,255,111), + (101,255,201), + (109,255,255), + (89,180,255), + (89,89,255), + (196,89,255), + (255,102,255), + (255,89,188), + (255,156,156), + (255,211,156), + (255,255,156), + (226,255,156), + (156,255,156), + (156,255,219), + (156,255,255), + (156,211,255), + (156,156,255), + (220,156,255), + (255,156,255), + (255,148,211), + (0,0,0), + (19,19,19), + (40,40,40), + (54,54,54), + (77,77,77), + (101,101,101), + (129,129,129), + (159,159,159), + (188,188,188), + (226,226,226), + (255,255,255)] + self.colors83= { + (11.5497, 31.8768, 18.1739):16, + (17.5866, 15.7066, 25.9892):17, + (29.0208, -8.5776, 37.5533):18, + (27.2543, -19.015, 35.3673):19, + (25.2798, -34.2963, 32.8426):20, + (25.8276, -27.5812, 10.7515):21, + (26.6245, -19.1316, -5.6261):22, + (14.986, 1.2467, -23.6473):23, + (4.1091, 27.6851, -41.3905):24, + (9.2862, 34.8709, -32.6869):25, + (14.3696, 39.0991, -24.2113):26, + (12.6512, 34.8073, -6.066):27, + (22.699, 44.779, 34.3145):28, + (31.2054, 21.9979, 41.7676):29, + (47.2407, -12.0488, 52.8125):30, + (44.5753, -27.9355, 49.6338):31, + (41.9858, -48.1745, 46.4957):32, + (42.7207, -39.1444, 16.0528):33, + (43.8747, -26.8746, -7.9028):34, + (26.5278, 3.8603, -34.8152):35, + (11.0, 44.2673, -60.2918):36, + (19.0423, 48.637, -46.7161):37, + (26.6606, 54.9202, -34.0091):38, + (24.1377, 48.6121, -6.8774):39, + (37.5243, 61.9327, 51.9413):40, + (50.3904, 27.7338, 58.553):41, + (71.4677, -16.6651, 73.0447):42, + (67.5818, -39.987, 68.408):43, + (64.1995, -66.6294, 64.3075):44, + (65.1526, -54.8772, 23.9922):45, + (66.8122, -37.1703, -10.9303):46, + (41.6262, 7.9137, -50.0682):47, + (21.343, 61.2273, -83.3898):48, + (32.0743, 66.9878, -65.2716):49, + (43.0033, 75.9603, -47.0378):50, + (39.3866, 66.9043, -7.4929):51, + (53.2329, 80.1093, 67.2201):52, + (69.4811, 36.8308, 75.4949):53, + (97.1382, -21.5559, 94.4825):54, + (92.125, -51.6335, 88.501):55, + (87.737, -86.1846, 83.1812):56, + (88.9499, -71.2147, 31.6061):57, + (91.1165, -48.0796, -14.1381):58, + (58.0145, 11.3842, -65.6058):59, + (32.3026, 79.1967, -107.8637):60, + (45.9331, 86.4699, -84.8483):61, + (60.3199, 98.2542, -60.843):62, + (55.6111, 86.4597, -9.1916):63, + (60.8927, 62.8729, 35.0702):64, + (78.8241, 18.6736, 56.0796):65, + (97.6208, -17.6977, 66.4162):66, + (94.1539, -37.4631, 68.7023):67, + (89.8813, -66.1541, 56.3842):68, + (91.0093, -53.1765, 13.8066):69, + (92.571, -38.7824, -11.8131):70, + (70.8615, -4.4808, -45.0866):71, + (47.6091, 49.3215, -82.3961):72, + (58.1323, 68.3853, -64.8302):73, + (68.0079, 76.2368, -48.6298):74, + (63.3723, 71.7112, -18.3923):75, + (74.4686, 36.8822, 15.7988):76, + (87.1187, 8.2035, 33.0227):77, + (98.1056, -13.9188, 47.2642):78, + (96.0337, -24.7493, 44.2003):79, + (92.1264, -48.2196, 38.3812):80, + (93.3211, -36.9827, 8.0947):81, + (94.2302, -28.9926, -9.1665):82, + (82.3123, -6.9657, -27.1167):83, + (68.0684, 23.3938, -49.2364):84, + (73.6833, 41.0464, -40.0349):85, + (77.4342, 51.3197, -33.9217):86, + (74.2811, 48.1595, -14.7725):87, + (0.0, 0.0, 0.0):88, + (5.8822, 0.0022, -0.0022):89, + (16.1144, 0.0022, -0.0033):90, + (22.6151, 0.0018, -0.004):91, + (32.7476, 0.0018, -0.0044):92, + (42.7837, 0.0032, -0.0055):93, + (53.9767, 0.0034, -0.0063):94, + (65.4912, 0.0036, -0.0074):95, + (76.2461, 0.0044, -0.0083):96, + (89.8837, 0.0048, -0.0094):97, + (100.0, 0.0053, -0.0104):98} + self.colors16 = { + (100.0, 0.0053, -0.0104):0, + (0.0, 0.0, 0.0):1, + (12.8119, 47.2407, -64.3396):2, + (52.8041, -57.1624, 55.1703):3, + (53.2329, 80.1093, 67.2201):4, + (25.2966, 47.7847, 37.7562):5, + (36.8705, 68.0659, -42.1489):6, + (66.4237, 42.1616, 73.4335):7, + (97.1382, -21.5559, 94.4825):8, + (86.8105, -85.4149, 82.4382):9, + (55.0455, -31.8888, -9.3772):10, + (91.1165, -48.0796, -14.1381):11, + (31.8712, 78.4892, -106.9003):12, + (60.3199, 98.2542, -60.843):13, + (53.1928, 0.0029, -0.0061):14, + (84.1985, 0.0045, -0.0089):15} + self.colors99= { + (100.0, 0.0053, -0.0104):0, + (0.0, 0.0, 0.0):1, + (12.8119, 47.2407, -64.3396):2, + (52.8041, -57.1624, 55.1703):3, + (53.2329, 80.1093, 67.2201):4, + (25.2966, 47.7847, 37.7562):5, + (36.8705, 68.0659, -42.1489):6, + (66.4237, 42.1616, 73.4335):7, + (97.1382, -21.5559, 94.4825):8, + (86.8105, -85.4149, 82.4382):9, + (55.0455, -31.8888, -9.3772):10, + (91.1165, -48.0796, -14.1381):11, + (31.8712, 78.4892, -106.9003):12, + (60.3199, 98.2542, -60.843):13, + (53.1928, 0.0029, -0.0061):14, + (84.1985, 0.0045, -0.0089):15, + (11.5497, 31.8768, 18.1739):16, + (17.5866, 15.7066, 25.9892):17, + (29.0208, -8.5776, 37.5533):18, + (27.2543, -19.015, 35.3673):19, + (25.2798, -34.2963, 32.8426):20, + (25.8276, -27.5812, 10.7515):21, + (26.6245, -19.1316, -5.6261):22, + (14.986, 1.2467, -23.6473):23, + (4.1091, 27.6851, -41.3905):24, + (9.2862, 34.8709, -32.6869):25, + (14.3696, 39.0991, -24.2113):26, + (12.6512, 34.8073, -6.066):27, + (22.699, 44.779, 34.3145):28, + (31.2054, 21.9979, 41.7676):29, + (47.2407, -12.0488, 52.8125):30, + (44.5753, -27.9355, 49.6338):31, + (41.9858, -48.1745, 46.4957):32, + (42.7207, -39.1444, 16.0528):33, + (43.8747, -26.8746, -7.9028):34, + (26.5278, 3.8603, -34.8152):35, + (11.0, 44.2673, -60.2918):36, + (19.0423, 48.637, -46.7161):37, + (26.6606, 54.9202, -34.0091):38, + (24.1377, 48.6121, -6.8774):39, + (37.5243, 61.9327, 51.9413):40, + (50.3904, 27.7338, 58.553):41, + (71.4677, -16.6651, 73.0447):42, + (67.5818, -39.987, 68.408):43, + (64.1995, -66.6294, 64.3075):44, + (65.1526, -54.8772, 23.9922):45, + (66.8122, -37.1703, -10.9303):46, + (41.6262, 7.9137, -50.0682):47, + (21.343, 61.2273, -83.3898):48, + (32.0743, 66.9878, -65.2716):49, + (43.0033, 75.9603, -47.0378):50, + (39.3866, 66.9043, -7.4929):51, + (69.4811, 36.8308, 75.4949):53, + (92.125, -51.6335, 88.501):55, + (87.737, -86.1846, 83.1812):56, + (88.9499, -71.2147, 31.6061):57, + (58.0145, 11.3842, -65.6058):59, + (32.3026, 79.1967, -107.8637):60, + (45.9331, 86.4699, -84.8483):61, + (55.6111, 86.4597, -9.1916):63, + (60.8927, 62.8729, 35.0702):64, + (78.8241, 18.6736, 56.0796):65, + (97.6208, -17.6977, 66.4162):66, + (94.1539, -37.4631, 68.7023):67, + (89.8813, -66.1541, 56.3842):68, + (91.0093, -53.1765, 13.8066):69, + (92.571, -38.7824, -11.8131):70, + (70.8615, -4.4808, -45.0866):71, + (47.6091, 49.3215, -82.3961):72, + (58.1323, 68.3853, -64.8302):73, + (68.0079, 76.2368, -48.6298):74, + (63.3723, 71.7112, -18.3923):75, + (74.4686, 36.8822, 15.7988):76, + (87.1187, 8.2035, 33.0227):77, + (98.1056, -13.9188, 47.2642):78, + (96.0337, -24.7493, 44.2003):79, + (92.1264, -48.2196, 38.3812):80, + (93.3211, -36.9827, 8.0947):81, + (94.2302, -28.9926, -9.1665):82, + (82.3123, -6.9657, -27.1167):83, + (68.0684, 23.3938, -49.2364):84, + (73.6833, 41.0464, -40.0349):85, + (77.4342, 51.3197, -33.9217):86, + (74.2811, 48.1595, -14.7725):87, + (5.8822, 0.0022, -0.0022):89, + (16.1144, 0.0022, -0.0033):90, + (22.6151, 0.0018, -0.004):91, + (32.7476, 0.0018, -0.0044):92, + (42.7837, 0.0032, -0.0055):93, + (53.9767, 0.0034, -0.0063):94, + (65.4912, 0.0036, -0.0074):95, + (76.2461, 0.0044, -0.0083):96, + (89.8837, 0.0048, -0.0094):97} + self.x256colors99 = ['01','05','32','30','02','38','34','96','94','04','56','08','60','13','11','00','01','36','02','48','48','60','32','34','47','47','47','72','03','33','10','59','59','59','44','45','45','46','71','71','09','68','45','69','46','83','56','68','57','57','69','11','28','38','37','49','49','60','30','93','47','72','72','72','31','33','10','59','59','59','43','45','45','46','71','71','09','68','57','69','70','83','56','68','68','57','69','70','05','39','38','49','49','61','41','93','50','50','72','72','30','30','94','84','84','84','43','43','45','46','71','71','43','68','80','81','82','83','55','68','68','80','81','70','40','51','06','50','50','61','41','64','63','50','73','73','30','41','76','87','85','84','42','42','95','96','84','84','55','67','79','81','82','83','55','67','80','80','81','82','40','51','51','50','50','73','41','64','63','75','13','73','53','07','76','87','85','85','42','65','77','76','87','85','42','66','78','78','15','97','55','67','79','79','81','82','04','64','63','63','13','13','07','64','63','75','75','74','53','64','76','87','87','86','65','65','65','76','87','86','08','77','77','77','97','86','08','66','66','78','78','00','01','89','89','90','91','91','92','92','92','93','93','14','94','94','95','95','95','96','96','96','15','97','97','97'] + self.x256colors16 = ['01','05','03','03','02','06','10','15','14','04','09','08','12','13','11','00','01','02','02','02','12','12','03','10','12','12','12','12','03','10','10','10','14','14','03','03','10','10','10','10','09','09','09','11','11','11','09','09','09','09','11','11','05','06','02','12','12','12','03','14','14','12','12','12','03','03','10','14','14','14','03','03','10','10','10','15','09','09','09','11','11','11','09','09','09','09','11','11','05','06','06','06','06','12','14','14','06','06','06','13','03','14','14','14','14','13','03','03','03','11','11','11','09','09','09','11','11','11','09','09','09','09','11','11','05','06','06','06','06','06','07','04','06','13','13','13','07','07','14','14','13','13','08','08','15','15','15','15','08','09','09','15','15','15','09','09','09','09','11','11','04','06','06','06','13','13','07','04','13','13','13','13','07','07','04','13','13','13','08','07','07','15','15','13','08','08','08','15','15','15','08','08','08','09','00','00','04','04','13','13','13','13','07','04','13','13','13','13','07','07','04','13','13','13','07','07','07','15','15','13','08','08','08','15','15','15','08','08','08','08','00','00','01','01','01','01','01','01','01','14','14','14','14','14','14','14','14','14','15','15','15','15','15','15','15','00'] + self.x256colors83 = ['88','28','32','30','36','38','34','96','94','52','56','54','60','62','58','98','88','36','36','48','48','60','32','34','47','47','47','72','32','33','34','59','59','59','44','45','45','46','71','71','44','68','45','69','46','83','56','68','57','57','69','58','28','38','37','49','49','60','30','93','47','72','72','72','31','33','34','59','59','59','43','45','45','46','71','71','56','68','57','69','70','83','56','68','68','57','69','70','28','39','38','49','49','61','41','93','50','50','72','72','30','30','94','84','84','84','43','43','45','46','71','71','43','68','80','81','82','83','55','68','68','80','81','70','40','51','51','50','50','61','41','64','63','50','73','73','30','41','76','87','85','84','42','42','95','96','84','84','55','67','79','81','82','83','55','67','80','80','81','82','40','51','51','50','50','73','41','64','63','75','62','73','53','53','76','87','85','85','42','65','77','76','87','85','42','66','78','78','97','97','55','67','79','79','81','82','52','64','63','63','62','62','52','64','63','75','75','74','53','64','76','87','87','86','65','65','65','76','87','86','54','77','77','77','97','86','54','66','66','78','78','98','88','89','89','90','91','91','92','92','92','93','93','94','94','94','95','95','95','96','96','96','97','97','97','97'] + self.x16colors = { + '30':'01', + '31':'05', + '32':'03', + '33':'07', + '34':'02', + '35':'06', + '36':'10', + '37':'15', + '30;1':'14', + '31;1':'04', + '32;1':'09', + '33;1':'08', + '34;1':'12', + '35;1':'13', + '36;1':'11', + '37;1':'00', + '40':'01', + '41':'05', + '42':'03', + '43':'07', + '44':'02', + '45':'06', + '46':'10', + '47':'15', + '40;1':'14', + '41;1':'04', + '42;1':'09', + '43;1':'08', + '44;1':'12', + '45;1':'13', + '46;1':'11', + '47;1':'00'} + + def doPrivmsg(self, irc, msg): + channel = msg.args[0] + self.stopped.setdefault(channel, None) + if msg.args[1].lower().strip()[1:] == 'cq': + self.stopped[channel] = True + + def doPaste(self, description, paste): + try: + description = description.split('/')[-1] + apikey = self.registryValue('pasteAPI') + payload = {'description':description,'sections':[{'contents':paste}]} + headers = {'X-Auth-Token':apikey} + post_response = requests.post(url='https://api.paste.ee/v1/pastes', json=payload, headers=headers) + response = post_response.json() + return response['link'].replace('/p/', '/r/') + except: + return "Error. Did you set a valid Paste.ee API Key? https://paste.ee/account/api" + + def renderImage(self, text, size=18, defaultBg = 1, defaultFg = 0): + try: + if utf8 and not isinstance(text, unicode): + text = text.decode('utf-8') + except: + pass + text = text.replace('\t', ' ') + self.strip_colors_regex = re.compile('(\x03([0-9]{1,2})(,[0-9]{1,2})?)|[\x0f\x02\x1f\x03\x16]').sub + path = os.path.dirname(os.path.abspath(__file__)) + defaultFont = "{0}/DejaVu.ttf".format(path) + def strip_colors(string): + return self.strip_colors_regex('', string) + _colorRegex = re.compile('(([0-9]{1,2})(,([0-9]{1,2}))?)') + IGNORE_CHRS = ('\x16','\x1f','\x02', '\x03', '\x0f') + lineLens = [len(line) for line in strip_colors(text).splitlines()] + maxWidth, height = max(lineLens), len(lineLens) + font = ImageFont.truetype(defaultFont, size) + fontX = 10 + fontY = 20 + imageX, imageY = maxWidth * fontX, height * fontY + image = Image.new('RGB', (imageX, imageY), self.rgbColors[defaultBg]) + draw = ImageDraw.Draw(image) + dtext, drect, match, x, y, fg, bg = draw.text, draw.rectangle, _colorRegex.match, 0, 0, defaultFg, defaultBg + start = time.time() + for text in text.split('\n'): + ll, i = len(text), 0 + while i < ll: + chr = text[i] + if chr == "\x03": + m = match(text[i+1:i+6]) + if m: + i+= len(m.group(1)) + fg = int(m.group(2)) + if m.group(4) is not None: + bg = int(m.group(4)) + else: + bg, fg = defaultBg, defaultFg + elif chr == "\x0f": + fg, bg = defaultFg, defaultBg + elif chr not in IGNORE_CHRS: + if bg != defaultBg: # bg is not white, render it + drect((x, y, x+fontX, y+fontY), fill=self.rgbColors[bg]) + if bg != fg: # text will show, render it. this saves a lot of time! + dtext((x, y), chr, font=font, fill=self.rgbColors[fg]) + x += fontX + i += 1 + y += fontY + fg, bg, x = defaultFg, defaultBg, 0 + return image, imageX, imageY + + def getColor(self, pixel, speed): + pixel = tuple(pixel) + try: + return self.matches[pixel] + except KeyError: + if self.colors == 16: + colors = list(self.colors16.keys()) + elif self.colors == 99: + colors = list(self.colors99.keys()) + else: + colors = list(self.colors83.keys()) + closest_colors = sorted(colors, key=lambda color: self.distance(color, self.rgb2lab(pixel), speed)) + closest_color = closest_colors[0] + if self.colors == 16: + self.matches[pixel] = self.colors16[closest_color] + elif self.colors == 99: + self.matches[pixel] = self.colors99[closest_color] + else: + self.matches[pixel] = self.colors83[closest_color] + self.source_colors += 1 + return self.matches[pixel] + + def rgb2lab (self, inputColor) : + try: + return self.labmatches[inputColor] + except: + num = 0 + RGB = [0, 0, 0] + for value in inputColor : + value = float(value) / 255 + if value > 0.04045 : + value = ( ( value + 0.055 ) / 1.055 ) ** 2.4 + else : + value = value / 12.92 + RGB[num] = value * 100 + num = num + 1 + XYZ = [0, 0, 0,] + X = RGB [0] * 0.4124 + RGB [1] * 0.3576 + RGB [2] * 0.1805 + Y = RGB [0] * 0.2126 + RGB [1] * 0.7152 + RGB [2] * 0.0722 + Z = RGB [0] * 0.0193 + RGB [1] * 0.1192 + RGB [2] * 0.9505 + XYZ[ 0 ] = round( X, 4 ) + XYZ[ 1 ] = round( Y, 4 ) + XYZ[ 2 ] = round( Z, 4 ) + XYZ[ 0 ] = float( XYZ[ 0 ] ) / 95.047 # ref_X = 95.047 Observer= 2°, Illuminant= D65 + XYZ[ 1 ] = float( XYZ[ 1 ] ) / 100.0 # ref_Y = 100.000 + XYZ[ 2 ] = float( XYZ[ 2 ] ) / 108.883 # ref_Z = 108.883 + num = 0 + for value in XYZ : + if value > 0.008856 : + value = value ** ( 0.3333333333333333 ) + else : + value = ( 7.787 * value ) + ( 16 / 116 ) + XYZ[num] = value + num = num + 1 + Lab = [0, 0, 0] + L = ( 116 * XYZ[ 1 ] ) - 16 + a = 500 * ( XYZ[ 0 ] - XYZ[ 1 ] ) + b = 200 * ( XYZ[ 1 ] - XYZ[ 2 ] ) + Lab [ 0 ] = round( L, 4 ) + Lab [ 1 ] = round( a, 4 ) + Lab [ 2 ] = round( b, 4 ) + self.labmatches[inputColor] = Lab + return self.labmatches[inputColor] + + def ciede2000(self, lab1, lab2): + """ CIEDE2000 color difference formula. https://peteroupc.github.io/colorgen.html""" + dl=lab2[0]-lab1[0] + hl=lab1[0]+dl*0.5 + sqb1=lab1[2]*lab1[2] + sqb2=lab2[2]*lab2[2] + c1=math.sqrt(lab1[1]*lab1[1]+sqb1) + c2=math.sqrt(lab2[1]*lab2[1]+sqb2) + hc7=math.pow((c1+c2)*0.5,7) + trc=math.sqrt(hc7/(hc7+6103515625)) + t2=1.5-trc*0.5 + ap1=lab1[1]*t2 + ap2=lab2[1]*t2 + c1=math.sqrt(ap1*ap1+sqb1) + c2=math.sqrt(ap2*ap2+sqb2) + dc=c2-c1 + hc=c1+dc*0.5 + hc7=math.pow(hc,7) + trc=math.sqrt(hc7/(hc7+6103515625)) + h1=math.atan2(lab1[2],ap1) + if h1<0: + h1=h1+math.pi*2 + h2=math.atan2(lab2[2],ap2) + if h2<0: + h2=h2+math.pi*2 + hdiff=h2-h1 + hh=h1+h2 + if abs(hdiff)>math.pi: + hh=hh+math.pi*2 + if h2<=h1: + hdiff=hdiff+math.pi*2 + else: + hdiff=hdiff-math.pi*2 + hh=hh*0.5 + t2=1-0.17*math.cos(hh-math.pi/6)+0.24*math.cos(hh*2) + t2=t2+0.32*math.cos(hh*3+math.pi/30) + t2=t2-0.2*math.cos(hh*4-math.pi*63/180) + dh=2*math.sqrt(c1*c2)*math.sin(hdiff*0.5) + sqhl=(hl-50)*(hl-50) + fl=dl/(1+(0.015*sqhl/math.sqrt(20+sqhl))) + fc=dc/(hc*0.045+1) + fh=dh/(t2*hc*0.015+1) + dt=30*math.exp(-math.pow(36*hh-55*math.pi,2)/(25*math.pi*math.pi)) + r=-2*trc*math.sin(2*dt*math.pi/180) + return math.sqrt(fl*fl+fc*fc+fh*fh+r*fc*fh) + + def distance(self, c1, c2, speed): + if speed == 'fast': + delta_e = math.sqrt((c1[0] - c2[0]) **2 + (c1[1] - c2[1]) ** 2 + (c1[2] - c2[2]) **2) + elif speed == 'slow': + delta_e = self.ciede2000(c1, c2) + return delta_e + + def process_ansi(self, ansi): + if self.colors == 16: + colors = self.x256colors16 + elif self.colors == 99: + colors = self.x256colors99 + else: + colors = self.x256colors83 + x16color1 = None + x16color2 = None + x256color1 = None + x256color2 = None + effect = None + ansi = ansi.lower().strip('\x1b[').strip('m').split(';') + if len(ansi) > 1: + i = 0 + while i < len(ansi): + if i >= len(ansi): + break + elif ansi[i]== '0': + effect = 0 + i += 1 + continue + elif ansi[i] == '1': + effect = 1 + i += 1 + continue + elif ansi[i] == '4': + effect = 4 + i += 1 + continue + elif ansi[i] == '2': + effect = 2 + i += 1 + continue + elif int(ansi[i]) > 29 and int(ansi[i]) < 38: + if effect == 1 or ansi[-1] == '1': + x16color1 = self.x16colors['{0};1'.format(ansi[i])] + effect = None + i += 1 + continue + else: + x16color1 = self.x16colors[ansi[i]] + i += 1 + continue + elif int(ansi[i]) > 39 and int(ansi[i]) < 48: + if effect == 1 or ansi[-1] == '1': + x16color2 = self.x16colors['{0};1'.format(ansi[i])] + effect = None + i += 1 + continue + else: + x16color2 = self.x16colors[ansi[i]] + i += 1 + continue + elif ansi[i] == '38': + x256color1 = colors[int(ansi[i+2])] + i += 3 + continue + elif ansi[i] == '48': + x256color2 = colors[int(ansi[i+2])] + i += 3 + continue + else: + i += 1 + continue + if x16color1 and x16color2: + color = '\x03{0},{1}'.format(x16color1, x16color2) + elif x256color1 and x256color2: + color = '\x03{0},{1}'.format(x256color1, x256color2) + elif x16color1: + color = '\x03{0}'.format(x16color1) + elif x16color2: + color = '\x0399,{0}'.format(x16color2) + elif x256color1: + color = '\x03{0}'.format(x256color1) + elif x256color2: + color = '\x0399,{0}'.format(x256color2) + else: + color = '' + if effect == 1: + color += '\x02' + if effect == 4: + color += '\x1F' + elif len(ansi[0]) > 0: + if ansi[0] == '0': + color = '\x0F' + elif ansi[0] == '1' or ansi[0] == '2': + color = '\x02' + elif ansi[0] == '4': + color = '\x1F' + elif int(ansi[0]) > 29 and int(ansi[0]) < 38: + color = '\x03{0}'.format(self.x16colors[ansi[0]]) + elif int(ansi[0]) > 39 and int(ansi[0]) < 48: + color = '\x0399,{0}'.format(self.x16colors[ansi[0]]) + elif ansi[0][-1] == 'c': + color = ' ' * int(ansi[0][:-1]) + else: + color = '' + else: + color = '' + if color != self.old_color: + self.old_color = color + return color + else: + return '' + + def ansi2irc(self, output): + output = output.replace('\x1b(B\x1b[m', '\x1b[0m') + output = output.replace('\x1b\x1b', '\x1b') + output = re.sub(r'\x1B\[[0-?]*[ -/]*[@-~]', lambda m: self.process_ansi(m.group(0)), output) + output = re.sub('\x0399,(\d\d)\x03(\d\d)', '\x03\g<2>,\g<1>', output) + output = output.replace('\x0F\x03', '\x03') + return output + + def png(self, irc, msg, args, optlist, url): + """[--bg] [--fg] + Generate PNG from text file + """ + optlist = dict(optlist) + if 'bg' in optlist: + bg = optlist.get('bg') + else: + bg = 1 + if 'fg' in optlist: + fg = optlist.get('fg') + else: + fg = 0 + if url.startswith("https://paste.ee/p/"): + url = re.sub("https://paste.ee/p/", "https://paste.ee/r/", url) + ua = UserAgent() + header = {'User-Agent':str(ua.random)} + r = requests.head(url, headers=header) + if "text/plain" in r.headers["content-type"] or url.startswith('https://paste.ee/r/'): + file = requests.get(url, headers=header) + else: + irc.reply("Invalid file type.", private=False, notice=False) + return + try: + file = file.content.decode() + except: + file = file.content.decode('cp437') + file = re.sub('(\x03(\d+).*)\x03,', '\g<1>\x03\g<2>,', file).replace('\r\n','\n') + im, x, y = self.renderImage(file, 18, bg, fg) + path = os.path.dirname(os.path.abspath(__file__)) + filepath = "{0}/tmp/tldr.png".format(path) + im.save(filepath, "PNG") + CLIENT_ID = self.registryValue('imgurAPI') + imgur = pyimgur.Imgur(CLIENT_ID) + uploaded_image = imgur.upload_image(filepath, title=url) + irc.reply(uploaded_image.link, noLengthCheck=True, private=False, notice=False) + png = wrap(png, [getopts({'bg':'int', 'fg':'int'}), ('text')]) + + def artii(self, irc, msg, args, channel, optlist, text): + """[] [--font ] [--color ] [] + Text to ASCII figlet fonts using the artii API + """ + if not channel: + channel = msg.args[0] + channel = msg.args[0] + optlist = dict(optlist) + font = None + words = [] + if text: + text = text.strip() + if '|' in text: + words = text.split('|') + if 'color' in optlist: + color = optlist.get('color') + if "," in color: + color = color.split(",") + color1 = color[0].strip() + color2 = color[1].strip() + else: + color1 = color + color2 = None + else: + color1 = None + color2 = None + if 'font' in optlist: + font = optlist.get('font') + if words: + for word in words: + if word.strip(): + data = requests.get("https://artii.herokuapp.com/make?text={0}&font={1}".format(word.strip(), font)) + for line in data.text.splitlines(): + if line.strip(): + irc.reply(ircutils.mircColor(line, color1, color2), prefixNick=False, private=False, notice=False) + else: + data = requests.get("https://artii.herokuapp.com/make?text={0}&font={1}".format(text, font)) + for line in data.text.splitlines(): + if line.strip(): + irc.reply(ircutils.mircColor(line, color1, color2), prefixNick=False, private=False, notice=False, to=channel) + elif 'font' not in optlist: + if words: + for word in words: + if word.strip(): + data = requests.get("https://artii.herokuapp.com/make?text={0}&font=univers".format(word.strip())) + for line in data.text.splitlines(): + if line.strip(): + irc.reply(ircutils.mircColor(line, color1, color2), prefixNick=False, private=False, notice=False, to=channel) + else: + data = requests.get("https://artii.herokuapp.com/make?text={0}&font=univers".format(text)) + for line in data.text.splitlines(): + if line.strip(): + irc.reply(ircutils.mircColor(line, color1, color2), prefixNick=False, private=False, notice=False, to=channel) + + artii = wrap(artii, [optional('channel'), getopts({'font':'text', 'color':'text'}), ('text')]) + + def fontlist(self, irc, msg, args): + """ + Get list of artii figlet fonts. + """ + fontlist = requests.get("https://artii.herokuapp.com/fonts_list") + response = sorted(fontlist.text.split('\n')) + irc.reply(str(response).replace('\'', '').replace('[', '').replace(']', '')) + fontlist = wrap(fontlist) + + def img(self, irc, msg, args, channel, optlist, url): + """[<#channel>] [--delay #.#] [--w <###>] [--s <#.#] [--16] [--99] [--83] [--ascii] [--block] [--1/2] [--chars ] [--ramp ] [--bg <0-98>] [--fg <0-98>] [--no-color] [--invert] + Image to IRC art. + --w columns. + --s saturation (1.0). + --16 colors 0-15. + --99 colors 0-98. + --83 colors 16-98. + --ascii color ascii. + --block space block. + --1/2 for 1/2 block + --chars color text. + --ramp set ramp (".:-=+*#%@"). + --bg <0-98> set bg. + --fg <0-99> set fg. + --no-color greyscale ascii. + --invert inverts ramp. + """ + if not channel: + channel = msg.args[0] + if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): + irc.errorNoCapability('admin') + return + optlist = dict(optlist) + gscale = "\xa0" + if '16' in optlist: + self.colors = 16 + elif '83' in optlist: + self.colors = 83 + elif '99' in optlist: + self.colors = 99 + else: + self.colors = self.registryValue('colors', msg.args[0]) + if 'fast' in optlist: + speed = 'fast' + elif 'slow' in optlist: + speed = 'slow' + else: + speed = self.registryValue('speed', msg.args[0]).lower() + if 'delay' in optlist: + delay = optlist.get('delay') + else: + delay = self.registryValue('delay', msg.args[0]) + if 'quantize' in optlist: + quantize = True + elif 'no-quantize' in optlist: + quantize = False + else: + quantize = self.registryValue('quantize', msg.args[0]) + if 'bg' in optlist: + bg = optlist.get('bg') + else: + bg = self.registryValue('bg', msg.args[0]) + if 'fg' in optlist: + fg = optlist.get('fg') + else: + fg = self.registryValue('fg', msg.args[0]) + if 'chars' in optlist: + type = 'ascii' + gscale = optlist.get('chars') + elif 'ramp' in optlist: + type = 'ascii' + gscale = optlist.get('ramp') + elif 'ascii' in optlist and bg == 0 or bg == 98: + type = 'ascii' + gscale = "$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\|()1{}[]?-_+~<>i!lI;:\"^`'." + elif 'ascii' in optlist: + type = 'ascii' + gscale = ".'`^\":;Il!i><~+_-?][}{1)(|\/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$" + elif '1/2' in optlist: + type = '1/2' + elif 'block' in optlist: + type = 'ascii' + gscale = '\xa0' + else: + type = self.registryValue('imgDefault', msg.args[0]).lower() + if 'no-color' in optlist and 'ramp' not in optlist and bg == 0 or bg == 98: + type = 'no-color' + gscale = "@%#*+=-:. " + elif 'no-color' in optlist and 'ramp' not in optlist: + type = 'no-color' + gscale = " .:-=+*#%@" + elif 'no-color' in optlist and 'chars' not in optlist: + type = 'no-color' + if not gscale.strip(): + gscale = '\xa0' + if 'invert' in optlist and 'chars' not in optlist and gscale != '\xa0': + gscale = gscale[::-1] + if 'w' in optlist: + cols = optlist.get('w') + elif type == 'ascii' or type == 'no-color' or type == 'block': + cols = self.registryValue('asciiWidth', msg.args[0]) + else: + cols = self.registryValue('blockWidth', msg.args[0]) + if 's' in optlist: + s = float(optlist.get('s')) + path = os.path.dirname(os.path.abspath(__file__)) + filepath = "{0}/tmp".format(path) + filename = "{0}/{1}".format(filepath, url.split('/')[-1]) + ua = UserAgent() + header = {'User-Agent':str(ua.random)} + image_formats = ("image/png", "image/jpeg", "image/jpg", "image/gif") + r = requests.head(url, headers=header) + if r.headers["content-type"] in image_formats: + response = requests.get(url, headers=header) + else: + irc.reply("Invalid file type.", private=False, notice=False) + return + if response.status_code == 200: + with open("{0}".format(filename), 'wb') as f: + f.write(response.content) + # open image and convert to grayscale + start_time = time.time() + self.source_colors = 0 + image = Image.open(filename) + if image.mode == 'RGBA': + if bg == 99: + newbg = 1 + else: + newbg = bg + image = Image.alpha_composite(Image.new("RGBA", image.size, self.rgbColors[newbg] + (255,)), image) + if image.mode != 'RGB': + image = image.convert('RGB') + try: + os.remove(filename) + except: + pass + # store dimensions + W, H = image.size[0], image.size[1] + # compute width of tile + w = W/cols + # compute tile height based on aspect ratio and scale + if type == '1/2': + scale = 1.0 + else: + scale = 0.5 + h = w/scale + # compute number of rows + rows = int(H/h) + if 'resize' in optlist: + resize = optlist.get('resize') + else: + resize = self.registryValue('resize', msg.args[0]) + if type != 'no-color': + image2 = image.resize((cols, rows), resize) + if 's' in optlist: + image2 = ImageEnhance.Color(image2).enhance(s) + if quantize: + image2 = image2.quantize(dither=None) + image2 = image2.convert('RGB') + colormap = np.array(image2) + self.matches = {} + self.labmatches = {} + # ascii image is a list of character strings + aimg = [] + if type == '1/2': + k = 0 + for j in range(0, rows - 1, 2): + # append an empty string + aimg.append("") + old_color1 = "99" + old_color2 = "99" + old_char = None + for i in range(cols): + color1 = '%02d' % self.getColor(colormap[j][i].tolist(), speed) + color2 = '%02d' % self.getColor(colormap[j+1][i].tolist(), speed) + if color1 == color2: + gsval = " " + else: + gsval = "▀" + if color1 == old_color1 and color2 == old_color2: + aimg[k] += gsval + old_char = gsval + elif gsval == " " and color1 == old_color2: + aimg[k] += " " + old_char = gsval + elif gsval == " " and color1 == old_color1 and old_char == '█': + aimg[k] = aimg[k][:-1] + aimg[k] += "\x0301,{0} ".format(color1) + old_color1 = "01" + old_color2 = color1 + old_char = gsval + elif gsval == " " and color1 == old_color1 and old_char == '^█': + aimg[k] = aimg[k][:-4] + aimg[k] += "\x0301,{0} ".format(color1) + old_color1 = "01" + old_color2 = color1 + old_char = gsval + elif gsval == " " and color1 == old_color1 and old_char == "^^▀" and 'tops' not in optlist: + aimg[k] = aimg[k][:-7] + aimg[k] += "\x03{0},{1}▄ ".format(old_color2, color1) + old_color1 = old_color2 + old_color2 = color1 + old_char = gsval + elif gsval == " " and color1 == old_color1 and old_char != '█' and 'tops' not in optlist: + aimg[k] += "█" + old_char = '█' + elif gsval == " " and 'tops' not in optlist: + aimg[k] += "\x03{0}█".format(color1) + old_color1 = color1 + old_char = '^█' + elif gsval != " " and color1 == old_color1 and old_char == '^█' and 'tops' not in optlist: + aimg[k] = aimg[k][:-4] + aimg[k] += "\x03{0},{1} ▄".format(color2, color1) + old_color1 = color2 + old_color2 = color1 + old_char = '▄' + elif gsval != " " and color2 == old_color1 and old_char == '^█': + aimg[k] = aimg[k][:-4] + aimg[k] += "\x03{0},{1} ▀".format(color1, color2) + old_color1 = color1 + old_color2 = color2 + old_char = gsval + elif gsval != " " and color1 == old_color2 and color2 == old_color1 and old_char == "^^▀" and 'tops' not in optlist: + aimg[k] = aimg[k][:-7] + aimg[k] += "\x03{0},{1}▄▀".format(color1, color2) + old_color1 = color1 + old_color2 = color2 + old_char = gsval + elif gsval != " " and color1 == old_color1 and color2 != old_color2 and old_char == "^^▀" and 'tops' not in optlist: + aimg[k] = aimg[k][:-7] + aimg[k] += "\x03{0},{1}▄\x03{2}▄".format(old_color2, color1, color2) + old_color1 = color2 + old_color2 = color1 + old_char = '▄' + elif gsval != " " and color1 == old_color1 and color2 != old_color2 and old_char == "^▀" and 'tops' not in optlist: + aimg[k] = aimg[k][:-4] + aimg[k] += "\x03{0},{1}▄\x03{2}▄".format(old_color2, color1, color2) + old_color1 = color2 + old_color2 = color1 + old_char = '▄' + elif gsval != " " and color1 == old_color2 and color2 == old_color1 and 'tops' not in optlist: + aimg[k] += "▄" + old_char = '▄' + elif gsval != " " and color1 == old_color2 and 'tops' not in optlist: + aimg[k] += "\x03{0}▄".format(color2) + old_color1 = color2 + old_char = '▄' + elif color1 != old_color1 and color2 == old_color2: + aimg[k] += "\x03{0}{1}".format(color1, gsval) + old_color1 = color1 + if gsval == ' ': + old_char = gsval + else: + old_char = '^▀' + else: + aimg[k] += "\x03{0},{1}{2}".format(color1, color2, gsval) + old_color1 = color1 + old_color2 = color2 + if gsval == ' ': + old_char = gsval + else: + old_char = '^^▀' + if 'tops' in optlist: + aimg[k] = re.sub("\x03\d\d,(\d\d\s+\x03)", "\x0301,\g<1>", aimg[k]) + aimg[k] = re.sub("\x03\d\d,(\d\d\s+$)", "\x0301,\g<1>", aimg[k]) + aimg[k] = re.sub("\x03\d\d,(\d\d\s\x03)", "\x0301,\g<1>", aimg[k]) + aimg[k] = re.sub("\x0301,(\d\d)(\s+)\x03(\d\d)([^,])", "\x03\g<3>,\g<1>\g<2>\g<4>", aimg[k]) + for i in range(0,98): + i = '%02d' % i + aimg[k] = aimg[k].replace("{0}".format(i), "{0}".format(int(i))) + k += 1 + else: + if 'chars' not in optlist and gscale != '\xa0': + image = image.resize((cols, rows), resize) + image = image.convert('L') + lumamap = np.array(image) + # generate list of dimensions + char = 0 + for j in range(rows): + # append an empty string + aimg.append("") + old_color = None + for i in range(cols): + if 'chars' not in optlist and gscale != '\xa0': + # get average luminance + avg = int(np.average(lumamap[j][i])) + # look up ascii char + gsval = gscale[int((avg * (len(gscale) - 1))/255)] + elif 'chars' in optlist and gscale != '\xa0': + if char < len(gscale): + gsval = gscale[char] + char += 1 + else: + char = 0 + gsval = gscale[char] + char += 1 + else: + gsval = '\xa0' + # get color value + if type != 'no-color' and gscale != '\xa0' and i == 0: + color = self.getColor(colormap[j][i].tolist(), speed) + old_color = color + if bg != 99: + color = "{0},{1}".format(color, "{:02d}".format(int(bg))) + if gsval != '\xa0': + aimg[j] += "\x03{0}{1}".format(color, gsval) + else: + aimg[j] += "\x030,{0} ".format(int(color)) + elif type == 'no-color' and i == 0: + if bg != 99 and fg != 99: + aimg[j] += "\x03{0},{1}{2}".format("{:02d}".format(int(fg)), "{:02d}".format(int(bg)), gsval) + elif fg != 99: + aimg[j] += "\x03{0}{1}".format("{:02d}".format(int(fg)), gsval) + elif bg != 99: + aimg[j] += "\x03{0},{1}{2}".format("{:02d}".format(int(fg)), "{:02d}".format(int(bg)), gsval) + elif type != 'no-color' and gsval != ' ': + color = self.getColor(colormap[j][i].tolist(), speed) + if color != old_color: + old_color = color + # append ascii char to string + if gsval != '\xa0': + if gsval.isdigit(): + color = "{:02d}".format(int(color)) + aimg[j] += "\x03{0}{1}".format(color, gsval) + else: + aimg[j] += "\x03{0}{1}".format(int(color), gsval) + else: + aimg[j] += "\x030,{0} ".format(int(color)) + else: + aimg[j] += "{0}".format(gsval) + else: + aimg[j] += "{0}".format(gsval) + output = aimg + paste = "" + self.stopped[msg.args[0]] = False + end_time = time.time() + for line in output: + if self.registryValue('pasteEnable', msg.args[0]): + paste += line + "\n" + if not self.stopped[msg.args[0]]: + time.sleep(delay) + irc.reply(line, prefixNick=False, noLengthCheck=True, private=False, notice=False, to=channel) + if self.registryValue('showStats', msg.args[0]): + longest = len(max(output, key=len).encode('utf-8')) + render_time = "{0:.2f}".format(end_time - start_time) + irc.reply("[Source Colors: {0}, Render Time: {1} seconds, Longest Line: {2} bytes]".format(self.source_colors, render_time, longest), prefixNick=False) + if self.registryValue('pasteEnable', msg.args[0]): + irc.reply(self.doPaste(url, paste), private=False, notice=False, to=channel) + img = wrap(img,[optional('channel'), getopts({'w':'int', 'invert':'', 'fast':'', 'slow':'', '16':'', '99':'', '83':'', 'delay':'float', 'resize':'int', 'quantize':'', 'no-quantize':'', 'chars':'text', 'bg':'int', 'fg':'int', 'ramp':'text', 'no-color':'', 'block':'', 'ascii':'', '1/2':'', 's':'float', 'tops':''}), ('text')]) + + def scroll(self, irc, msg, args, channel, optlist, url): + """[] [--delay] + Play IRC art files from web links. + """ + if not channel: + channel = msg.args[0] + if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): + irc.errorNoCapability('admin') + return + optlist = dict(optlist) + self.stopped[msg.args[0]] = False + if 'delay' in optlist: + delay = optlist.get('delay') + else: + delay = self.registryValue('delay', msg.args[0]) + if url.startswith("https://paste.ee/p/"): + url = url.replace("https://paste.ee/p/", "https://paste.ee/r/") + elif url.startswith("https://pastebin.com/") and '/raw/' not in url: + url = url.replace("https://pastebin.com/", "https://pastebin.com/raw/") + ua = UserAgent() + header = {'User-Agent':str(ua.random)} + r = requests.head(url, headers=header) + if "text/plain" in r.headers["content-type"]: + file = requests.get(url, headers=header) + else: + irc.reply("Invalid file type.", private=False, notice=False) + return + file = file.content.decode().replace('\r\n','\n') + for line in file.split('\n'): + if line.strip() and not self.stopped[msg.args[0]]: + time.sleep(delay) + irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + scroll = wrap(scroll, [optional('channel'), getopts({'delay':'float'}), ('text')]) + + def a2m(self, irc, msg, args, channel, optlist, url): + """[] [--delay] [--l] [--r] [--n] [--p] [--t] [--w] + Convert ANSI files to IRC formatted text. https://github.com/tat3r/a2m + """ + if not channel: + channel = msg.args[0] + if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): + irc.errorNoCapability('admin') + return + optlist = dict(optlist) + opts = '' + if 'l' in optlist: + l = optlist.get('l') + opts += '-l {0} '.format(l) + if 'r' in optlist: + r = optlist.get('r') + opts += '-r {0} '.format(r) + if 'n' in optlist: + opts += '-n '.format(n) + if 'p' in optlist: + opts += '-p ' + if 't' in optlist: + t = optlist.get('t') + opts += '-t {0} '.format(t) + if 'w' in optlist: + w = optlist.get('w') + opts += '-w {0} '.format(w) + else: + opts += '-w 80 ' + if 'delay' in optlist: + delay = optlist.get('delay') + else: + delay = self.registryValue('delay', msg.args[0]) + ua = UserAgent() + header = {'User-Agent':str(ua.random)} + r = requests.head(url, headers=header) + try: + if "text/plain" in r.headers["content-type"] or "application/octet-stream" in r.headers["content-type"] and int(r.headers["content-length"]) < 1000000: + path = os.path.dirname(os.path.abspath(__file__)) + filepath = "{0}/tmp".format(path) + filename = "{0}/{1}".format(filepath, url.split('/')[-1]) + r = requests.get(url, headers=header) + open(filename, 'wb').write(r.content.replace(b';5;', b';')) + try: + output = pexpect.run('a2m {0} {1}'.format(opts.strip(), str(filename))) + try: + os.remove(filename) + except: + pass + except: + irc.reply("Error. Have you installed A2M? https://github.com/tat3r/a2m", private=False, notice=False) + return + else: + irc.reply("Invalid file type.") + return + except: + irc.reply("Invalid file type.") + return + paste = "" + self.stopped[msg.args[0]] = False + output = re.sub('(\x03(\d+).*)\x03,', '\g<1>\x03\g<2>,', output.decode()) + for line in output.splitlines(): + if self.registryValue('pasteEnable', msg.args[0]): + paste += line + "\n" + if line.strip() and not self.stopped[msg.args[0]]: + time.sleep(delay) + irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + elif not line.strip() and not self.stopped[msg.args[0]]: + time.sleep(delay) + irc.reply('\xa0', prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + else: + return + if self.registryValue('pasteEnable', msg.args[0]): + irc.reply(self.doPaste(url, paste), private=False, notice=False, to=channel) + a2m = wrap(a2m, [optional('channel'), getopts({'l':'int', 'r':'int', 't':'int', 'w':'int', 'p':'', 'delay':'float'}), ('text')]) + + def p2u(self, irc, msg, args, channel, optlist, url): + """[] [--b] [--f] [--p] [--s] [--t] [--w] [--delay] + Picture to Unicode. https://git.trollforge.org/p2u/about/ + """ + if not channel: + channel = msg.args[0] + if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): + irc.errorNoCapability('admin') + return + optlist = dict(optlist) + opts = '' + if 'b' in optlist: + b = optlist.get('b') + opts += '-b {0} '.format(b) + if 'f' in optlist: + f = optlist.get('f') + opts += '-f {0} '.format(f) + else: + opts += '-f m ' + if 'p' in optlist: + p = optlist.get('p') + opts += '-p {0} '.format(p) + else: + opts += '-p x ' + if 's' in optlist: + s = optlist.get('s') + opts += '-s {0} '.format(s) + if 't' in optlist: + t = optlist.get('t') + opts += '-t {0} '.format(t) + if 'w' in optlist: + w = optlist.get('w') + opts += '-w {0} '.format(w) + else: + w = self.registryValue('blockWidth', msg.args[0]) + opts += '-w {0} '.format(w) + if 'delay' in optlist: + delay = optlist.get('delay') + else: + delay = self.registryValue('delay', msg.args[0]) + path = os.path.dirname(os.path.abspath(__file__)) + filepath = "{0}/tmp".format(path) + filename = "{0}/{1}".format(filepath, url.split('/')[-1]) + ua = UserAgent() + header = {'User-Agent':str(ua.random)} + image_formats = ("image/png", "image/jpeg", "image/jpg", "image/gif") + r = requests.head(url, headers=header) + if r.headers["content-type"] in image_formats: + response = requests.get(url, headers=header) + else: + irc.reply("Invalid file type.", private=False, notice=False) + return + if response.status_code == 200: + with open("{0}".format(filename), 'wb') as f: + f.write(response.content) + try: + output = pexpect.run('p2u -f m {0} {1}'.format(opts.strip(), str(filename))) + try: + os.remove(filename) + except: + pass + except: + irc.reply("Error. Have you installed p2u? https://git.trollforge.org/p2u", private=False, notice=False) + return + paste = "" + self.stopped[msg.args[0]] = False + for line in output.splitlines(): + line = line.decode() + line = re.sub('^\x03 ', ' ', line) + if self.registryValue('pasteEnable', msg.args[0]): + paste += line + "\n" + if line.strip() and not self.stopped[msg.args[0]]: + time.sleep(delay) + irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + if self.registryValue('pasteEnable', msg.args[0]): + irc.reply(self.doPaste(url, paste), private=False, notice=False, to=channel) + else: + irc.reply("Unexpected file type or link format", private=False, notice=False) + p2u = wrap(p2u, [optional('channel'), getopts({'b':'int', 'f':'text', 'p':'text', 's':'int', 't':'int', 'w':'int', 'delay':'float'}), ('text')]) + + def tdf(self, irc, msg, args, channel, optlist, text): + """[] [--f] [--j] [--w] [--e] [--r] [--i][--delay] + Text to TheDraw ANSI Fonts. http://www.roysac.com/thedrawfonts-tdf.html + --f [font] Specify font file used. + --j l|r|c Justify left, right, or center. Default is left. + --w n Set screen width. Default is 80. + --c a|m Color format ANSI or mirc. Default is ANSI. + --i Print font details. + --r Use random font. + """ + if not channel: + channel = msg.args[0] + if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): + irc.errorNoCapability('admin') + return + optlist = dict(optlist) + opts = '' + if 'f' in optlist: + f = optlist.get('f') + opts += '-f {0} '.format(f.lower()) + else: + opts += '-r ' + if 'j' in optlist: + j = optlist.get('j') + opts += '-j {0} '.format(j) + if 'w' in optlist: + w = optlist.get('w') + opts += '-w {0} '.format(w) + else: + opts += '-w 80 ' + if 'e' in optlist: + e = optlist.get('e') + opts += '-e {0} '.format(e) + if 'r' in optlist: + opts += '-r ' + if 'delay' in optlist: + delay = optlist.get('delay') + else: + delay = self.registryValue('delay', msg.args[0]) + if 'i' in optlist: + opts += '-i ' + try: + output = pexpect.run('tdfiglet -c m {0} {1}'.format(opts.strip(), r'{}'.format(text))) + except: + irc.reply("Error. Have you installed tdfiglet? https://github.com/tat3r/tdfiglet", private=False, notice=False) + return + paste = "" + self.stopped[msg.args[0]] = False + output = output.decode().replace('\r\r\n', '\r\n') + for line in output.splitlines(): + line = re.sub('\x03\x03\s*', '\x0F ', line) + line = re.sub('\x0F\s*\x03$', '', line) + if self.registryValue('pasteEnable', msg.args[0]): + paste += line + "\n" + if not line.strip() and not self.stopped[msg.args[0]]: + time.sleep(delay) + irc.reply('\xa0', prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + elif not self.stopped[msg.args[0]]: + time.sleep(delay) + irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + if self.registryValue('pasteEnable', msg.args[0]): + irc.reply(self.doPaste(text, paste), private=False, notice=False, to=channel) + tdf = wrap(tdf, [optional('channel'), getopts({'f':'text', 'j':'text', 'w':'int', 'e':'text', 'r':'', 'i':'', 'delay':'float'}), ('text')]) + + def toilet(self, irc, msg, args, channel, optlist, text): + """[] [--f fontname] [--F filter1,filter2,etc.] [--w] [--delay] + Text to toilet figlets. -f to select font. -F to select filters. Separate multiple filters with a comma. + """ + if not channel: + channel = msg.args[0] + if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): + irc.errorNoCapability('admin') + return + optlist = dict(optlist) + opts = '' + if 'f' in optlist: + f = optlist.get('f') + opts += '-f {0} '.format(f) + if 'F' in optlist: + filter = optlist.get('F') + if ',' in filter: + filter = filter.split(',') + for i in range(len(filter)): + opts += '-F {0} '.format(filter[i]) + else: + opts += '-F {0} '.format(filter) + if 'w' in optlist: + w = optlist.get('w') + opts += '-w {0} '.format(w) + elif 'W' in optlist: + opts += '-W ' + else: + opts += '-w 100 ' + if 's' in optlist: + opts += '-s ' + elif 'k' in optlist: + opts += '-k ' + elif 'o' in optlist: + opts += '-o ' + elif 'S' in optlist: + opts += '-S ' + if 'delay' in optlist: + delay = optlist.get('delay') + else: + delay = self.registryValue('delay', msg.args[0]) + try: + output = pexpect.run('toilet --irc {0} {1}'.format(opts.strip(), text)) + except: + irc.reply("Error. Have you installed toilet?", private=False, notice=False) + return + paste = "" + self.stopped[msg.args[0]] = False + output = output.decode().replace('\r\r\n', '\r\n') + for line in output.splitlines(): + if self.registryValue('pasteEnable', msg.args[0]): + paste += line + "\n" + if not line.strip() and not self.stopped[msg.args[0]]: + time.sleep(delay) + irc.reply('\xa0', prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + elif not self.stopped[msg.args[0]]: + time.sleep(delay) + irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + if self.registryValue('pasteEnable', msg.args[0]): + irc.reply(self.doPaste(text, paste), private=False, notice=False, to=channel) + toilet = wrap(toilet, [optional('channel'), getopts({'f':'text', 'F':'text', 's':'', 'S':'', 'k':'', 'w':'int', 'W':'', 'o':'', 'delay':'float'}), ('text')]) + + def fonts(self, irc, msg, args, optlist): + """[--toilet] + List figlets. Default list are tdf fonts. --toilet for toilet fonts + """ + optlist = dict(optlist) + if 'toilet' in optlist: + try: + reply = ", ".join(sorted(os.listdir("/usr/share/figlet"))) + irc.reply(reply, prefixNick=False) + except: + irc.reply("Sorry, unable to access font directory /usr/share/figlet") + else: + try: + reply = ", ".join(sorted(os.listdir("/usr/local/share/tdfiglet/fonts/"))) + irc.reply("http://www.roysac.com/thedrawfonts-tdf.html", prefixNick=False) + irc.reply(reply, prefixNick=False) + except FileNotFoundError: + reply = ", ".join(sorted(os.listdir("/usr/share/figlet"))) + irc.reply(reply, prefixNick=False) + except: + irc.reply("Sorry, unable to access font directories /usr/local/share/tdfiglet/fonts/ or /usr/share/figlet") + fonts = wrap(fonts, [getopts({'toilet':''})]) + + def wttr(self, irc, msg, args, channel, optlist, location): + """[] [--16] [--99] + IRC art weather report from wttr.in for . + --16 for 16 colors (default). + --99 for 99 colors. + Get moon phase with 'wttr moon'. + ?u (use imperial units). + ?m (metric). + ?<1-3> (number of days) + """ + if not channel: + channel = msg.args[0] + if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): + irc.errorNoCapability('admin') + return + optlist = dict(optlist) + if 'delay' in optlist: + delay = optlist.get('delay') + else: + delay = self.registryValue('delay', msg.args[0]) + if '16' in optlist: + self.colors = 16 + elif '99' in optlist: + self.colors = 99 + else: + self.colors = self.registryValue('colors', msg.args[0]) + if 'fast' in optlist: + speed = 'fast' + elif 'slow' in optlist: + speed = 'slow' + else: + speed = 'fast' + file = requests.get("http://wttr.in/{0}".format(location)) + output = file.content.decode() + output = self.ansi2irc(output) + output = re.sub('⚡', '☇ ', output) + output = re.sub('‘‘', '‘ ', output) + paste = "" + self.stopped[msg.args[0]] = False + for line in output.splitlines(): + line = line.strip('\x0F') + if not line.strip(): + line = '\xa0' + if self.registryValue('pasteEnable', msg.args[0]) and not line.startswith("Follow"): + paste += line + "\n" + if line.strip() and not self.stopped[msg.args[0]] and not line.startswith("Follow"): + time.sleep(delay) + irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + if self.registryValue('pasteEnable', msg.args[0]): + irc.reply(self.doPaste(location, paste), private=False, notice=False, to=channel) + wttr = wrap(wttr, [optional('channel'), getopts({'delay':'float', '16':'', '99':'', 'fast':'', 'slow':''}), ('text')]) + + def rate(self, irc, msg, args, channel, optlist, coin): + """[] [--16] [--99] [--sub ] [coin] + Crypto exchange rate info from rate.sx. http://rate.sx/:help. Use --sub to set subdomain e.g. eur, btc, etc. + Get a graph with [coin] e.g. 'rate btc'. + --16 for 16 colors (default). + --99 for 99 colors. + """ + if not channel: + channel = msg.args[0] + if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): + irc.errorNoCapability('admin') + return + optlist = dict(optlist) + if 'delay' in optlist: + delay = optlist.get('delay') + else: + delay = self.registryValue('delay', msg.args[0]) + if '16' in optlist: + self.colors = 16 + elif '99' in optlist: + self.colors = 99 + else: + self.colors = self.registryValue('colors', msg.args[0]) + if 'fast' in optlist: + speed = 'fast' + elif 'slow' in optlist: + speed = 'slow' + else: + speed = 'fast' + if 'sub' in optlist: + sub = optlist.get('sub') + else: + sub = 'usd' + if not coin: + coin = '' + file = requests.get("http://{0}.rate.sx/{1}".format(sub, coin)) + output = file.content.decode() + output = self.ansi2irc(output) + output = output.replace('\x1b(B', '') + paste = "" + self.stopped[msg.args[0]] = False + for line in output.splitlines(): + line = line.strip('\x0F') + if not line.strip() and not self.stopped[msg.args[0]]: + if self.registryValue('pasteEnable', msg.args[0]): + paste += line + "\n" + time.sleep(delay) + irc.reply('\xa0', prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + elif line.strip() and not self.stopped[msg.args[0]] and "Follow @igor_chubin" not in line: + if self.registryValue('pasteEnable', msg.args[0]): + paste += line + "\n" + time.sleep(delay) + irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + if self.registryValue('pasteEnable', msg.args[0]): + irc.reply(self.doPaste(coin, paste), private=False, notice=False, to=channel) + rate = wrap(rate, [optional('channel'), getopts({'delay':'float', '16':'', '99':'', 'sub':'text', 'fast':'', 'slow':''}), optional('text')]) + + def cow(self, irc, msg, args, channel, optlist, text): + """[] [--delay] [--type ] + Cowsay + """ + if not channel: + channel = msg.args[0] + if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): + irc.errorNoCapability('admin') + return + optlist = dict(optlist) + if 'delay' in optlist: + delay = optlist.get('delay') + else: + delay = self.registryValue('delay', msg.args[0]) + if 'type' in optlist: + type = optlist.get('type') + else: + type = 'default' + data = requests.get("https://easyapis.soue.tk/api/cowsay?text={0}&type={1}".format(text, type)) + self.stopped[msg.args[0]] = False + paste = '' + for line in data.text.splitlines(): + if self.registryValue('pasteEnable', msg.args[0]): + paste += line + "\n" + if not line.strip() and not self.stopped[msg.args[0]]: + time.sleep(delay) + irc.reply('\xa0', prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + elif line.strip() and not self.stopped[msg.args[0]] and "Follow @igor_chubin" not in line: + time.sleep(delay) + irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + if self.registryValue('pasteEnable', msg.args[0]): + irc.reply(self.doPaste(text, paste), private=False, notice=False, to=channel) + cow = wrap(cow, [optional('channel'), getopts({'delay':'float', 'type':'text'}), ('text')]) + + def fortune(self, irc, msg, args, channel, optlist): + """[] + Returns random art fortune from http://www.asciiartfarts.com/fortune.txt + """ + if not channel: + channel = msg.args[0] + if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): + irc.errorNoCapability('admin') + return + optlist = dict(optlist) + if 'delay' in optlist: + delay = optlist.get('delay') + else: + delay = self.registryValue('delay', msg.args[0]) + self.stopped[msg.args[0]] = False + data = requests.get("http://www.asciiartfarts.com/fortune.txt") + fortunes = data.text.split('%\n') + fortune = random.randrange(0, len(fortunes)) + for line in fortunes[fortune].splitlines(): + if not line.strip() and not self.stopped[msg.args[0]]: + time.sleep(delay) + irc.reply('\xa0', prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + elif line.strip() and not self.stopped[msg.args[0]] and "Follow @igor_chubin" not in line: + time.sleep(delay) + irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + fortune = wrap(fortune, [optional('channel'), getopts({'delay':'float'})]) + + def mircart(self, irc, msg, args, channel, optlist, search): + """[] (search text) + Search https://mircart.org/ and scroll first result + """ + if not channel: + channel = msg.args[0] + if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): + irc.errorNoCapability('admin') + return + optlist = dict(optlist) + if 'delay' in optlist: + delay = optlist.get('delay') + else: + delay = self.registryValue('delay', msg.args[0]) + self.stopped[msg.args[0]] = False + ua = UserAgent() + header = {'User-Agent':str(ua.random)} + data = requests.get("https://mircart.org/?s={0}".format(search), headers=header) + soup = BeautifulSoup(data.text) + url = soup.find(href=re.compile(".txt")) + data = requests.get(url.get('href'), headers=header) + output = data.content.decode() + for line in output.splitlines(): + if not line.strip() and not self.stopped[msg.args[0]]: + time.sleep(delay) + irc.reply('\xa0', prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + elif line.strip() and not self.stopped[msg.args[0]] and "Follow @igor_chubin" not in line: + time.sleep(delay) + irc.reply(line, prefixNick = False, noLengthCheck=True, private=False, notice=False, to=channel) + irc.reply(url.get('href')) + mircart = wrap(mircart, [optional('channel'), getopts({'delay':'float'}), ('text')]) + + def cq(self, irc, msg, args): + """ + Stop the scroll. + """ + if not self.stopped[msg.args[0]]: + irc.reply("Stopping.") + self.stopped[msg.args[0]] = True + cq = wrap(cq) + + def codes(self, irc, msg, args): + """ + Show a grid of IRC color codes. + """ + irc.reply("\x031,0000\x031,0101\x031,0202\x031,0303\x031,0404\x031,0505\x031,0606\x031,0707\x031,0808\x031,0909\x031,1010\x031,1111\x031,1212\x031,1313\x031,1414\x031,1515", prefixNick=False) + irc.reply("\x031,1616\x031,1717\x031,1818\x031,1919\x031,2020\x031,2121\x031,2222\x031,2323\x031,2424\x031,2525\x031,2626\x031,2727", prefixNick=False) + irc.reply("\x031,2828\x031,2929\x031,3030\x031,3131\x031,3232\x031,3333\x031,3434\x031,3535\x031,3636\x031,3737\x031,3838\x031,3939", prefixNick=False) + irc.reply("\x031,4040\x031,4141\x031,4242\x031,4343\x031,4444\x031,4545\x031,4646\x031,4747\x031,4848\x031,4949\x031,5050\x031,5151", prefixNick=False) + irc.reply("\x031,5252\x031,5353\x031,5454\x031,5555\x031,5656\x031,5757\x031,5858\x031,5959\x031,6060\x031,6161\x031,6262\x031,6363", prefixNick=False) + irc.reply("\x031,6464\x031,6565\x031,6666\x031,6767\x031,6868\x031,6969\x031,7070\x031,7171\x031,7272\x031,7373\x031,7474\x031,7575", prefixNick=False) + irc.reply("\x031,7676\x031,7777\x031,7878\x031,7979\x031,8080\x031,8181\x031,8282\x031,8383\x031,8484\x031,8585\x031,8686\x031,8787", prefixNick=False) + irc.reply("\x031,8888\x031,8989\x031,9090\x031,9191\x031,9292\x031,9393\x031,9494\x031,9595\x031,9696\x031,9797\x031,9898\x031,9999", prefixNick=False) + codes = wrap(codes) + +Class = TextArt diff --git a/TimeBomb/__init__.py b/TimeBomb/__init__.py index 49f5fe5..32723de 100644 --- a/TimeBomb/__init__.py +++ b/TimeBomb/__init__.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2010, quantumlemur +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,15 +26,13 @@ # 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. - ### # Many thanks to pawarswap for the ascii-art bomb! """ -Allows you to 'bomb' people in the channel. If they get the get the wire -wrong, they get kicked. (It's a game) +TimeBomb: 'bomb' people in the channel. If they get the get the wire wrong, they get kicked. """ import supybot @@ -41,7 +40,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('quantumlemur', 'quantumlemur', diff --git a/TimeBomb/config.py b/TimeBomb/config.py index 632dd2d..c21743e 100644 --- a/TimeBomb/config.py +++ b/TimeBomb/config.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2010, quantumlemur +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,7 +26,6 @@ # 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 diff --git a/TimeBomb/plugin.py b/TimeBomb/plugin.py index 56d937e..72d1b41 100644 --- a/TimeBomb/plugin.py +++ b/TimeBomb/plugin.py @@ -1,6 +1,6 @@ ### # Copyright (c) 2010, quantumlemur -# Copyright (c) 2020, oddluck +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -18,7 +18,7 @@ # 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 +# 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 @@ -26,7 +26,6 @@ # 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 time diff --git a/TimeBomb/test.py b/TimeBomb/test.py deleted file mode 100644 index a1b61be..0000000 --- a/TimeBomb/test.py +++ /dev/null @@ -1,37 +0,0 @@ -### -# Copyright (c) 2010, quantumlemur -# 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 TimeBombTestCase(PluginTestCase): - plugins = ('TimeBomb',) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/Trackers/__init__.py b/Trackers/__init__.py index eb3be99..56bff0a 100644 --- a/Trackers/__init__.py +++ b/Trackers/__init__.py @@ -1,14 +1,35 @@ ### -# Copyright (c) 2016, Ormanya -# Copyright (c) 2020, oddluck +# Copyright (c) 2017, Ormanya +# Copyright (c) 2020, oddluck # 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. ### """ -Add a description of the plugin (to be presented to the user inside the wizard) -here. This should describe *what* the plugin does. +Trackers: provide status of various torrent trackers. """ import supybot @@ -17,7 +38,7 @@ import importlib # 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('ormanya', '', '') diff --git a/Trackers/config.py b/Trackers/config.py index 952aca7..d22f3c1 100644 --- a/Trackers/config.py +++ b/Trackers/config.py @@ -1,51 +1,73 @@ -### -# Copyright (c) 2016-2017 Ormanya -# Copyright (c) 2020, oddluck -# All rights reserved. -# -# -### - -import supybot.conf as conf -import supybot.registry as registry -import os -try: - from supybot.i18n import PluginInternationalization, internationalizeDocstring -except: - PluginInternationalization, internationalizeDocstring = lambda x:x, lambda x:x - -#The plugin name will be based on the plugin's folder. -PluginName=os.path.dirname( __file__ ).split(os.sep)[-1] - -_ = PluginInternationalization(PluginName) - -def configure(advanced): - # This will be called by supybot to configure this module. advanced is - # a bool that specifies whether the user identified himself 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(PluginName, True) - -Trackers = conf.registerPlugin('Trackers') - -conf.registerGroup(Trackers, 'announce') -conf.registerChannelValue(Trackers.announce, 'seconds', - registry.PositiveInteger(10, _("""Determines the amount of time in seconds the bot should - announce tracker statuses."""))) - -_events = {'ab':False, 'ahd':False, 'ar':False, 'btn':False, 'emp':False, 'ggn':False, 'mtv':False, 'nbl':False, 'nwcd':False, '32p':False, 'ptp':False, 'red':False} -for ev in _events: - conf.registerChannelValue(Trackers.announce, 'relay%s' % ev, - registry.Boolean(_events[ev], """Determines whether the bot should announce status for %s.""" % ev)) - - -P = conf.registerPlugin(PluginName) -#P.__name__ = PluginName - -# This is where your configuration variables (if any) should go. For example: -# conf.registerGlobalValue(PluginName, 'someConfigVariableName', -# registry.Boolean(False, """Help for someConfigVariableName.""")) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: +### +# Copyright (c) 2017, Ormanya +# Copyright (c) 2020, oddluck +# 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 +import os +try: + from supybot.i18n import PluginInternationalization, internationalizeDocstring +except: + PluginInternationalization, internationalizeDocstring = lambda x:x, lambda x:x + +#The plugin name will be based on the plugin's folder. +PluginName=os.path.dirname( __file__ ).split(os.sep)[-1] + +_ = PluginInternationalization(PluginName) + +def configure(advanced): + # This will be called by supybot to configure this module. advanced is + # a bool that specifies whether the user identified himself 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(PluginName, True) + +Trackers = conf.registerPlugin('Trackers') + +conf.registerGroup(Trackers, 'announce') +conf.registerChannelValue(Trackers.announce, 'seconds', + registry.PositiveInteger(10, _("""Determines the amount of time in seconds the bot should + announce tracker statuses."""))) + +_events = {'ab':False, 'ahd':False, 'ar':False, 'btn':False, 'emp':False, 'ggn':False, 'mtv':False, 'nbl':False, 'nwcd':False, '32p':False, 'ptp':False, 'red':False} +for ev in _events: + conf.registerChannelValue(Trackers.announce, 'relay%s' % ev, + registry.Boolean(_events[ev], """Determines whether the bot should announce status for %s.""" % ev)) + + +P = conf.registerPlugin(PluginName) +#P.__name__ = PluginName + +# This is where your configuration variables (if any) should go. For example: +# conf.registerGlobalValue(PluginName, 'someConfigVariableName', +# registry.Boolean(False, """Help for someConfigVariableName.""")) + + +# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/Trackers/plugin.py b/Trackers/plugin.py index 0a662dc..fd2c246 100644 --- a/Trackers/plugin.py +++ b/Trackers/plugin.py @@ -1,9 +1,31 @@ ### -# Copyright (c) 2016-2017 Ormanya -# Copyright (c) 2020, oddluck +# Copyright (c) 2017, Ormanya +# Copyright (c) 2020, oddluck # 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.plugins as plugins diff --git a/TriviaTime/__init__.py b/TriviaTime/__init__.py index 9c16c55..6cbc111 100644 --- a/TriviaTime/__init__.py +++ b/TriviaTime/__init__.py @@ -1,12 +1,35 @@ ### # Copyright (c) 2013, tann +# Copyright (c) 2020, oddluck # 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. ### """ -A feature-packed trivia plugin designed exclusively for #trivialand on Freenode. +TriviaTime: a feature-packed trivia plugin. """ import supybot @@ -15,7 +38,7 @@ import imp # 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('Tanner', 'tann', diff --git a/TriviaTime/config.py b/TriviaTime/config.py index fc26b53..548927d 100644 --- a/TriviaTime/config.py +++ b/TriviaTime/config.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2013, tann +# Copyright (c) 2020, oddluck # 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 diff --git a/TriviaTime/local/__init__.py b/TriviaTime/local/__init__.py deleted file mode 100644 index e86e97b..0000000 --- a/TriviaTime/local/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Stub so local is a module, used for third-party modules diff --git a/TriviaTime/plugin.py b/TriviaTime/plugin.py index 148974c..c80a0c0 100644 --- a/TriviaTime/plugin.py +++ b/TriviaTime/plugin.py @@ -1,9 +1,31 @@ -# -*- coding: utf-8 -*- ### # Copyright (c) 2013, tann +# Copyright (c) 2020, oddluck # 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.utils as utils diff --git a/TriviaTime/test.py b/TriviaTime/test.py deleted file mode 100644 index 413e832..0000000 --- a/TriviaTime/test.py +++ /dev/null @@ -1,14 +0,0 @@ -### -# Copyright (c) 2013, tann -# All rights reserved. -# -# -### - -from supybot.test import * - -class TriviaTimeTestCase(PluginTestCase): - plugins = ('TriviaTime',) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/Tweety/.gitignore b/Tweety/.gitignore deleted file mode 100644 index f24cd99..0000000 --- a/Tweety/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -*.py[co] - -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox - -#Translations -*.mo - -#Mr Developer -.mr.developer.cfg diff --git a/Tweety/.travis.yml b/Tweety/.travis.yml deleted file mode 100644 index c16270d..0000000 --- a/Tweety/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: python -python: - - "2.7" - - pypy -# command to install dependencies, -install: - - pip install -vr requirements.txt||true -# command to run tests, e.g. python setup.py test -script: - - echo $TRAVIS_PYTHON_VERSION - - cd .. && supybot-test Tweety -notifications: - email: false - irc: - channels: - - "irc.efnet.net#supybot" -matrix: - fast_finish: true - diff --git a/Tweety/__init__.py b/Tweety/__init__.py index 251ca04..72d54ac 100644 --- a/Tweety/__init__.py +++ b/Tweety/__init__.py @@ -1,9 +1,35 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2013, spline +### +# Copyright (c) 2014, spline +# Copyright (c) 2020, oddluck +# 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. ### """ -Retrieve tweets from the Twitter API +Tweety: retrieve tweets from the Twitter API """ import supybot @@ -11,7 +37,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('reticulatingspline', 'spline', 'spline') diff --git a/Tweety/config.py b/Tweety/config.py index 647d80d..70adbdf 100644 --- a/Tweety/config.py +++ b/Tweety/config.py @@ -1,5 +1,31 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2013, spline +### +# Copyright (c) 2014, spline +# Copyright (c) 2020, oddluck +# 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 diff --git a/Tweety/local/__init__.py b/Tweety/local/__init__.py deleted file mode 100644 index e86e97b..0000000 --- a/Tweety/local/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Stub so local is a module, used for third-party modules diff --git a/Tweety/plugin.py b/Tweety/plugin.py index c985c42..866aa88 100644 --- a/Tweety/plugin.py +++ b/Tweety/plugin.py @@ -1,5 +1,31 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2013, spline +### +# Copyright (c) 2014, spline +# Copyright (c) 2020, oddluck +# 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. ### # my libs diff --git a/Tweety/test.py b/Tweety/test.py index f60e71a..5cbc3fe 100644 --- a/Tweety/test.py +++ b/Tweety/test.py @@ -1,4 +1,31 @@ -# Copyright (c) 2013-2014, spline +### +# Copyright (c) 2014, spline +# Copyright (c) 2020, oddluck +# 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 * diff --git a/Undercut/__init__.py b/Undercut/__init__.py index 4a2d78e..dd4bff4 100644 --- a/Undercut/__init__.py +++ b/Undercut/__init__.py @@ -1,9 +1,35 @@ ### -# by SpiderDave +# Copyright (c) SpiderDave +# Copyright (c) 2020, oddluck +# 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. ### """ -Who knows? +Undercut: a card game plugin for multiple players """ import supybot @@ -12,7 +38,7 @@ import importlib # 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__ = "" +__version__ = "2020.02.24+git" __author__ = supybot.Author('SpiderDave', 'SpiderDave', '') __maintainer__ = getattr(supybot.authors, 'oddluck', diff --git a/Undercut/config.py b/Undercut/config.py index d9f1056..0cd50db 100644 --- a/Undercut/config.py +++ b/Undercut/config.py @@ -1,12 +1,35 @@ ### -# by SpiderDave +# Copyright (c) SpiderDave +# Copyright (c) 2020, oddluck +# 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 -import os -#The plugin name will be based on the plugin's folder. -PluginName=os.path.dirname( __file__ ).split(os.sep)[-1] def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -14,9 +37,14 @@ 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(PluginName, True) + conf.registerPlugin('Undercut', True) -P = conf.registerPlugin(PluginName) -P.__name__ = PluginName -# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: +Unicode = conf.registerPlugin('Undercut') +# This is where your configuration variables (if any) should go. For example: +# conf.registerGlobalValue(Unicode, 'someConfigVariableName', +# registry.Boolean(False, """Help for someConfigVariableName.""")) + + +# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: + diff --git a/Undercut/plugin.py b/Undercut/plugin.py index 041267a..24602a9 100644 --- a/Undercut/plugin.py +++ b/Undercut/plugin.py @@ -1,5 +1,31 @@ ### -# by SpiderDave +# Copyright (c) SpiderDave +# Copyright (c) 2020, oddluck +# 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 re diff --git a/UndernetX/__init__.py b/UndernetX/__init__.py index a5e9903..bbcd41f 100644 --- a/UndernetX/__init__.py +++ b/UndernetX/__init__.py @@ -1,5 +1,6 @@ ### -# Copyright (c) 2013, Ken Spencer +# Copyright (c) 2017, Ken Spencer +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,11 +26,10 @@ # 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. - ### """ -Undernet Utilities +UndernetX: UnderNet utilities. """ import supybot @@ -38,7 +38,7 @@ import importlib # 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author("Ken Spencer", "kspencer", "ken@electrocode.net") diff --git a/UndernetX/config.py b/UndernetX/config.py index 81d4f89..89591a1 100644 --- a/UndernetX/config.py +++ b/UndernetX/config.py @@ -1,5 +1,6 @@ ### -# Copyright (c) 2013, Ken Spencer +# Copyright (c) 2017, Ken Spencer +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,7 +26,6 @@ # 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 diff --git a/UndernetX/plugin.py b/UndernetX/plugin.py index 0d20562..851d769 100644 --- a/UndernetX/plugin.py +++ b/UndernetX/plugin.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2017, Ken Spencer +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,8 +26,8 @@ # 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.log as log import supybot.ircmsgs as ircmsgs import supybot.utils as utils diff --git a/UndernetX/test.py b/UndernetX/test.py deleted file mode 100644 index d837395..0000000 --- a/UndernetX/test.py +++ /dev/null @@ -1,37 +0,0 @@ -### -# Copyright (c) 2013, Ken Spencer -# 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 DDateTestCase(PluginTestCase): - plugins = ('UndernetX',) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/Unicode/__init__.py b/Unicode/__init__.py index 429266a..4fc94da 100644 --- a/Unicode/__init__.py +++ b/Unicode/__init__.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2010, Michael B. Klein +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,11 +26,10 @@ # 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. - ### """ -Retrieve unicode character info +Unicode: retrieve unicode character info """ import supybot @@ -38,7 +38,7 @@ import imp # 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('Michael B. Klein', 'gsf', '') diff --git a/Unicode/config.py b/Unicode/config.py index 6b925bc..1c0446a 100644 --- a/Unicode/config.py +++ b/Unicode/config.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2010, Michael B. Klein +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -25,7 +26,6 @@ # 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 diff --git a/Unicode/plugin.py b/Unicode/plugin.py index 86ffb34..382cb01 100644 --- a/Unicode/plugin.py +++ b/Unicode/plugin.py @@ -1,6 +1,6 @@ ### # Copyright (c) 2010, Michael B. Klein -# Copyright (c) 2020, oddluck +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -26,7 +26,6 @@ # 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.utils as utils diff --git a/Unicode/test.py b/Unicode/test.py deleted file mode 100644 index 6ddabf5..0000000 --- a/Unicode/test.py +++ /dev/null @@ -1,37 +0,0 @@ -### -# Copyright (c) 2010, Michael B. Klein -# 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 UnicodeTestCase(PluginTestCase): - plugins = ('Unicode',) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/Uno/__init__.py b/Uno/__init__.py index 94dcd78..a64433b 100644 --- a/Uno/__init__.py +++ b/Uno/__init__.py @@ -1,9 +1,35 @@ ### -# by SpiderDave +# Copyright (c) SpiderDave +# Copyright (c) 2020, oddluck +# 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. ### """ -Who knows? +UNO: the uno card game for Limnoria. """ import supybot @@ -11,7 +37,7 @@ 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__ = "" +__version__ = "2020.02.24+git" __author__ = supybot.Author('SpiderDave', 'SpiderDave', '') __maintainer__ = getattr(supybot.authors, 'oddluck', diff --git a/Uno/config.py b/Uno/config.py index 0cad209..a97eb68 100644 --- a/Uno/config.py +++ b/Uno/config.py @@ -1,5 +1,31 @@ ### -# by SpiderDave +# Copyright (c) SpiderDave +# Copyright (c) 2020, oddluck +# 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 diff --git a/Uno/plugin.py b/Uno/plugin.py index 8dc2c26..38cef3f 100644 --- a/Uno/plugin.py +++ b/Uno/plugin.py @@ -1,15 +1,33 @@ ### -# Uno/plugin.py -# by SpiderDave +# Copyright (c) SpiderDave +# Copyright (c) 2020, oddluck +# 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. ### - -# -- ToDo -------------------------------- -# * Add option for colors, bold -# * Configurable maximum tables and -# tables per channel. -# ---------------------------------------- - import re import random diff --git a/UrbanDictionary/.gitignore b/UrbanDictionary/.gitignore deleted file mode 100644 index f24cd99..0000000 --- a/UrbanDictionary/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -*.py[co] - -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox - -#Translations -*.mo - -#Mr Developer -.mr.developer.cfg diff --git a/UrbanDictionary/.travis.yml b/UrbanDictionary/.travis.yml deleted file mode 100644 index 8887dbe..0000000 --- a/UrbanDictionary/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: python -python: - - "2.7" - - "3.4" - - pypy -# command to install dependencies, -install: - - pip install -vr requirements.txt||true -# command to run tests, e.g. python setup.py test -script: - - echo $TRAVIS_PYTHON_VERSION - - cd .. && supybot-test UrbanDictionary -notifications: - email: false - irc: - channels: - - "irc.efnet.net#supybot" - template: - - "Build #%{build_number}: %{repository} %{branch} (%{commit}) %{author} - %{message}" - - "Build details: \x03 %{build_url}" -matrix: - fast_finish: true - diff --git a/UrbanDictionary/__init__.py b/UrbanDictionary/__init__.py index 39d8054..a32435d 100644 --- a/UrbanDictionary/__init__.py +++ b/UrbanDictionary/__init__.py @@ -1,13 +1,35 @@ ### -# Copyright (c) 2012-2013, spline +# Copyright (c) 2013, spline +# Copyright (c) 2020, oddluck # 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. ### """ -Add a description of the plugin (to be presented to the user inside the wizard) -here. This should describe *what* the plugin does. +UrbanDictionary: fetch urban dictionary results from urbandictionary.com """ import supybot @@ -15,7 +37,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('reticulatingspline', 'spline', '') diff --git a/UrbanDictionary/config.py b/UrbanDictionary/config.py index eefdeab..9b2baa3 100644 --- a/UrbanDictionary/config.py +++ b/UrbanDictionary/config.py @@ -1,8 +1,31 @@ ### -# Copyright (c) 2012-2013, spline +# Copyright (c) 2013, spline +# Copyright (c) 2020, oddluck # 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 diff --git a/UrbanDictionary/local/__init__.py b/UrbanDictionary/local/__init__.py deleted file mode 100644 index e86e97b..0000000 --- a/UrbanDictionary/local/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Stub so local is a module, used for third-party modules diff --git a/UrbanDictionary/plugin.py b/UrbanDictionary/plugin.py index 42e81a5..fa3c8a7 100644 --- a/UrbanDictionary/plugin.py +++ b/UrbanDictionary/plugin.py @@ -1,10 +1,33 @@ -# -*- coding: utf-8 -*- ### -# Copyright (c) 2012-2013, spline +# Copyright (c) 2013, spline +# Copyright (c) 2020, oddluck # 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 __future__ import unicode_literals # my libs import json diff --git a/UrbanDictionary/test.py b/UrbanDictionary/test.py deleted file mode 100644 index 7d443d0..0000000 --- a/UrbanDictionary/test.py +++ /dev/null @@ -1,18 +0,0 @@ -### -# Copyright (c) 2012-2014, spline -# All rights reserved. -# -# -### - -from supybot.test import * - -class UrbanDictionaryTestCase(PluginTestCase): - plugins = ('UrbanDictionary',) - - def testUrbanDictionary(self): - conf.supybot.plugins.UrbanDictionary.disableANSI.setValue('True') - self.assertRegexp('urbandictionary hello', 'hello ::') - self.assertRegexp('urbandictionary spline', 'spline ::') - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/Weed/__init__.py b/Weed/__init__.py index 6da0900..31b6ba9 100644 --- a/Weed/__init__.py +++ b/Weed/__init__.py @@ -1,12 +1,34 @@ ### -# Copyright (c) 2019 oddluck +# Copyright (c) 2020, oddluck # 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. ### """ -Weed: Uses Weed API to retrieve information +Weed: uses The Strain API to retrieve cannabis (marijuana) information. """ import supybot @@ -14,7 +36,7 @@ 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('oddluck', 'oddluck', diff --git a/Weed/config.py b/Weed/config.py index 3017fbb..413e4a4 100644 --- a/Weed/config.py +++ b/Weed/config.py @@ -1,8 +1,31 @@ ### -# Copyright (c) 2019, oddluck +# Copyright (c) 2013, spline +# Copyright (c) 2020, oddluck # 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 diff --git a/Weed/plugin.py b/Weed/plugin.py index 4b146bf..3273a51 100644 --- a/Weed/plugin.py +++ b/Weed/plugin.py @@ -1,8 +1,30 @@ ### -# Copyright (c) 2019 oddluck +# Copyright (c) 2020, oddluck # 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.utils as utils diff --git a/Weed/test.py b/Weed/test.py deleted file mode 100644 index 7581c07..0000000 --- a/Weed/test.py +++ /dev/null @@ -1,16 +0,0 @@ -### -# Copyright (c) 2019, oddluck -# All rights reserved. -# -# -### - -from supybot.test import * - - -class WeedTestCase(PluginTestCase): - plugins = ('Weed',) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: - diff --git a/WolframAlpha/.travis.yml b/WolframAlpha/.travis.yml deleted file mode 100644 index d5cb448..0000000 --- a/WolframAlpha/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: python -python: - - "2.7" - - "3.4" - - "pypy" -# command to install dependencies, -install: - - pip install -vr requirements.txt||true -# command to run tests, e.g. python setup.py test -script: - - echo $TRAVIS_PYTHON_VERSION - - cd .. && supybot-test WolframAlpha -notifications: - email: false - irc: "irc.efnet.net#supybot" - webhooks: http://n.tkte.ch/h/3527/rm2ycnsYzBtH8Qqg2AAmqjTM -matrix: - fast_finish: true diff --git a/WolframAlpha/__init__.py b/WolframAlpha/__init__.py index f47a56e..221fdb4 100644 --- a/WolframAlpha/__init__.py +++ b/WolframAlpha/__init__.py @@ -1,14 +1,35 @@ ### -# Copyright (c) 2012-2014, spline -# Copyright (c) 2020, oddluck +# Copyright (c) 2014, spline +# Copyright (c) 2020, oddluck # 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. ### """ -Add a description of the plugin (to be presented to the user inside the wizard) -here. This should describe *what* the plugin does. +WolframAlpha: retrieve info from the Wolfram Alpha API """ import supybot @@ -17,7 +38,7 @@ import importlib # 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('reticulatingspline', 'spline', '') diff --git a/WolframAlpha/config.py b/WolframAlpha/config.py index 8bb899f..1394738 100644 --- a/WolframAlpha/config.py +++ b/WolframAlpha/config.py @@ -1,9 +1,31 @@ ### -# Copyright (c) 2012-2014, spline -# Copyright (c) 2020, oddluck +# Copyright (c) 2014, spline +# Copyright (c) 2020, oddluck # 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 diff --git a/WolframAlpha/plugin.py b/WolframAlpha/plugin.py index 451930b..b4c0f4f 100644 --- a/WolframAlpha/plugin.py +++ b/WolframAlpha/plugin.py @@ -1,10 +1,33 @@ ### -# Copyright (c) 2012-2014, spline -# Copyright (c) 2020, oddluck +# Copyright (c) 2014, spline +# Copyright (c) 2020, oddluck # 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. ### + # my libs from collections import defaultdict try: diff --git a/WolframAlpha/test.py b/WolframAlpha/test.py index d78db1b..a3c7a7a 100644 --- a/WolframAlpha/test.py +++ b/WolframAlpha/test.py @@ -1,9 +1,31 @@ ### -# Copyright (c) 2012-2014, spline -# Copyright (c) 2020, oddluck +# Copyright (c) 2014, spline +# Copyright (c) 2020, oddluck # 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 os diff --git a/WordGames/__init__.py b/WordGames/__init__.py index 640a88d..d8b2655 100644 --- a/WordGames/__init__.py +++ b/WordGames/__init__.py @@ -1,11 +1,19 @@ ### # Copyright (c) 2012, Mike Mueller +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # -# * Do whatever you want. +# * 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 @@ -18,11 +26,10 @@ # 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. - ### """ -Implements some word games. +WordGames: various word games """ import supybot @@ -31,7 +38,7 @@ import importlib # 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__ = "" +__version__ = "2020.02.24+git" # Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('Mike Mueller', 'mmueller', 'mike@subfocal.net') diff --git a/WordGames/config.py b/WordGames/config.py index ba9b9f2..9a65944 100644 --- a/WordGames/config.py +++ b/WordGames/config.py @@ -1,11 +1,19 @@ ### # Copyright (c) 2012, Mike Mueller +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # -# * Do whatever you want +# * 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 diff --git a/WordGames/plugin.py b/WordGames/plugin.py index 00c4300..219cfc4 100644 --- a/WordGames/plugin.py +++ b/WordGames/plugin.py @@ -1,11 +1,19 @@ ### -# Copyright (c) 2012, Mike Mueller +# Copyright (c) 2012, Mike Mueller +# Copyright (c) 2020, oddluck # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # -# * Do whatever you want +# * 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 diff --git a/WordGames/test.py b/WordGames/test.py deleted file mode 100644 index 5510c2d..0000000 --- a/WordGames/test.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2012, Mike Mueller -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Do whatever you want. -# -# 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 WordgamesTestCase(PluginTestCase): - plugins = ('Wordgames',) - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/WordGames/trie.py b/WordGames/trie.py index 770a3a5..800fdd2 100644 --- a/WordGames/trie.py +++ b/WordGames/trie.py @@ -1,4 +1,32 @@ -#!/usr/bin/env python +### +# Copyright (c) 2012, Mike Mueller +# Copyright (c) 2020, oddluck +# 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. +### """ Quick & dirty prefix tree (aka trie). diff --git a/WorldTime/__init__.py b/WorldTime/__init__.py index d2c7762..6fdbe34 100644 --- a/WorldTime/__init__.py +++ b/WorldTime/__init__.py @@ -1,13 +1,35 @@ ### # Copyright (c) 2014, spline +# Copyright (c) 2020, oddluck # 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. ### """ -Add a description of the plugin (to be presented to the user inside the wizard) -here. This should describe *what* the plugin does. +WorldTime: look up current time and timezone info for various locations """ import supybot @@ -16,7 +38,7 @@ import importlib # 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__ = "" +__version__ = "2020.02.24+git" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.Author('reticulatingspline', 'spline', '') diff --git a/WorldTime/config.py b/WorldTime/config.py index 77cacba..291135d 100644 --- a/WorldTime/config.py +++ b/WorldTime/config.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2014, spline +# Copyright (c) 2020, oddluck # 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 diff --git a/WorldTime/plugin.py b/WorldTime/plugin.py index 197feb6..df1720c 100644 --- a/WorldTime/plugin.py +++ b/WorldTime/plugin.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2014, spline +# Copyright (c) 2020, oddluck # 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. ### # my libs diff --git a/WorldTime/test.py b/WorldTime/test.py index 76c9e1f..e64f323 100644 --- a/WorldTime/test.py +++ b/WorldTime/test.py @@ -1,8 +1,31 @@ ### # Copyright (c) 2014, spline +# Copyright (c) 2020, oddluck # 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 *