Skip to content

Commit efbd6ff

Browse files
committed
Update startup function for bot
1 parent 3954b6d commit efbd6ff

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/bot/main.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ async def on_ready():
6161
await bot.change_presence(
6262
activity=discord.Activity(type=discord.ActivityType.watching, name=f"{PREFIX}help"))
6363

64-
65-
if __name__ == '__main__':
6664
# LOADING Extensions
6765
bot.remove_command('help') # unload default help message
6866
initial_extensions = [
@@ -74,4 +72,11 @@ async def on_ready():
7472
bot.load_extension(extension, package=__package__)
7573

7674

77-
bot.run(TOKEN)
75+
def start_bot(token=None):
76+
""" Start the bot, takes token, uses token from env if none is given """
77+
if token is not None:
78+
bot.run(token)
79+
if TOKEN is not None:
80+
bot.run(TOKEN)
81+
else:
82+
logger.error("No token was given! - Exiting")

0 commit comments

Comments
 (0)