34 lines
680 B
Python
34 lines
680 B
Python
# -*- coding: utf-8 -*-
|
|
from irc3 import IrcBot
|
|
from irc3.plugins.command import Commands
|
|
|
|
MODULE = __name__
|
|
|
|
|
|
class BasePlugin(object):
|
|
def __init__(self, bot: IrcBot):
|
|
self.bot = bot
|
|
self.log = bot.log
|
|
self.guard = bot.get_plugin(Commands).guard
|
|
|
|
|
|
class Plugin(BasePlugin):
|
|
@classmethod
|
|
def reload(cls, old: BasePlugin):
|
|
return cls(old.bot)
|
|
|
|
|
|
class DatabasePlugin(Plugin):
|
|
# @property
|
|
# def con(self):
|
|
# return self.bot.con
|
|
#
|
|
# @property
|
|
# def cur(self):
|
|
# return self.bot.cur
|
|
|
|
def __init__(self, bot):
|
|
super().__init__(bot)
|
|
self.con = bot.con.db
|
|
self.cur = bot.con.cur
|