Example #1
0
def check_files():

    f = "data/economy/settings.json"
    if not dataIO.is_valid_json(f):
        print("Creating default economy's settings.json...")
        dataIO.save_json(f, {})

    f = "data/economy/bank.json"
    if not dataIO.is_valid_json(f):
        print("Creating empty bank.json...")
        dataIO.save_json(f, {})
Example #2
0
def check_file():
    data = {}
    data['API_KEY'] = ''
    f = "data/goodreads/settings.json"
    if not dataIO.is_valid_json(f):
        dataIO.save_json(f, data)
        print("Creating default settings.json...")
Example #3
0
def check_file():
    weather = {}
    weather['WEATHER_API_KEY'] = False
    f = "data/weather/weather.json"
    if not dataIO.is_valid_json(f):
        print("Creating default weather.json...")
        dataIO.save_json(f, weather)
Example #4
0
def check_file():
    data = {}
    data['LASTFM_API_KEY'] = ''
    data['USERS'] = {}
    f = "data/lastfm/lastfm.json"
    if not dataIO.is_valid_json(f):
        print("Creating default lastfm.json...")
        dataIO.save_json(f, data)
Example #5
0
def check_files():
    if not dataIO.is_valid_json(JSON):
        defaults = {
            'everything': False,
            'attachments': False,
            'default': False
        }
        dataIO.save_json(JSON, defaults)
Example #6
0
def check_files():
    repos = \
        {'community': {'url': "https://github.com/Twentysix26/Red-Cogs.git"}}

    f = "data/downloader/repos.json"
    if not dataIO.is_valid_json(f):
        print("Creating default data/downloader/repos.json")
        dataIO.save_json(f, repos)
Example #7
0
def check_files():
    defaults = {
        'HOST': '127.0.0.1',
        'INTERVAL': 5
    }
    if not dataIO.is_valid_json(JSON):
        print("Creating empty %s" % JSON)
        dataIO.save_json(JSON, defaults)
Example #8
0
def check_file():
    data = {}
    data['applist'] = {}
    data['applist']['apps'] = {}
    data['applist']['apps']['app'] = []
    f = 'data/steam/games.json'
    if not dataIO.is_valid_json(f):
        print('Creating default games.json...')
        dataIO.save_json(f, data)
Example #9
0
def check_file():
    defaults = { "interval" : 60,
                 "topic_channel" : "226682975729876995",
                 "current_topic" : "testing",
                 "topic_queue" : [],
                 "topics" : {}
                 }
    s = "data/topic/settings.json"
    if not dataIO.is_valid_json(s):
        print("creating topic/settings.json")
        dataIO.save_json(s, defaults)
def check_file():
    data = {}

    data['db_version'] = DB_VERSION
    settings_file = 'data/grenzpolizei/settings.json'
    ignore_file = 'data/grenzpolizei/ignore.json'
    if not dataIO.is_valid_json(settings_file):
        print('Creating default settings.json...')
        dataIO.save_json(settings_file, data)
    else:
        check = dataIO.load_json(settings_file)
        if 'db_version' in check:
            if check['db_version'] < DB_VERSION:
                data = {}
                data['db_version'] = DB_VERSION
                print('GRENZPOLIZEI: Database version too old, please rerun the setup!')
                dataIO.save_json(settings_file, data)

    if not dataIO.is_valid_json(ignore_file):
        print('Creating default ignore.json...')
        dataIO.save_json(ignore_file, {})
Example #11
0
def check_file():
    f = 'data/sentry/settings.json'
    if dataIO.is_valid_json(f) is False:
        dataIO.save_json(f, {'dsn': None,
                             'tags': {},
                             'name': None,
                             'environment': None,
                             'ssl': True,
                             'level': 'ERROR',
                             'ignore': []
                             })
    f = 'data/sentry/settings.json'
    def __init__(self, bot, e=()):
        self.__module__ = 'cogs.lib_calebj.analytics'  # detach
        self.bot = bot
        self.terminate = False
        self.params_base = {}
        self.queue = deque(e, maxlen=512)
        self.gvanalytics.help = 'Enable or disable analytics for calebj cogs\n\n' + self.Q2

        self.data = {}
        if dataIO.is_valid_json(self.JSON):
            self.data = dataIO.load_json(self.JSON)

        self.task = self.bot.loop.create_task(self._start())
def check_file():
    data_file = 'data/customroles/data.json'
    if not dataIO.is_valid_json(data_file):
        print('Creating default data.json...')
        dataIO.save_json(data_file, {})
Example #14
0
def check_files():
    if not dataIO.is_valid_json('data/autoeconomy/settings.json'):
        defaults = {}
        dataIO.save_json('data/autoeconomy/settings.json', defaults)
Example #15
0
def check_files():
    f = "data/customcom/commands.json"
    if not dataIO.is_valid_json(f):
        print("Creating empty commands.json...")
        dataIO.save_json(f, {})
Example #16
0
def check_file():
    defaults = {}
    if not dataIO.is_valid_json(SETTINGS_JSON):
        dataIO.save_json(SETTINGS_JSON, defaults)
Example #17
0
def check_file():
    f = 'data/away/away.json'
    if not dataIO.is_valid_json(f):
        dataIO.save_json(f, {})
        print('Creating default away.json...')
Example #18
0
    async def match(self, ctx, letter):
        """List the players of a given match.\nUse only capital letters.\nChallonge gave us the data in letters instead of numbers.\nTo figure out what letter a match is on the website, count all of the winner matches first (down then right). Then count the loser matches in order."""

        path = "data/bracket/" + ctx.message.server.id + "/tracklist.json"

        #check to see if a tournament is being tracked or not. Search through matches if a tournament is being tracked.
        if dataIO.is_valid_json(path):
            userdata = dataIO.load_json(path)
            #Make sure match exists by checking the matches list in the JSON file.
            if not letter in userdata["matches"][0]:

                await self.bot.say(
                    "There is no match corresponding to this letter.")
            else:

                await self.bot.say("Searching...")

                #obtain the login credentials and login.
                login = dataIO.load_json("data/bracket/login.json")
                challonge.set_credentials(login["username"], login["api_key"])

                match = challonge.matches.show(userdata["id"],
                                               userdata["matches"][0][letter])

                #Both players are decided in the match.
                if not match["player1_id"] == None and not match[
                        "player2_id"] == None:
                    await self.bot.say(
                        challonge.participants.show(
                            userdata["id"], match["player1_id"])["name"] +
                        " will be facing " + challonge.participants.show(
                            userdata["id"], match["player2_id"])["name"] + ".")

                    #If winner has been determined, then also say who won the match.
                    if not match["winner_id"] == None:
                        await self.bot.say(
                            "This match has concluded. The winner was " +
                            challonge.participants.show(
                                userdata["id"], match["winner_id"])["name"])

                else:
                    player1 = ""
                    player2 = ""

                    #Player 1 hasn't been determined yet.
                    if match["player1_id"] == None:
                        if match["player1_is_prereq_match_loser"] == False:
                            player1 = "The winner of Match " + challonge.matches.show(
                                userdata["id"],
                                match["player1_prereq_match_id"])["identifier"]
                        else:
                            player1 = "The loser of Match " + challonge.matches.show(
                                userdata["id"],
                                match["player1_prereq_match_id"])["identifier"]

                    #Player 1 is determined.
                    else:
                        player1 = challonge.participants.show(
                            userdata["id"], match["player1_id"])["name"]

                    #Player 2 hasn't been determined yet.
                    if match["player2_id"] == None:
                        if match["player2_is_prereq_match_loser"] == False:
                            player2 = "the winner of Match " + challonge.matches.show(
                                userdata["id"],
                                match["player2_prereq_match_id"])["identifier"]
                        else:
                            player2 = "the loser of Match " + challonge.matches.show(
                                userdata["id"],
                                match["player2_prereq_match_id"])["identifier"]

                    #Player 2 is determined.
                    else:
                        player2 = challonge.participants.show(
                            userdata["id"], match["player2_id"])["name"]

                    await self.bot.say(player1 + " will be facing " + player2 +
                                       ".")

        #No track file found.
        else:
            await self.bot.say("Currently not tracking a tournament.")
Example #19
0
def check_files():
    if not dataIO.is_valid_json(Helpless.config_path):
        print("Creating default " + Helpless.config_path + " ...")
        dataIO.save_json(Helpless.config_path, Helpless.default_config)
Example #20
0
def check_files():
    f = "data/downloader/repos.json"
    if not dataIO.is_valid_json(f):
        print("Creating default data/downloader/repos.json")
        dataIO.save_json(f, {})
Example #21
0
def check_files():
    f = "data/downloader/repos.json"
    if not dataIO.is_valid_json(f):
        print("Creating default data/downloader/repos.json")
        dataIO.save_json(f, {})
Example #22
0
def check_files():
    twentysix = "data/news/registered.json"
    json = {}
    if not dataIO.is_valid_json(twentysix):
        print("Derp Derp Derp...")
        dataIO.save_json(twentysix, json)
Example #23
0
def check_files():
    if not dataIO.is_valid_json('data/imgwelcome/settings.json'):
        defaults = {}
        dataIO.save_json('data/imgwelcome/settings.json', defaults)
Example #24
0
def check_files():
    if not dataIO.is_valid_json("data/jobs/jobs.json"):
        print("Creating jobs' jobs.json...")
        dataIO.save_json("data/jobs/jobs.json", {})
Example #25
0
    async def updatescore(self, ctx, matchletter, score1, score2):
        """Change the scores of a match, even if scores have already been entered for the match.\nOnly officers can use this command."""

        path = "data/bracket/" + ctx.message.server.id + "/tracklist.json"
        author = ctx.message.author

        rolelist = author.roles
        isOfficer = False
        global leadRole
        global botRole

        for roles in rolelist:
            if roles.name == leadRole or roles.name == botRole:
                isOfficer = True

        if not isOfficer:
            await self.bot.say(
                "You are not an officer. Only officers can use this command.")
            return

        else:

            #check to see if a tournament is being tracked or not. Change match score if a tournament is being tracked.
            if dataIO.is_valid_json(path):
                userdata = dataIO.load_json(path)

                #Make sure match exists by checking the matches list in the JSON file.
                if not matchletter in userdata["matches"][0]:
                    await self.bot.say(
                        "There is no match corresponding to this letter.")

                else:

                    #attempt to convert the scores entered to integers.
                    try:
                        set1 = int(score1)
                        set2 = int(score2)

                        if set1 == set2:
                            await self.bot.say(
                                "You entered the same score. Only update the score when the match has been concluded."
                            )
                            return

                    except ValueError:
                        await self.bot.say(
                            "Please enter integers for the scores")
                        return

                    #obtain the login credentials and login.
                    login = dataIO.load_json("data/bracket/login.json")
                    challonge.set_credentials(login["username"],
                                              login["api_key"])

                    match = challonge.matches.show(
                        userdata["id"], userdata["matches"][0][matchletter])
                    if set1 < set2:
                        winnerid = match["player2_id"]
                        winner = challonge.participants.show(
                            userdata["id"], match["player2_id"])["name"]
                    else:
                        winnerid = match["player1_id"]
                        winner = challonge.participants.show(
                            userdata["id"], match["player1_id"])["name"]

                    await self.bot.say(
                        challonge.participants.show(
                            userdata["id"], match["player1_id"])["name"] +
                        " vs " + challonge.participants.show(
                            userdata["id"], match["player2_id"])["name"] +
                        "\nThe new score is " + str(score1) + "-" +
                        str(score2) + ".\nThe winner afterwards is " + winner +
                        ".\nPLEASE MAKE SURE THAT THIS IS ACCURATE.\nProceed with update? (yes/no)"
                    )

                    answer = await self.bot.wait_for_message(timeout=15,
                                                             author=author)
                    if answer == None or not answer.content.lower().strip(
                    ) == "yes":
                        await self.bot.say("Score was not updated.")
                    else:
                        score_csv = score1 + "-" + score2
                        newmatch = {"match": match}

                        #make sure that this is possible. Error if trying to update a tourney that isn't yours.
                        try:
                            await self.bot.say("Updating score...")
                            challonge.matches.update(userdata["id"],
                                                     match["id"],
                                                     scores_csv=score_csv,
                                                     winner_id=winnerid,
                                                     player1_votes=score1,
                                                     player2_votes=score2)
                            await self.bot.say("Score was updated.")

                        except:
                            await self.bot.say(
                                "Oops. Something went wrong. Make sure " +
                                login["username"] +
                                " created the tournament so I can edit the score. Otherwise, try again later."
                            )
                            raise

            #No track file found.
            else:
                await self.bot.say("Currently not tracking a tournament.")
Example #26
0
    async def reportscore(self, ctx, player1, player2, score1, score2):
        """Report the scores of an unsettled match.\nExample: If it was john vs jim, and jim won 3 to 2, enter john, jim, 2, 3.\nUse !updatescore if you want to change the scores of a match."""

        if player1 == player2:
            await self.bot.say(
                "You entered the same name twice. Please enter different names."
            )
            return

        path = "data/bracket/" + ctx.message.server.id + "/tracklist.json"
        author = ctx.message.author

        #check to see if a tournament is being tracked or not. Change match score if a tournament is being tracked.
        if dataIO.is_valid_json(path):

            userdata = dataIO.load_json(path)

            #make sure player exists by checking the players list in the JSON file
            if not player1 in userdata["players"][
                    0] and not player2 in userdata["players"][0]:
                await self.bot.say(
                    "At least one of the 2 players is not in the tournament. Please double check spelling and capitalization."
                )

            else:

                #attempt to convert the scores entered to integers.
                try:
                    set1 = int(score1)
                    set2 = int(score2)

                    if set1 == set2:
                        await self.bot.say(
                            "You entered the same score. Only update the score when the match has been concluded."
                        )
                        return

                except ValueError:
                    await self.bot.say("Please enter integers for the scores")
                    return

                #obtain the login credentials and login.
                login = dataIO.load_json("data/bracket/login.json")
                challonge.set_credentials(login["username"], login["api_key"])

                matches = challonge.matches.index(userdata["id"])

                #get ids for the players
                player1id = userdata["players"][0][player1]
                player2id = userdata["players"][0][player2]

                #search through all of the matches until we find the match with the 2 players, and update the score.
                for match in matches:

                    #The 2 players are not playing each other in this match. Skip to next match.
                    if not (match["player1_id"] == player1id
                            and match["player2_id"] == player2id) and not (
                                match["player1_id"] == player2id
                                and match["player2_id"] == player1id
                            ) or not match["winner_id"] == None:
                        continue
                    else:

                        #rearrange names/scores with temp vars to help with updating score.
                        actualPlayer1 = ""
                        actualPlayer2 = ""
                        actual1id = ""
                        actual2id = ""
                        actualScore1 = 0
                        actualScore2 = 0

                        #match player1 is the same as player1
                        if match["player1_id"] == player1id:
                            actualPlayer1 = player1
                            actualPlayer2 = player2
                            actual1id = player1id
                            actual2id = player2id
                            actualScore1 = set1
                            actualScore2 = set2

                        #match player1 is the same as player2
                        else:
                            actualPlayer1 = player2
                            actualPlayer2 = player1
                            actual1id = player2id
                            actual2id = player1id
                            actualScore1 = set2
                            actualScore2 = set1

                        #Also need to determine winner and their id
                        winner = ""
                        winnerid = ""
                        loserid = ""

                        #Score1 > Score2 means player 1 is the winner. Else player 2 is.
                        if actualScore1 > actualScore2:
                            winner = actualPlayer1
                            winnerid = actual1id
                            loserid = actual2id
                        else:
                            winner = actualPlayer2
                            winnerid = actual2id
                            loserid = actual1id

                        await self.bot.say(
                            actualPlayer1 + " vs " + actualPlayer2 +
                            "\nThe score was " + str(actualScore1) + "-" +
                            str(actualScore2) + ".\nThe winner is " + winner +
                            ".\nMake sure this is correct.\nProceed with update? (yes/no)"
                        )

                        answer = await self.bot.wait_for_message(timeout=15,
                                                                 author=author)
                        if answer == None or not answer.content.lower().strip(
                        ) == "yes":
                            await self.bot.say("Score was not updated.")
                        else:
                            score_csv = str(actualScore1) + "-" + str(
                                actualScore2)
                            print(match)
                            newmatch = {"match": match}

                            #make sure that this is possible. Error if trying to update a tourney that isn't yours.
                            try:
                                challonge.matches.update(
                                    userdata["id"],
                                    match["id"],
                                    scores_csv=score_csv,
                                    winner_id=winnerid,
                                    player1_votes=actualScore1,
                                    player2_votes=actualScore2)
                                await self.bot.say("Score was updated.")

                            except urllib2.HTTPError as err:
                                await self.bot.say(
                                    "Oops. Something went wrong. Make sure " +
                                    login["username"] +
                                    " created the tournament so I can edit the score. Otherwise, try again later."
                                )
                                raise
                        return

                #If we exit the loop, this means that the 2 players are not playing in the same match.
                await self.bot.say(
                    "Found no match where these 2 players are fighting. Please double check the player tags. If you want to correct a match score, contact an officer to use !updatescore."
                )
                return

        #No track file found.
        else:
            await self.bot.say("Currently not tracking a tournament.")
Example #27
0
def check_files():
    f = os.path.join(folder, "verified_users.json")
    data = {"users": {}}
    if not dataIO.is_valid_json(f):
        dataIO.save_json(f, data)
def check_files():
    f = os.path.join("data", "downloader", "repos.json")
    if not dataIO.is_valid_json(f):
        print("Creating default data/downloader/repos.json")
        dataIO.save_json(f, {})
Example #29
0
File: rcs.py Project: mgni/SML-Cogs
def check_file():
    """Check files."""
    if not dataIO.is_valid_json(JSON):
        dataIO.save_json(JSON, {})
Example #30
0
def check_file():
    data = {}
    f = "data/analytics/Database.json"
    if not dataIO.is_valid_json(f):
        print("Creating default Database.json...")
        dataIO.save_json(f, data)
Example #31
0
def check_file():
    data = {}
    f = 'data/kill/kill.json'
    if not dataIO.is_valid_json(f):
        print('Creating default kill.json...')
        dataIO.save_json(f, data)
Example #32
0
def check_file():
    """Check files."""
    if not dataIO.is_valid_json(JSON):
        dataIO.save_json(JSON, SERVER_DEFAULTS)
Example #33
0
    async def track(self, ctx, url):
        """Begin tracking a Challonge tournament.\nDon't include the challonge.com part.\nExample: If the tournament you want to track has the url challonge.com/trackme, then just type trackme.\nOnly officers can use this command."""
        serverId = ctx.message.server.id
        path = "data/bracket/" + serverId + "/tracklist.json"
        author = ctx.message.author

        rolelist = author.roles
        isOfficer = False

        global leadRole
        global botRole

        for roles in rolelist:
            if roles.name == leadRole or roles.name == botRole:
                isOfficer = True

        if not isOfficer:
            await self.bot.say(
                "You are not an officer. Only officers can use this command.")
            return

        else:

            #make sure the server has a folder for tracklist to be inside.
            if not os.path.exists("data/bracket/" + serverId):
                print("Creating a new directory for server " +
                      ctx.message.server.name)
                os.makedirs("data/bracket/" + serverId)

            #check to see if a tournament is being tracked or not.
            if not dataIO.is_valid_json(path):
                print("Creating new trackfile for server with id " + serverId)
                dataIO.save_json(path, {})
            else:
                await self.bot.say(
                    "A tournament is already being tracked. Please stop tracking your current tournament to track a new tournament."
                )
                return

            #establish connection to challonge and get tournament data
            userdata = dataIO.load_json("data/bracket/login.json")
            challonge.set_credentials(userdata["username"],
                                      userdata["api_key"])
            tourn = challonge.tournaments.show(url)
            await self.bot.say("Found a tournament with this url called " +
                               tourn["name"] +
                               ". Begin tracking this? (yes/no)")

            answer = await self.bot.wait_for_message(timeout=15, author=author)

            if answer == None or not answer.content.lower().strip() == "yes":
                os.remove(path)
                await self.bot.say("No action was taken. I did not track " +
                                   tourn["name"] + ".")
                return

            #JSON object of matches
            await self.bot.say("Creating tracking file...")
            jsonMatch = []
            item = {}
            matches = challonge.matches.index(tourn["id"])
            for entry in matches:
                item[entry["identifier"]] = entry["id"]
            jsonMatch.append(item)

            #JSON object of players
            jsonPlayer = []
            item = {}
            players = challonge.participants.index(tourn["id"])
            for player in players:
                item[player["name"]] = player["id"]
            jsonPlayer.append(item)

            #the JSON data will contain id, url, name, and JSON objects of the matches and players.
            info = info = {
                "id": tourn["id"],
                "url": url,
                "name": tourn["name"],
                "matches": jsonMatch,
                "players": jsonPlayer
            }
            dataIO.save_json(path, info)
            await self.bot.say("Tracking tournament " + tourn["name"] + ".")
Example #34
0
def check_files():
    f = "data/requester/settings.json"
    if not dataIO.is_valid_json(f):
        print("Creating default requester's settings.json...")
        dataIO.save_json(f, {})
Example #35
0
def check_files():
    f = "data/on_join/settings.json"
    if not dataIO.is_valid_json(f):
        print("Creating default on_join settings.json...")
        dataIO.save_json(f, {})
Example #36
0
def check_file():
    data_file = 'data/customroles/data.json'
    if not dataIO.is_valid_json(data_file):
        print('Creating default data.json...')
        dataIO.save_json(data_file, {})
Example #37
0
def check_files():
    if not dataIO.is_valid_json(SHEETS_PATH):
        dataIO.save_json(SHEETS_PATH, {})
Example #38
0
def check_file():
    """Check files."""
    defaults = {}
    if not dataIO.is_valid_json(JSON):
        dataIO.save_json(JSON, defaults)
Example #39
0
def check_file():
    f = 'data/buyrole/settings.json'
    if dataIO.is_valid_json(f) is False:
        dataIO.save_json(f, {})
    f = 'data/buyrole/settings.json'
Example #40
0
def check_files():
    f = "data/trigger/triggers.json"
    if not dataIO.is_valid_json(f):
        print("Creating empty triggers.json...")
        dataIO.save_json(f, [])
Example #41
0
def check_file():
    f = 'data/antilink/settings.json'
    if dataIO.is_valid_json(f) is False:
        dataIO.save_json(f, {})
Example #42
0
def check_files():
    f = os.path.join("data", "downloader", "repos.json")
    if not dataIO.is_valid_json(f):
        print("Creating default data/downloader/repos.json")
        dataIO.save_json(f, {})
Example #43
0
def check_file():
    if dataIO.is_valid_json(JSON_PATH) is False:
        log.debug('Creating json: %s' % JSON_PATH)
        dataIO.save_json(JSON_PATH, {})
Example #44
0
def check_files():

    f = 'data/marry/server_marry.json'
    if not dataIO.is_valid_json(f):
        dataIO.save_json(f, {})
        print('Creating default server_marry.json...')
Example #45
0
def check_file():
    data = {}
    f = "data/invoice/settings.json"
    if not dataIO.is_valid_json(f):
        print("Creating default settings.json...")
        dataIO.save_json(f, data)
Example #46
0
def check_file():
    f = 'data/dynamicvoice/settings.json'
    if dataIO.is_valid_json(f) is False:
        dataIO.save_json(f, {})
Example #47
0
def check_files():
    f = "data/trigger/triggers.json"
    if not dataIO.is_valid_json(f):
        print("Creating empty triggers.json...")
        dataIO.save_json(f, [])
Example #48
0
def check_file():
    f = 'data/buyrole/settings.json'
    if dataIO.is_valid_json(f) is False:
        log.debug('Creating json: settings.json')
        dataIO.save_json(f, {})
Example #49
0
def check_files():
    if not dataIO.is_valid_json(JSON):
        defaults = {}
        dataIO.save_json(JSON, defaults)
Example #50
0
def check_file():
    f = 'data/githubcards/settings.json'
    if dataIO.is_valid_json(f) is False:
        dataIO.save_json(f, {})
Example #51
0
def check_files():
    if not dataIO.is_valid_json(JSON):
        print('Creating empty %s' % JSON)
        dataIO.save_json(JSON, {})
Example #52
0
def check_file():
    f = 'data/suggestionbox/settings.json'
    if dataIO.is_valid_json(f) is False:
        dataIO.save_json(f, {})
Example #53
0
def check_file():
    data = {}
    f = "data/logtools/logtools.json"
    if not dataIO.is_valid_json(f):
        print("Creating default logtools.json...")
        dataIO.save_json(f, data)
Example #54
0
def check_file():
    f = 'data/antilink/settings.json'
    if dataIO.is_valid_json(f) is False:
        dataIO.save_json(f, {})
Example #55
0
def check_files():
    defaults = {'HOST': '127.0.0.1', 'INTERVAL': 5}
    if not dataIO.is_valid_json(JSON):
        print("Creating empty %s" % JSON)
        dataIO.save_json(JSON, defaults)
Example #56
0
def check_file():
    f = 'data/punish/settings.json'
    if dataIO.is_valid_json(f) is False:
        log.debug('Creating json: settings.json')
        dataIO.save_json(f, {})
Example #57
0
def check_file():
    data = {}
    f = 'data/kill/kill.json'
    if not dataIO.is_valid_json(f):
        print('Creating default kill.json...')
        dataIO.save_json(f, data)