From a0cb64789b2571e44c223b2a0257c1102d643f72 Mon Sep 17 00:00:00 2001 From: Abigail Gold <5366828+classabbyamp@users.noreply.github.com> Date: Tue, 8 Oct 2019 23:02:57 -0400 Subject: [PATCH] Move cogs to load to options.py (#33) * list of cogs in options.py instead of hardcoded. * moved the playing status to options.py * add all cogs to the template --- main.py | 11 +++-------- templates/template_options.py | 7 +++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/main.py b/main.py index a715063..e9177b7 100644 --- a/main.py +++ b/main.py @@ -99,7 +99,7 @@ async def on_ready(): @tasks.loop(minutes=5) async def _ensure_activity(): - await bot.change_presence(activity=discord.Game(name="with lids on 7.200")) + await bot.change_presence(activity=discord.Game(name=opt.game)) @_ensure_activity.before_loop @@ -110,13 +110,8 @@ async def _before_ensure_activity(): # --- Run --- bot.add_cog(GlobalSettings(bot)) -bot.load_extension("cogs.basecog") -bot.load_extension("cogs.morsecog") -bot.load_extension("cogs.funcog") -bot.load_extension("cogs.gridcog") -bot.load_extension("cogs.hamcog") -bot.load_extension("cogs.imagecog") -bot.load_extension("cogs.studycog") +for cog in opt.cogs: + bot.load_extension(f"cogs.{cog}") _ensure_activity.start() diff --git a/templates/template_options.py b/templates/template_options.py index acf65bc..549f4b4 100644 --- a/templates/template_options.py +++ b/templates/template_options.py @@ -24,3 +24,10 @@ debug = False # * Those users will have full control over the bot. # ! This MUST be a tuple of integers. Single element tuple: `(123,)` owners_uids = (200102491231092736,) + +# The cogs to load when running the bot. +cogs = ['basecog', 'morsecog', 'funcog', 'gridcog', 'hamcog', 'imagecog', + 'studycog'] + +# The text to put in the "playing" status. +game = 'with lids on 7.200'