Initial: Add basic main discord.py bot file

This only connects to the discord application and does nothing yet.
Access the token through a hidden environment file.
Set the command prefix to '$b '.
This commit is contained in:
Bibin Muttappillil 2020-12-27 19:00:50 +01:00
parent 519f72d720
commit 49a407a29d
1 changed files with 28 additions and 0 deletions

28
src/bot.py Normal file
View File

@ -0,0 +1,28 @@
"""
This is the main module of the Discord Bot
Mainly loads the Cog's and starts the bot
"""
__version__ = '0.5'
__author__ = 'Bibin Muttappillil'
# standard library imports
import os
from dotenv import load_dotenv
# discord imports
from discord.ext import commands
# Token stuff
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
if TOKEN is None:
print("Missing discord token!")
exit(1)
bot = commands.Bot(command_prefix=commands.when_mentioned_or('$b '))
bot.run(TOKEN)