Skip to content
This repository has been archived by the owner on Jun 10, 2023. It is now read-only.

Commit

Permalink
some plugin fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
spookybear0 committed Oct 2, 2020
1 parent 7eb7a87 commit e776fec
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions gdpys/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,25 @@ class Plugin:
def __init__(self):
"""Start main loop"""
depend_check = []
for p in self.dependencies:
for f in os.listdir(os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + "/plugins"):
f = f.strip(".py")
if p == f:
depend_check.append(p)
if depend_check != self.dependencies:
print(f"Dependencies could not be found for \"{self.__class__}\".")
try:
for p in self.dependencies:
for f in os.listdir(os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + "/plugins"):
f = f.strip(".py")
if p == f:
depend_check.append(p)
if depend_check != self.dependencies:
print(f"Dependencies could not be found for \"{self.__class__}\".")
except AttributeError:
print("Dependencies is disabled for " + str(self.__class__))
self.stopped = False
loop = asyncio.new_event_loop()
configpath = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + "/plugins/config"
self.config = json.load(open(configpath + "/" + self.name + "/config.json", "r"))
try:
self.config = json.load(open(configpath + "/" + self.name + "/config.json", "r"))
except AttributeError:
print("Warning: Config is disabled for " + str(self.__class__))
except FileNotFoundError:
print("Warning: Config is disabled for " + str(self.__class__))
if self.metadata == False:
print(f"Warning: Plugin {self.__class__} has invalid metadata!")
while True:
Expand All @@ -30,6 +38,7 @@ def create_config(self, template):
return
if self.metadata == False:
print("Warning: Config could not be created due to insufficent metadata.")
return
if not os.path.exists(configpath):
os.mkdir(configpath)
if not os.path.exists(configpath + "/" + self.name):
Expand Down

0 comments on commit e776fec

Please sign in to comment.