<reponame>tunacado/valorant-lfg-bot<filename>valorant_discord_bot/bot.py
import discord
import logging
import os


class ValorantBot(discord.Client):

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.BOT_LOG = os.getenv('BOT_LOG')
        if self.BOT_LOG == 'INFO' or self.BOT_LOG is None or self.BOT_LOG == '':
            logging.getLogger().setLevel(logging.INFO)
        elif self.BOT_LOG == 'DEBUG':
            logging.getLogger().setLevel(logging.DEBUG)
        else:
            logging.fatal('Neither INFO nor DEBUG specified for log level, refusing to start.')

        self.BOT_TOKEN = os.getenv('BOT_TOKEN')
        logging.info("ValorantBot initialized.")

    def run(self, *args, **kwargs):
        if self.BOT_TOKEN is None or self.BOT_TOKEN == '':
            logging.fatal('Supply environment variable BOT_TOKEN to authenticate.')
        super().run(self.BOT_TOKEN)

    async def on_ready(self):
        logging.info(f'{self.user} has connected to server')

import discord
import logging
import os


class ValorantBot(discord.Client):

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.BOT_LOG = os.getenv('BOT_LOG')
        if self.BOT_LOG == 'INFO' or self.BOT_LOG is None or self.BOT_LOG == '':
            logging.getLogger().setLevel(logging.INFO)
        elif self.BOT_LOG == 'DEBUG':
            logging.getLogger().setLevel(logging.DEBUG)
        else:
            logging.fatal('Neither INFO nor DEBUG specified for log level, refusing to start.')

        self.BOT_TOKEN = os.getenv('BOT_TOKEN')
        logging.info("ValorantBot initialized.")

    def run(self, *args, **kwargs):
        if self.BOT_TOKEN is None or self.BOT_TOKEN == '':
            logging.fatal('Supply environment variable BOT_TOKEN to authenticate.')
        super().run(self.BOT_TOKEN)

    async def on_ready(self):
        logging.info(f'{self.user} has connected to server')