Пример #1
0
def getTokens(nick):
    if enableTokens:
        data = WorkingWithFiles.JSONloadFromDisk(
            'data/usedata/' + nick + '.json', default)  # Get data from file
        tokens = int(data.get("tokens", default))  # Extract tokens of a player
        return tokens
    else:
        return staticTokens
Пример #2
0
def getCards(nick):
    """
    :param nick: The nickname of the player
    :return list: The cards of the specified player
    """
    data = WorkingWithFiles.JSONloadFromDisk('data/casino.json',
                                             default)  # Get data from file
    cards = data[nick]["cards"]  # Extract cards of a player
    return list(cards)
Пример #3
0
def getBet(nick):
    """
    :param nick: The nickname of the player
    :return int: The bet of the specified player
    """
    data = WorkingWithFiles.JSONloadFromDisk('data/casino.json',
                                             default)  # Get data from file
    bet = int(data[nick]["bet"])  # Extract bet of a player
    return bet
Пример #4
0
def getMoney(nick):
    """
    :param nick: The nickname of the player
    :return int: The money of the specified player
    """
    data = WorkingWithFiles.JSONloadFromDisk('data/casino.json',
                                             default)  # Get data from file
    argent = int(data[nick]["money"])  # Extract money of a player
    return argent
Пример #5
0
def faq(text, reply, notice, event, message):
    text = text.split()
    GlobalData = WorkingWithFiles.JSONloadFromDisk("data/faq.json")
    LocalData = WorkingWithFiles.JSONloadFromDisk("data/local_faq/" +
                                                  event.chan)

    try:
        reponse = FindTheWord(LocalData, GlobalData, text[0])

    except:
        return "I'm Sorry, but I can't find this! Use !listfaq and !llistfaq to see what are the current defined factoids."

    try:
        message(" > " + text[1] + " => " + reponse)

    except:
        reply(reponse)
        notice(
            "Did you know ? You can use !faq word user to HL a particular user "
        )
Пример #6
0
def lfaqadd(text, reply, event):
    data = WorkingWithFiles.JSONloadFromDisk("data/local_faq/" + event.chan)
    text = text.split()

    word = text[0]

    answer = ' '.join(text[1:])

    data[word] = answer

    WorkingWithFiles.JSONsaveToDisk(data, "data/local_faq/" + event.chan)

    reply("The word " + word +
          " has been added to the LOCAL FAQ. It refers to : " + answer)
Пример #7
0
def faqadd(text, reply):
    data = WorkingWithFiles.JSONloadFromDisk("data/faq.json")
    text = text.split()

    word = text[0]

    answer = ' '.join(text[1:])

    data[word] = answer

    WorkingWithFiles.JSONsaveToDisk(data, "data/faq.json")

    reply("The word " + word + " has been added to the FAQ. It refers to : " +
          answer)
Пример #8
0
def savePlayerData(nick, argent="NotProvided", mise=None, cards=None):
    """
    Save a player data
    """

    if argent == "NotProvided":

        argent = getMoney(nick)

    if not mise:

        mise = getBet(nick)

    if not cards:

        cards = getCards(nick)

    data = WorkingWithFiles.JSONloadFromDisk('data/casino.json', default)
    data[nick] = {
        "money": int(argent),
        "bet": int(mise),
        "cards": list(cards)
    }  # Save to data
    WorkingWithFiles.JSONsaveToDisk(data, 'data/casino.json')  # Save to disk
Пример #9
0
def reset(reply, text):
    data = WorkingWithFiles.JSONloadFromDisk('data/casino.json', default)
    data[text] = default  # Save to data
    WorkingWithFiles.JSONsaveToDisk(data, 'data/casino.json')  # Save to disk
    reply(text + " stats was deleted")