40 lines
762 B
Python
40 lines
762 B
Python
# Basic plugin class
|
|
|
|
__author__="bjschuma"
|
|
__date__ ="$Jan 23, 2010 2:46:07 PM$"
|
|
|
|
|
|
from bt import plugin
|
|
from bt.message import write
|
|
from bt.file import *
|
|
from session import settings
|
|
from session import alias
|
|
|
|
|
|
class Plugin(plugin.Plugin):
|
|
def __init__(self):
|
|
plugin.Plugin.__init__(self)
|
|
self.help = "Used to create aliases to shorten commands"
|
|
self.usage = "alias [list, new old]"
|
|
|
|
|
|
def run(self, args=None):
|
|
if args==None or len(args)<1:
|
|
write("Usage: "+self.usage)
|
|
return
|
|
|
|
if len(args)==1 and args[0]=="list":
|
|
for key in alias.keys():
|
|
write(key + " = " + str(alias[key]))
|
|
return
|
|
|
|
sp = ' '
|
|
line = sp.join(args)
|
|
(key,cmd) = line.split('=',1)
|
|
key = key.split()[0]
|
|
alias[key] = cmd
|
|
#alias.register(args[0],args[1:])
|
|
|
|
|
|
|