Ejemplo n.º 1
0
def postprocess(command, config, bot_config):
    if command["message"] in config["matches"]:
        if bot_config["nick"] == "buttbot":
            bot.say(command["host"], command["channel"], "Butt Roll Call")
        else:
            bot.say(command["host"], command["channel"],
                    "What are you playing at?")
Ejemplo n.º 2
0
def postprocess(command, config, bot_config):

    if not config["activated"]:
        return

    try:
        if command["user"] == bot_config["user"]:
            return
    except KeyError:
        pass

    words = command["message"].split(' ')
    sentence = ""

    if len(words) < 3:
        return

    for i in range(0, len(words)):
        if random.random() < config["chance"]:
            word = re.findall(r"[\w']+|[.,!?;]", words[i])
            if len(word) > 0:
                if word[0].isupper():
                    word[0] = config["replace"].upper()
                else:
                    word[0] = config["replace"]
                words[i] = "".join(word)

    sentence = " ".join(words)
    if sentence != command["message"]:
        bot.say(command["host"], command["channel"], sentence)
Ejemplo n.º 3
0
def postprocess(command, config, bot_config):

    if not config["activated"]:
        return

    try:
        if command["user"] == bot_config["user"]: 
            return
    except KeyError:
        pass

    words = command["message"].split(' ')
    sentence = ""

    if len(words) < 3:
        return
    
    for i in range(0, len(words)):
        if random.random() < config["chance"]:
            word = re.findall(r"[\w']+|[.,!?;]", words[i])
            if len(word) > 0:
                if word[0].isupper():
                    word[0] = config["replace"].upper()
                else:
                    word[0] = config["replace"]
                words[i] = "".join(word)

    sentence = " ".join(words)
    if sentence != command["message"]:
        bot.say(command["host"], command["channel"], sentence)
Ejemplo n.º 4
0
def dota(command, config, bot_config):

    try:
        match = command["options"]["args"][0]
    except IndexError:
        return

    url = "https://api.steampowered.com/IDOTA2Match_570/GetMatchDetails/V001/?key???&match_id=" + match

    response = requests.get(url)

    if (response.ok):

        data = json.loads(response.content)

        data = data["result"]

        radiant_score = [0, 0, 0]
        dire_score = [0, 0, 0]

        for player in data["players"]:
            if player["player_slot"] > 100:
                dire_score[0] += player["kills"]
                dire_score[1] += player["deaths"]
                dire_score[2] += player["assists"]
            else:
                radiant_score[0] += player["kills"]
                radiant_score[1] += player["deaths"]
                radiant_score[2] += player["assists"]

        #say data to channel
        if data["radiant_win"]:
            sentence = "Radiant"
        else:
            sentence = "Dire"

        sentence += " victory! "

        sentence += str(radiant_score[0]) + "/" + str(
            radiant_score[1]) + "/" + str(radiant_score[2])
        sentence += " " + str(dire_score[0]) + "/" + str(
            dire_score[1]) + "/" + str(dire_score[2])

        bot.say(command["host"], command["channel"], sentence)

    else:
        response.raise_for_status()

    pass
Ejemplo n.º 5
0
def dota(command, config, bot_config):

    try:
        match = command["options"]["args"][0]
    except IndexError:
        return

    url = "https://api.steampowered.com/IDOTA2Match_570/GetMatchDetails/V001/?key???&match_id=" + match
    
    response = requests.get(url)

    if(response.ok):

        data = json.loads(response.content)

        data = data["result"]

        radiant_score = [0, 0, 0]
        dire_score = [0, 0, 0]

        for player in data["players"]:
            if player["player_slot"] > 100:
                dire_score[0] += player["kills"]
                dire_score[1] += player["deaths"]
                dire_score[2] += player["assists"]
            else:
                radiant_score[0] += player["kills"]
                radiant_score[1] += player["deaths"]
                radiant_score[2] += player["assists"]

        #say data to channel
        if data["radiant_win"]:
            sentence = "Radiant"
        else:   
            sentence = "Dire" 

        sentence += " victory! "

        sentence += str(radiant_score[0]) + "/" + str(radiant_score[1]) + "/" + str(radiant_score[2]) 
        sentence += " " + str(dire_score[0]) + "/" + str(dire_score[1]) + "/" + str(dire_score[2])

        bot.say(command["host"], command["channel"], sentence)

        
    else:
        response.raise_for_status()    

    pass
Ejemplo n.º 6
0
def error(command):
    bot.say(command["host"], command["channel"], "Invalid use. Example: '!perm add whitelist rose'")
Ejemplo n.º 7
0
def not_auth(command):
    bot.say(command["host"], command["channel"], "Invalid permissions.")
Ejemplo n.º 8
0
def not_auth(command):
    bot.say(command["host"], command["channel"], "Invalid permissions.")
Ejemplo n.º 9
0
def error(command):
    bot.say(command["host"], command["channel"],
            "Invalid use. Example: '!perm add whitelist rose'")
Ejemplo n.º 10
0
def postprocess(command, config, bot_config):
    if command["message"] in config["matches"]:
        if bot_config["nick"] == "buttbot":
            bot.say(command["host"], command["channel"], "Butt Roll Call")
        else:
            bot.say(command["host"], command["channel"], "What are you playing at?")
Ejemplo n.º 11
0
def say(command, config, bot_config):
    if len(command["options"]["args"]) > 0:
        bot.say(command["host"], command["channel"],
                " ".join(command["options"]["args"]))