mirror of
https://github.com/hencaric/SCNewsBot.git
synced 2026-08-18 23:46:03 +01:00
initial commit
This commit is contained in:
26
scnewsbot/__main__.py
Normal file
26
scnewsbot/__main__.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import tomllib
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
from bot import Bot
|
||||
from utils import Config
|
||||
|
||||
|
||||
class InvalidTokenException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def main() -> None:
|
||||
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
|
||||
if not DISCORD_TOKEN:
|
||||
raise InvalidTokenException("A Discord token was not set.")
|
||||
|
||||
with open("config.toml", "rb") as config_file:
|
||||
config = Config(tomllib.load(config_file))
|
||||
|
||||
bot = Bot(config)
|
||||
bot.run(DISCORD_TOKEN)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
load_dotenv()
|
||||
main()
|
||||
Reference in New Issue
Block a user