Example #1
0
 def __init__(self, bot):
     self.bot = bot
     self.bot.http.firestatus = HTTPClient(
         'https://status.gaminggeek.dev/api/v2')
     if not self.bot.dev:
         self.bot.http.statuspage = HTTPClient(
             'https://api.statuspage.io/v1',
             headers={'Authorization': self.bot.config['statuspage']})
         self.last_log = None
         self.check_ping.start()
Example #2
0
 def __init__(self, bot):
     self.bot = bot
     self.http = HTTPClient('https://discord.boats/api/v2',
                            user_agent=f'Fire Discord Bot',
                            headers={
                                'Authorization': bot.config['dboats'],
                                'content-type': 'application/json'
                            })
Example #3
0
 def __init__(self, bot):
     self.bot = bot
     self.bot.http.invwtf = HTTPClient(
         'https://inv.wtf' if not self.bot.dev else 'https://test.inv.wtf',
         user_agent=f'Fire Discord Bot',
         headers={'Authorization': self.bot.config['vanityauth']})
     self.bot.get_vanity = self.get_vanity
     if 'slack_messages' not in dir(self.bot):
         self.bot.slack_messages = {}
Example #4
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.launchtime = datetime.datetime.now(datetime.timezone.utc)
        self.started = False

        # COMMON ATTRIBUTES
        self.config: dict = json.load(open('config.json', 'r'))
        self.configs: typing.Dict[int, typing.Union[GuildConfig,
                                                    UserConfig]] = {}
        self.tips = json.load(open('tips.json', 'r'))
        self.premium_guilds = {}
        self.paginators = {}
        self.db: asyncpg.pool.Pool = None
        self.dev = kwargs.pop('dev', False)

        # CRAB
        self.crab = '🦀'

        # LOGGING
        logging.basicConfig(filename='fire.log', level=logging.INFO)
        self.logger = logging.getLogger('Fire')
        stdout = logging.StreamHandler(sys.stdout)
        stdout.setLevel(logging.INFO)
        COLOR_FORMAT = colorformat.formatter_message(
            "[$BOLD%(name)s$RESET][%(levelname)s] %(message)s $RESET($BOLD%(filename)s$RESET:%(lineno)d)"
        )
        stdout.setFormatter(colorformat.ColoredFormatter(COLOR_FORMAT))
        self.logger.addHandler(stdout)
        gateway = logging.getLogger('discord.gateway')
        gateway.addHandler(stdout)

        # SENTRY
        if 'sentry' in self.config:
            sentry_sdk.init(self.config['sentry'])

        # REDIS
        self.redis = None
        if 'redis' in self.config:
            self.loop.create_task(self.init_redis())

        # GLOBAL HTTP CLIENTS
        self.http.mojang = HTTPClient('https://api.mojang.com')
        self.http.hypixel = HTTPClient(
            'https://api.hypixel.net',
            params={'key': self.config["hypixel"][0]})
        self.http.sk1er = HTTPClient('https://api.sk1er.club',
                                     user_agent='Fire Discord Bot')
        self.http.modcore = HTTPClient('https://api.modcore.sk1er.club',
                                       user_agent='Fire Discord Bot')
        self.http.github = HTTPClient('https://api.github.com')
        self.http.youtube = HTTPClient('https://www.googleapis.com/youtube/v3',
                                       params={'key': self.config['youtube']})

        # HASTEBIN
        self.http.hst = HTTPClient(
            'https://hst.sh',
            user_agent='Fire Discord Bot',
        )
        self.http.hinvwtf = HTTPClient('https://h.inv.wtf',
                                       user_agent='Fire Discord Bot')

        # MODULES
        self.load_modules()

        # COMMANDS
        self.load_commands()
        self.cmdresp = {}

        # EVENTS
        self.load_events()

        # BLACKLIST
        self.loop.create_task(self.load_plonked())
Example #5
0
 def __init__(self, bot):
     self.bot = bot
     self.bot.http.dscstatus = HTTPClient(
         'https://status.discord.com/api/v2',
         user_agent='Fire Discord Bot'
     )
Example #6
0
 def __init__(self, bot):
     self.bot = bot
     self.bot.http.firestatus = HTTPClient(
         'https://status.gaminggeek.dev/api/v2')
Example #7
0
 def __init__(self, bot):
     self.bot = bot
     self.bot.http.cfstatus = HTTPClient(
         'https://cloudflarestatus.com/api/v2',
         user_agent='Fire Discord Bot')
Example #8
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.launchtime = datetime.datetime.utcnow()

        # COMMON ATTRIBUTES
        self.config: dict = json.load(open('config.json', 'r'))
        self.configs = {}
        self.overrides: dict = json.load(open('overrides.json', 'r'))
        self.override_save.start()
        self.tips = json.load(open('tips.json', 'r'))
        self.premiumGuilds = []
        self.db: asyncpg.pool.Pool = None
        self.realtime_members = True
        self.dev = kwargs.pop('dev', False)

        # CRAB
        self.crab = '🦀'

        # LOGGING
        logging.basicConfig(filename='bot.log', level=logging.INFO)
        self.logger = logging.getLogger('Fire')
        stdout = logging.StreamHandler(sys.stdout)
        stdout.setLevel(logging.INFO)
        COLOR_FORMAT = colorformat.formatter_message(
            "[$BOLD%(name)s$RESET][%(levelname)s] %(message)s $RESET($BOLD%(filename)s$RESET:%(lineno)d)"
        )
        stdout.setFormatter(colorformat.ColoredFormatter(COLOR_FORMAT))
        self.logger.addHandler(stdout)

        # SENTRY
        if 'sentry' in self.config:
            sentry_sdk.init(self.config['sentry'])

        # INFLUX
        if 'influx_user' in self.config and 'influx_pass' in self.config:
            self.influx = InfluxDBClient(db='firedev' if self.dev else 'fire',
                                         username=self.config['influx_user'],
                                         password=self.config['influx_pass'])

        # GLOBAL HTTP CLIENTS
        self.http.mojang = HTTPClient('https://api.mojang.com')
        self.http.hypixel = HTTPClient('https://api.hypixel.net',
                                       params={'key': self.config["hypixel"]})
        self.http.sk1er = HTTPClient('https://api.sk1er.club',
                                     user_agent='Fire Discord Bot')
        self.http.modcore = HTTPClient('https://api.modcore.sk1er.club',
                                       user_agent='Fire Discord Bot')
        self.http.github = HTTPClient('https://api.github.com')

        # HASTEBIN
        self.http.hst = HTTPClient(
            'https://hst.sh',
            user_agent='Fire Discord Bot',
        )
        self.http.hinvwtf = HTTPClient('https://h.inv.wtf',
                                       user_agent='Fire Discord Bot')

        # MODULES
        self.load_modules()

        # COMMANDS
        self.load_commands()
        self.cmdresp = {}

        # EVENTS
        self.load_events()
Example #9
0
 def __init__(self, bot):
     self.bot = bot
     self.bot.http.ghstatus = HTTPClient(
         'https://www.githubstatus.com/api/v2',
         user_agent='Fire Discord Bot')