43 lines
786 B
Python
43 lines
786 B
Python
# Basic plugin class
|
|
|
|
__author__="bjschuma"
|
|
__date__ ="$Feb 8, 2010 10:00:40 AM$"
|
|
|
|
|
|
from bt import plugin
|
|
from bt.message import write
|
|
import settings
|
|
from bt import signal
|
|
|
|
|
|
class Plugin(plugin.Plugin):
|
|
def __init__(self):
|
|
plugin.Plugin.__init__(self)
|
|
self.help = ""
|
|
|
|
|
|
def open(self):
|
|
if settings.has("random") == False:
|
|
settings.set("random",False)
|
|
elif settings.get("random") == True:
|
|
signal.register("next",self.randNext,90)
|
|
pass
|
|
|
|
|
|
def randNext(self):
|
|
pass
|
|
|
|
|
|
def run(self, args=None):
|
|
if args==None or len(args)==0:
|
|
rand = not settings.get("random")
|
|
settings.set("random",rand)
|
|
if rand == True:
|
|
signal.register("next",self.randNext,90)
|
|
else:
|
|
signal.remove("next",self.randNext)
|
|
|
|
elif args[0] == "?":
|
|
write(settings.get("random"))
|
|
|