def init_logger(self):
     """
     Initializes the core client Logger.
     :return:
     """
     self.log = create_logger('Sigma', shard=init_cfg.dsc.shard)
     self.log.info('Logger Created')
Beispiel #2
0
 def __init__(self, bot, command, plugin_info, command_info):
     self.bot = bot
     self.db = self.bot.db
     self.command = command
     self.plugin_info = plugin_info
     self.command_info = command_info
     self.name = self.command_info['name']
     self.path = self.command_info['path']
     self.category = self.plugin_info['category']
     self.log = create_logger(self.name.upper())
     self.nsfw = False
     self.cfg = {}
     self.cache = {}
     if self.bot.cfg.pref.raw.get('elastic'):
         self.stats = ElasticHandler(self.bot.cfg.pref.raw.get('elastic'),
                                     'sigma-command')
     else:
         self.stats = None
     self.owner = False
     self.partner = False
     self.dmable = False
     self.requirements = ['send_messages', 'embed_links']
     self.alts = []
     self.usage = '{pfx}{cmd}'
     self.desc = 'No description provided.'
     self.insert_command_info()
     self.load_command_config()
Beispiel #3
0
 def __init__(self):
     self.log = create_logger('Config')
     cli_cfg_path = 'config/core/discord.yml'
     db_cfg_path = 'config/core/database.yml'
     pref_cfg_path = 'config/core/preferences.yml'
     cache_cfg_path = 'config/core/cache.yml'
     if os.path.exists(cli_cfg_path):
         with open(cli_cfg_path, encoding='utf-8') as discord_config:
             self.client_cfg_data = yaml.safe_load(discord_config)
     else:
         self.log.warning('No discord configuration, using defaults.')
         self.client_cfg_data = {}
     if os.path.exists(db_cfg_path):
         with open(db_cfg_path, encoding='utf-8') as database_config:
             self.db_cfg_data = yaml.safe_load(database_config)
     else:
         self.log.warning('No database configuration, using defaults.')
         self.db_cfg_data = {}
     if os.path.exists(pref_cfg_path):
         with open(pref_cfg_path, encoding='utf-8') as preferences_config:
             self.pref_cfg_data = yaml.safe_load(preferences_config)
     else:
         self.log.warning('No preferences configuration, using defaults.')
         self.pref_cfg_data = {}
     if os.path.exists(cache_cfg_path):
         with open(cache_cfg_path, encoding='utf-8') as cache_config:
             self.cache_cfg_data = yaml.safe_load(cache_config)
     else:
         self.log.warning('No cache configuration, using defaults.')
         self.cache_cfg_data = {}
     self.dsc = DiscordConfig(self.client_cfg_data)
     self.db = DatabaseConfig(self.db_cfg_data)
     self.pref = PreferencesConfig(self.pref_cfg_data)
     self.cache = CacheConfig(self.cache_cfg_data)
Beispiel #4
0
 def __init__(self, bot, init):
     """
     :param bot: The core client class.
     :type bot: sigma.core.sigma.ApexSigma
     :param init: Is this the first module manager initialization.
     :type init: bool
     """
     self.bot = bot
     self.init = init
     self.log = create_logger('Module Manager',
                              shard=self.bot.cfg.dsc.shard)
     self.alts = {}
     self.commands = {}
     self.events = {}
     self.categories = []
     if self.init:
         self.log.info('Loading Commands')
     self.load_all_modules()
     if self.init:
         self.log.info(f'Loaded {len(self.commands)} Commands')
         for evkey in self.events:
             ev_count = len(self.events.get(evkey))
             end = 's' if ev_count != 1 else ''
             self.log.info(
                 f'Loaded {ev_count} {evkey.replace("_", " ").title()} Event{end}'
             )
         self.log.info('---------------------------------')
Beispiel #5
0
 def __init__(self, bot):
     self.bot = bot
     self.log = create_logger('Threader')
     self.loop = asyncio.get_event_loop()
     self.queue = asyncio.Queue()
     self.threads = ThreadPoolExecutor()
     self.loop.create_task(self.queue_loop())
Beispiel #6
0
 def __init__(self, bot, command, module_info, command_info):
     """
     :type bot: sigma.core.sigma.ApexSigma
     :type command: function
     :type module_info: dict
     :type command_info: dict
     """
     self.bot = bot
     self.db = self.bot.db
     self.cd = CommandRateLimiter(self)
     self.command = command
     self.module_info = module_info
     self.command_info = command_info
     self.name = self.command_info.get('name')
     self.path = self.command_info.get('path')
     self.category = self.module_info.get('category')
     self.subcategory = self.module_info.get('subcategory')
     self.log = create_logger(self.name.upper(),
                              shards=self.bot.cfg.dsc.shards)
     self.nsfw = False
     self.cfg = ModuleConfig(self)
     self.owner = False
     self.partner = False
     self.dmable = False
     self.requirements = ['send_messages', 'embed_links']
     self.alts = []
     self.usage = '{pfx}{cmd}'
     self.desc = 'No description provided.'
     self.insert_command_info()
     self.load_command_config()
Beispiel #7
0
 def init_logger():
     """
     Initializes the core client Logger.
     :rtype: sigma.core.mechanics.logger.Logger
     """
     logger = create_logger('Sigma', shards=init_cfg.dsc.shards)
     logger.info('Logger Created')
     return logger
Beispiel #8
0
 def __init__(self, bot):
     self.bot = bot
     self.log = create_logger('Threader')
     self.ev_queue = asyncio.Queue()
     self.cmd_queue = asyncio.Queue()
     self.bot.loop.create_task(self.queue_ev_loop())
     self.bot.loop.create_task(self.queue_cmd_loop())
     self.processed = 0
Beispiel #9
0
 def __init__(self, bot, event, plugin_info, event_info):
     self.bot = bot
     self.db = self.bot.db
     self.event = event
     self.plugin_info = plugin_info
     self.event_info = event_info
     self.event_type = self.event_info['type']
     self.name = self.event_info['name']
     self.category = self.plugin_info['category']
     self.log = create_logger(self.name.upper())
Beispiel #10
0
 def __init__(self, bot, init: bool):
     self.bot = bot
     self.init = init
     self.log = create_logger('Plugin Manager')
     self.alts = {}
     self.commands = {}
     self.events = {}
     self.categories = []
     if self.init:
         self.log.info('Loading Commands')
     self.load_all_modules()
     if self.init:
         self.log.info(f'Loaded {len(self.commands)} Commands')
         self.log.info('---------------------------------')
Beispiel #11
0
 def __init__(self, bot, event, plugin_info, event_info):
     self.bot = bot
     self.db = self.bot.db
     self.event = event
     self.event_type = event_info['type']
     self.plugin_info = plugin_info
     self.event_info = event_info
     self.name = self.event_info['name']
     self.log = create_logger(self.name.upper())
     self.rating = 0
     self.owner = False
     self.partner = False
     self.dmable = False
     self.requirements = None
     self.insert_command_info()
Beispiel #12
0
 def __init__(self, bot, init: bool):
     self.bot = bot
     self.init = init
     self.log = create_logger('Plugin Manager')
     self.alts = {}
     self.commands = {}
     self.events = {}
     self.categories = []
     if self.init:
         self.log.info('Loading Commands')
     self.load_all_modules()
     if self.init:
         self.log.info(f'Loaded {len(self.commands)} Commands')
         for evkey in self.events:
             ev_count = len(self.events.get(evkey))
             end = 's' if ev_count != 1 else ''
             self.log.info(f'Loaded {ev_count} {evkey.replace("_", " ").title()} Event{end}')
         self.log.info('---------------------------------')
Beispiel #13
0
 def __init__(self, bot, event, module_info, event_info):
     """
     :type bot: sigma.core.sigma.ApexSigma
     :type event: function
     :type module_info: dict
     :type event_info: dict
     """
     self.bot = bot
     self.db = self.bot.db
     self.event = event
     self.module_info = module_info
     self.event_info = event_info
     self.path = self.event_info.get('path')
     self.event_type = self.event_info.get('type')
     self.name = self.event_info.get('name')
     self.category = self.module_info.get('category')
     self.subcategory = self.module_info.get('subcategory')
     self.log = create_logger(self.name.upper(), shards=self.bot.cfg.dsc.shards)
Beispiel #14
0
 def __init__(self, feh):
     self.feh = feh
     self.log = create_logger('FEH Scrapper')
     self.db = self.feh.db
     self.data_dir = self.feh.data_dir
     self.wiki_cache = self.db[self.db.db_cfg.database].FEHWikiCache
     self.feh_db = self.db[self.db.db_cfg.database].FEHData
     self.wiki_url = 'https://feheroes.gamepedia.com'
     self.no_cache = False
     self.skip_bio = False
     self.hero_data = None
     self.weapon_data = None
     self.assist_data = None
     self.special_data = None
     self.passive_data = None
     self.aliases = self.get_yaml_data(self.feh.data_dir + '/aliases.yml')
     self.growth = self.get_yaml_data(self.data_dir + '/growth.yml')
     self.queries = self.get_yaml_data(self.data_dir + '/queries.yml')
     self.scrappers = ScrapperContainer(self)
Beispiel #15
0
 def __init__(self, bot, command, plugin_info, command_info):
     self.bot = bot
     self.db = self.bot.db
     self.command = command
     self.plugin_info = plugin_info
     self.command_info = command_info
     self.name = self.command_info['name']
     self.path = self.command_info['path']
     self.category = self.plugin_info['category']
     self.log = create_logger(self.name.upper())
     self.rating = 0
     self.cfg = {}
     self.owner = False
     self.partner = False
     self.dmable = False
     self.requirements = ['send_messages', 'embed_links']
     self.alts = None
     self.usage = f'{bot.cfg.pref.prefix}{self.name}'
     self.desc = 'No description provided.'
     self.insert_command_info()
     self.load_command_config()
Beispiel #16
0
 def __init__(self, bot, event, module_info, event_info):
     """
     :param bot: The client core class instance.
     :type bot: sigma.core.sigma.ApexSigma
     :param event: The event function
     :type event: function
     :param module_info: Module details.
     :type module_info: dict
     :param event_info: Event details.
     :type event_info: dict
     """
     self.bot = bot
     self.db = self.bot.db
     self.event = event
     self.module_info = module_info
     self.event_info = event_info
     self.path = self.event_info.get('path')
     self.event_type = self.event_info.get('type')
     self.name = self.event_info.get('name')
     self.category = self.module_info.get('category')
     self.subcategory = self.module_info.get('subcategory')
     self.log = create_logger(self.name.upper(),
                              shard=self.bot.cfg.dsc.shard)
Beispiel #17
0
 def __init__(self, bot, command, plugin_info: dict, command_info: dict):
     self.bot = bot
     self.db: Database = self.bot.db
     self.cd = CommandRateLimiter(self)
     self.command = command
     self.plugin_info = plugin_info
     self.command_info = command_info
     self.name = self.command_info.get('name')
     self.path = self.command_info.get('path')
     self.category = self.plugin_info.get('category')
     self.subcategory = self.plugin_info.get('subcategory')
     self.log = create_logger(self.name.upper())
     self.nsfw = False
     self.cfg = {}
     self.cache = {}
     self.owner = False
     self.partner = False
     self.dmable = False
     self.requirements = ['send_messages', 'embed_links']
     self.alts = []
     self.usage = '{pfx}{cmd}'
     self.desc = 'No description provided.'
     self.insert_command_info()
     self.load_command_config()
Beispiel #18
0
 def init_logger(self):
     self.log = create_logger('Sigma')
     self.log.info('Logger Created')