Made it work

Updated console output
Improved checks for config file
This commit is contained in:
Logan Cusano
2021-12-10 03:03:26 -05:00
parent 72ccb1f737
commit c19ebbf38c
4 changed files with 33 additions and 25 deletions

16
bot.py
View File

@@ -7,14 +7,14 @@ from main import write_config_file
class Bot(commands.Bot):
def __init__(self, **kwargs): # bot_token, device_id, device_name, command_prefix='>!'):
if not kwargs['command_prefix']:
if 'command_prefix' not in kwargs.keys():
kwargs['command_prefix'] = '>!'
commands.Bot.__init__(self, command_prefix=commands.when_mentioned_or(kwargs['command_prefix']))
self.DEVICE_ID = int(kwargs['Device_ID'])
self.DEVICE_NAME = str(kwargs['Device_Name'])
self.BOT_TOKEN = str(kwargs['Token'])
self.Default_Channel_ID = int(kwargs['Channel_ID'])
self.Default_Mention_Group = str(kwargs['Mention_Group'])
self.DEVICE_ID = kwargs['Device_ID']
self.DEVICE_NAME = kwargs['Device_Name']
self.BOT_TOKEN = kwargs['Token']
self.Default_Channel_ID = kwargs['Channel_ID']
self.Default_Mention_Group = kwargs['Mention_Group']
self.Devices_List = sound.query_devices().items()
self.add_commands()
@@ -67,6 +67,8 @@ class Bot(commands.Bot):
def check_for_modules(self):
for folder_name in os.listdir("modules"):
if os.path.exists(os.path.join("modules", folder_name, "cog.py")):
if str(folder_name)[0] == '.':
continue
elif os.path.exists(os.path.join("modules", folder_name, "cog.py")):
print(f"Loaded extension: {folder_name}")
self.load_extension(f"modules.{folder_name}.cog")