Add if __name__ == "__main__"
This commit is contained in:
parent
bf82306cf0
commit
406556e8cf
16
src/bot.py
16
src/bot.py
|
@ -82,19 +82,19 @@ class Music(commands.Cog):
|
||||||
ctx.voice_client.stop()
|
ctx.voice_client.stop()
|
||||||
|
|
||||||
|
|
||||||
bot = commands.Bot(command_prefix=commands.when_mentioned_or("!"), description='Relatively simple music bot example')
|
if __name__ == "__main__":
|
||||||
|
bot = commands.Bot(command_prefix=commands.when_mentioned_or("!"), description='Relatively simple music bot example')
|
||||||
|
|
||||||
|
@bot.event
|
||||||
@bot.event
|
async def on_ready():
|
||||||
async def on_ready():
|
|
||||||
print(f"Logged in as {bot.user} ({bot.user.id})")
|
print(f"Logged in as {bot.user} ({bot.user.id})")
|
||||||
print('------')
|
print('------')
|
||||||
|
|
||||||
bot.add_cog(Music(bot))
|
bot.add_cog(Music(bot))
|
||||||
|
|
||||||
token = os.environ.get("BOT_TOKEN", None)
|
token = os.environ.get("BOT_TOKEN", None)
|
||||||
if not token:
|
if not token:
|
||||||
print("No token fouund in BOT_TOKEN")
|
print("No token fouund in BOT_TOKEN")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
bot.run(token)
|
bot.run(token)
|
||||||
|
|
Loading…
Reference in New Issue