Import cleanup
This commit is contained in:
parent
c1ddb10e06
commit
db8b0a4d4c
@ -2,7 +2,6 @@
|
||||
import irc3
|
||||
|
||||
from docopt import Dict as DocoptDict
|
||||
from irc3 import IrcBot
|
||||
from irc3.plugins.command import command
|
||||
from irc3.utils import IrcString
|
||||
|
||||
@ -10,7 +9,8 @@ from . import MODULE, Plugin
|
||||
|
||||
|
||||
@command(permission='admin', show_in_help_list=False)
|
||||
def reload(bot: IrcBot, mask: IrcString, channel: IrcString, args: DocoptDict):
|
||||
def reload(bot: irc3.IrcBot, mask: IrcString, channel: IrcString,
|
||||
args: DocoptDict):
|
||||
"""Reloads a plugin or the whole bot
|
||||
|
||||
%%reload [<plugin>]
|
||||
|
@ -2,14 +2,12 @@
|
||||
import sqlite3
|
||||
import irc3
|
||||
|
||||
from irc3 import IrcBot
|
||||
|
||||
from . import Plugin
|
||||
|
||||
|
||||
@irc3.plugin
|
||||
class Database(Plugin):
|
||||
def __init__(self, bot: IrcBot):
|
||||
def __init__(self, bot: irc3.IrcBot):
|
||||
super().__init__(bot)
|
||||
file = bot.config.storage.split('sqlite://', 1)[1]
|
||||
if not file:
|
||||
|
@ -2,7 +2,7 @@
|
||||
from docopt import Dict as DocOptDict
|
||||
from irc3.plugins.command import command
|
||||
from irc3.utils import IrcString
|
||||
from irc3 import event
|
||||
import irc3
|
||||
|
||||
from . import DatabasePlugin
|
||||
from ..utils import parse_int
|
||||
@ -40,10 +40,9 @@ class McManiac(DatabasePlugin):
|
||||
if result:
|
||||
return '[{idx}/{len}] {item}'.format(**result)
|
||||
|
||||
@event(r'(?i)^:(?P<mask>\S+) PRIVMSG \S+ :(?P<msg>.*(?P<item>Mc\S+iaC).*)')
|
||||
def check(self, mask: str, msg: str, item: str):
|
||||
@irc3.event(r'(?i)^:(?P<mask>\S+) PRIVMSG \S+ :(?P<msg>.*(?P<item>Mc\S+iaC).*)')
|
||||
def save(self, mask: str, msg: str, item: str):
|
||||
nick = IrcString(mask).nick
|
||||
if nick != self.bot.nick and msg != '.reload mcmaniac':
|
||||
self.cur.execute('insert into mcmaniacs (item) values (?)', [item])
|
||||
self.con.commit()
|
||||
self.bot.notice(nick, '[McManiac] added "{}"'.format(item))
|
||||
|
@ -2,7 +2,6 @@
|
||||
from docopt import Dict as DocOptDict
|
||||
from irc3.plugins.command import command
|
||||
from irc3.utils import IrcString
|
||||
from irc3 import IrcBot, event
|
||||
import irc3
|
||||
|
||||
from . import DatabasePlugin
|
||||
@ -13,7 +12,7 @@ class Tell(DatabasePlugin):
|
||||
requires = ['irc3.plugins.command',
|
||||
'nxy.plugins.database']
|
||||
|
||||
def __init__(self, bot: IrcBot):
|
||||
def __init__(self, bot: irc3.IrcBot):
|
||||
super().__init__(bot)
|
||||
self.tell_queue = {}
|
||||
# Restore tells from database
|
||||
@ -39,7 +38,7 @@ class Tell(DatabasePlugin):
|
||||
'values (?, ?, ?)', tell)
|
||||
self.con.commit()
|
||||
|
||||
@event(r'(?i)^:(?P<mask>.*) PRIVMSG .* :.*')
|
||||
@irc3.event(r'(?i)^:(?P<mask>.*) PRIVMSG .* :.*')
|
||||
def check(self, mask: str):
|
||||
"""If activ user has tells, forward and delete them."""
|
||||
nick = IrcString(mask).nick
|
||||
|
@ -3,7 +3,6 @@ import irc3
|
||||
import random
|
||||
|
||||
from docopt import Dict as DocOptDict
|
||||
from irc3.dec import event
|
||||
from irc3.plugins.command import command
|
||||
from irc3.utils import IrcString
|
||||
|
||||
@ -26,21 +25,21 @@ GNU_LINUX = """I'd Just Like To Interject For A Moment. What you're referring
|
||||
class Useless(Plugin):
|
||||
requires = ['irc3.plugins.command']
|
||||
|
||||
@event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :'
|
||||
r'.*(?<!gnu[/+])linux(?! kernel).*')
|
||||
@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)
|
||||
|
||||
@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):
|
||||
self.bot.privmsg(channel, msg)
|
||||
|
||||
@event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :same$')
|
||||
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :same$')
|
||||
def same(self, channel: str):
|
||||
self.bot.privmsg(channel, 'same')
|
||||
|
||||
@event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :\[(?P<data>.*)\]$')
|
||||
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :\[(?P<data>.*)\]$')
|
||||
def intensifies(self, channel: str, data: str):
|
||||
self.bot.privmsg(channel, fmt('{bold}[{data} INTENSIFIES]',
|
||||
data=data.upper()))
|
||||
|
Loading…
Reference in New Issue
Block a user