How to use the cogs.utils.dataIO.dataIO.load_json function in Cogs

To help you get started, we’ve selected a few Cogs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PlanetTeamSpeakk / PTSCogs / giveme / giveme.py View on Github external
def __init__(self, bot):
        self.bot = bot
        self.settings = dataIO.load_json("data/giveme/settings.json")
github Cog-Creators / Red-DiscordBot / red.py View on Github external
passed as arguments.
            """
            return bot.settings.get_prefixes(message.server)

        self.counter = Counter()
        self.uptime = datetime.datetime.utcnow()  # Refreshed before login
        self._message_modifiers = []
        self.settings = Settings()
        self._intro_displayed = False
        self._shutdown_mode = None
        self.logger = set_logger(self)
        self._last_exception = None
        self.oauth_url = ""

        try:
            self._cog_registry = dataIO.load_json("data/red/cogs.json")
        except Exception:
            self._cog_registry = {}

        if 'self_bot' in kwargs:
            self.settings.self_bot = kwargs['self_bot']
        else:
            kwargs['self_bot'] = self.settings.self_bot
            if self.settings.self_bot:
                kwargs['pm_help'] = False
        super().__init__(*args, command_prefix=prefix_manager, **kwargs)
github Cog-Creators / Red-DiscordBot / cogs / owner.py View on Github external
def _import_old_data(data):
    """Migration from mod.py"""
    try:
        data["blacklist"] = dataIO.load_json("data/mod/blacklist.json")
    except FileNotFoundError:
        pass

    try:
        data["whitelist"] = dataIO.load_json("data/mod/whitelist.json")
    except FileNotFoundError:
        pass

    return data
github PlanetTeamSpeakk / PTSCogs / giveaways / giveaways.py View on Github external
def __init__(self, bot):
        self.bot = bot
        self.settings = dataIO.load_json("data/giveaways/settings.json")
        self.started = False
github devakira / NanoBot / cogs / audio.py View on Github external
def _load_playlist(self, server, name, local=True):
        try:
            server = server.id
        except:
            pass

        f = "data/audio/playlists"
        if local:
            f = os.path.join(f, server, name + ".txt")
        else:
            f = os.path.join(f, name + ".txt")
        kwargs = dataIO.load_json(f)

        kwargs['path'] = f
        kwargs['main_class'] = self
        kwargs['name'] = name
        kwargs['sid'] = server
        kwargs['server'] = self.bot.get_server(server)

        return Playlist(**kwargs)
github PlanetTeamSpeakk / PTSCogs / warner / warner.py View on Github external
def __init__(self, bot):
        self.bot = bot
        self.settings = dataIO.load_json("data/warner/warnings.json")
github Cog-Creators / Red-DiscordBot / cogs / downloader.py View on Github external
def get_info_data(self, repo_name, cog=None):
        if cog is not None:
            cogs = self.list_cogs(repo_name)
            if cog in cogs:
                info_file = os.path.join(cogs[cog].get('folder'), "info.json")
                if os.path.isfile(info_file):
                    try:
                        data = dataIO.load_json(info_file)
                    except:
                        return None
                    return data
        else:
            repo_info = os.path.join(self.path, repo_name, 'info.json')
            if os.path.isfile(repo_info):
                try:
                    data = dataIO.load_json(repo_info)
                    return data
                except:
                    return None
        return None
github Canule / Mash-Cogs / imdb / imdb.py View on Github external
def __init__(self, bot):
        self.bot = bot
        self.settings = dataIO.load_json(SETTINGS) 
        if self.settings["api_key"] == "":
            print("Cog error: imdb, No API key found, please configure me!")
github PlanetTeamSpeakk / PTSCogs / wot / wot.py View on Github external
def __init__(self, bot):
        self.bot = bot
        self.key = dataIO.load_json("data/wot/key.json")['key']
        self.servers = {'eu': 'eu', 'ru': 'ru', 'asia': 'asia', 'na': 'com', 'kr': 'kr'}