Renamed kernel plugin and moved gnu/linux trigger there

This commit is contained in:
mrhanky 2017-05-29 23:32:45 +02:00
parent 84d0a30a52
commit 83e3876b06
No known key found for this signature in database
GPG Key ID: 67D772C481CB41B8
3 changed files with 18 additions and 14 deletions

View File

@ -14,7 +14,7 @@
"nxy.plugins.admin", "nxy.plugins.admin",
"nxy.plugins.bitcoin", "nxy.plugins.bitcoin",
"nxy.plugins.ctcp", "nxy.plugins.ctcp",
"nxy.plugins.kernel", "nxy.plugins.linux",
"nxy.plugins.mcmaniac", "nxy.plugins.mcmaniac",
"nxy.plugins.quotes", "nxy.plugins.quotes",
"nxy.plugins.seen", "nxy.plugins.seen",

View File

@ -1,15 +1,32 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import random
import irc3
import feedparser import feedparser
from docopt import Dict as DocOptDict from docopt import Dict as DocOptDict
from irc3.plugins.command import command from irc3.plugins.command import command
from irc3.utils import IrcString from irc3.utils import IrcString
from . import Plugin from . import Plugin
GNU_LINUX = """I'd Just Like To Interject For A Moment. What you're referring
to as Linux, is in fact, GNU/Linux, or as I've recently taken to calling it,
GNU plus Linux. Linux is not an operating system unto itself, but rather
another free component of a fully functioning GNU system made useful by the
GNU corelibs, shell utilities and vital system components comprising a full
OS as defined by POSIX."""
class Kernel(Plugin): class Kernel(Plugin):
URL = 'https://www.kernel.org/feeds/kdist.xml' URL = 'https://www.kernel.org/feeds/kdist.xml'
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :'
r'.*(?<!gnu[/+])linux(?! kernel).*')
def linux(self, channel: str):
if random.randint(0, 3) is 0:
self.bot.privmsg(channel, GNU_LINUX)
@command @command
def kernel(self, mask: IrcString, channel: IrcString, args: DocOptDict): def kernel(self, mask: IrcString, channel: IrcString, args: DocOptDict):
"""Get Linux kernel releases. """Get Linux kernel releases.

View File

@ -11,24 +11,11 @@ from . import Plugin
RAINBOW = (5, 3, 7, 8, 9, 3, 10, 12, 2, 6, 13) RAINBOW = (5, 3, 7, 8, 9, 3, 10, 12, 2, 6, 13)
RAINBOW_LEN = len(RAINBOW) RAINBOW_LEN = len(RAINBOW)
GNU_LINUX = """I'd Just Like To Interject For A Moment. What you're referring
to as Linux, is in fact, GNU/Linux, or as I've recently taken to calling it,
GNU plus Linux. Linux is not an operating system unto itself, but rather
another free component of a fully functioning GNU system made useful by the
GNU corelibs, shell utilities and vital system components comprising a full
OS as defined by POSIX."""
@irc3.plugin @irc3.plugin
class Useless(Plugin): class Useless(Plugin):
requires = ['irc3.plugins.command'] requires = ['irc3.plugins.command']
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :'
r'.*(?<!gnu[/+])linux(?! kernel).*')
def linux(self, channel: str):
if random.randint(0, 4) is 0:
self.bot.privmsg(channel, GNU_LINUX)
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :(?P<msg>huehuehue)$') @irc3.event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :(?P<msg>huehuehue)$')
def huehuehue(self, channel: str, msg: str): def huehuehue(self, channel: str, msg: str):
self.bot.privmsg(channel, msg) self.bot.privmsg(channel, msg)