Created
June 3, 2015 20:57
-
-
Save JuanPotato/4966ca69677df7bdbf3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def loadPlugins(): | |
pluginFiles = ["plugins/" + f for f in listdir(curPath + "\plugins") if re.search('^.+\.py$', f)] | |
global plugins | |
plugins = [] | |
for file in pluginFiles: | |
values = {} | |
execfile(file, values) | |
plugin = values['plugin'] # get the variable "plugin" | |
print "Initializing plugin:", plugin['name'] | |
plugins.append(plugin) | |
#to get the function call plugin["function"]() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def function(): | |
return "1 + 1 = 2" | |
plugin = { | |
'name': "My calc", | |
'patterns': ["^/calc (.+)$"], | |
'function': function, | |
'elevated': False, | |
'usage' : "/calc <exp>", | |
'desc' : "calculator"} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment