Exemplo n.º 1
0
def c_kurwa(client, message):
    c = sh.get_command(message).lower()[1:]
    e = sh.get_args(message).split(" ")
    ret = ""
    dot = True

    for t in e:
        changecase = False

        if random.random() < 0.2:
            if dot and t[0].isupper():
                ret += c.title() + " "
                if t.istitle():
                    changecase = True
            else:
                ret += c + " "

        if t.endswith("."):
            dot = True
        else:
            dot = False

        if changecase:
            ret += t.lower() + " "
        else:
            ret += t + " "

    yield from client.send_message(message.channel, sh.mention(message) + ret)
Exemplo n.º 2
0
def c_stats(client, message):
	stat_limit = 15 if (str(message.channel).startswith("Direct Message") or message.channel.id in ["319056762814595076", "386148571529084929"]) else 5
	bot_stats = True if "bot" in sh.get_command(message).lower() else None
	
	mmmsmsm = generate_stats(client, message, message.channel, sh.get_args(message), stat_limit, bot_stats)
	#print("Generated successfully")
	#yield from client.send_message(message.channel, "test")
	yield from client.send_message(message.channel, mmmsmsm)
Exemplo n.º 3
0
def c_kogo(client, message):
    cmd = sh.get_command(message)
    if cmd == ".kogo":
        hrabul = "Hrabulę"
        ja = "mnie"
        ty = "ciebie"
        nikt = "nikogo"
    else:
        hrabul = "Hrabuli"
        if cmd == ".czyim":
            ja = "moim"
            ty = "twoim"
            nikt = "niczyim"
        elif cmd == ".czyja":
            ja = "moja"
            ty = "twoja"
            nikt = "niczyja"
        elif cmd == ".czyje":
            ja = "moje"
            ty = "twoje"
            nikt = "niczyje"
        elif cmd == ".czyj":
            ja = "mój"
            ty = "twój"
            nikt = "niczyj"

    word = [
        ja, ty, "Turambara", "yojca", "Lorda Nargogha", "Rankina", "Kathajca",
        "Behemorta", "orgieła", "Stillborna", "Metalusa", "kicka", "podbiela",
        "Sedinusa", "Hakkena", "Teba", "Sermacieja", "t3trisa", "optiego",
        hrabul, "FaceDancera", "Holiego.Deatha", "Ramzesa", "POLIPa",
        "mateusza(stefana)", "Xysia", "Germanotty", "Berlina", "8azyliszka",
        "Seekera", "Murezora", "RIPa", "Aidena", " Accouna", "Fela", "Dracii",
        "Niziołki", "Mavericka", "P_aula", "Brylanta", "deffika", "Deviusa",
        "Gofra", "JamesaVooa", "Black Shadowa", "emqiego", "nerv4", "Pałkera",
        "PrincessNua", "Rysi", "Shakera", "Artiusa", "Stefana", "Xerbera",
        "Elana", "Vodę", "Xardasa", "Abyssa", "Bethezera", "Knight Martiusa",
        "Mysquffa", "OATa", "Noobirusa", "Osła", "b3rta", "gena", "Śćasa"
    ]
    yield from client.send_message(message.channel,
                                   sh.mention(message) + random.choice(word))
Exemplo n.º 4
0
def parse_message(message, edited=False):
    if not edited:
        billy_c_stats.insert_msg(message)

    # Track used emojis

    emoji_list = list(
        c for c in message.clean_content if c in emoji.UNICODE_EMOJI) or []
    custom_emoji_list = re.findall(r"<:\S+?:\d+>", message.clean_content,
                                   re.IGNORECASE) or []
    billy_c_stats.insert_emojis_post(message, emoji_list, custom_emoji_list,
                                     edited)

    # ignore bot messages

    if message.author == client.user:
        return

    perm = af.check_channel_whitelist(client, message)

    # channel blacklisted

    if perm["disallow"]:
        return

    # strip quotes
    content = sh.rm_leading_quotes(message)

    if not edited:
        # fulltext search
        for f in f_functions:
            c = getattr(f, "command", False)
            p = getattr(f, "prob", False)

            if c and p and re.search(c, content, re.IGNORECASE) and (
                    p >= 1.0 or (perm["fulltext"] and random.random() < p)):
                sh.debug("Triggered " + f.__name__ + "...")
                try:
                    yield from f(client, message)
                except Exception:
                    print_warning("An error occured in " + f.__name__ +
                                  "!!! (" + content + ")")
                    raise

    # commands

    if re.match(client.command_prefix, content):
        sh.debug("This seems to be a command: " + sh.get_command(message))

        # check antiflood

        #if perm["flood"] and ((yield from af.check_flood_channel(client, message)) or (yield from af.check_flood(client, message))):
        #	sh.debug("Anti-flood kicked in yo")
        #	return

        # help

        # not needed here

        #else:
        # iterate over functions
        for f in c_functions:
            c = getattr(f, "command", False)
            r = re.match(compile_command(c), content, re.IGNORECASE)
            if c and r:
                sh.debug("Executing " + f.__name__ + "...")
                yield from client.send_typing(message.channel)
                try:
                    yield from f(client, message)
                    billy_c_stats.update_msg_function(message, f.__name__)
                except Exception:
                    yield from client.send_message(
                        message.channel,
                        "Oho, chyba jakiś błąd w kodzie. <@307949259658100736> to kiedyś naprawi, jak się skończy bawić pociągami."
                    )
                    print_warning("An error occured in " + f.__name__ +
                                  "!!! (" + content + ")")
                    #CZEMU TY CHUJU NIE DZIALASZ
                    #logging.exception("An error occured in " + f.__name__ + "!!! (" + content + ")")
                    raise
                    continue
                break
Exemplo n.º 5
0
def parse_message(message, edited=False):
    #if not edited:
    #	billy_c_stats.insert_msg(message)

    # Track used emojis

    #emoji_list = list(c for c in message.clean_content if c in emoji.UNICODE_EMOJI) or []
    #custom_emoji_list = re.findall(r"<:\S+?:\d+>", message.clean_content, re.IGNORECASE) or []
    #billy_c_stats.insert_emojis_post(message, emoji_list, custom_emoji_list, edited)

    # ignore bot messages

    if message.author == client.user:
        return

    perm = af.check_channel_whitelist(client, message)

    # channel blacklisted

    if perm["disallow"]:
        return

    # strip quotes
    content = unidecode.unidecode(sh.rm_leading_quotes(message))

    if not edited:
        # fulltext search
        for f in f_functions:
            c = getattr(f, "command", False)
            p = getattr(f, "prob", False)

            if c and p and re.search(c, content, re.IGNORECASE) and (
                    p >= 1.0 or (perm["fulltext"] and random.random() < p)):
                sh.debug("Triggered " + f.__name__ + "...")
                try:
                    yield from f(client, message)
                except Exception:
                    print_warning("An error occured in " + f.__name__ +
                                  "!!! (" + content + ")")
                    raise

    # commands

    if re.match(client.command_prefix, content):
        sh.debug("This seems to be a command: " + sh.get_command(message))

        # check antiflood

        if perm["flood"] and (
            (yield from af.check_flood_channel(client, message)) or
            (yield from af.check_flood(client, message))):
            sh.debug("Anti-flood kicked in yo")
            return

        # help

        if re.match(compile_command(r"(help|pomoc)"), content, re.IGNORECASE):
            sh.debug("What a noob")
            ret = "Witam witam, z tej strony Billy Mays z kolejnym fantastycznym produktem!\nDozwolone przedrostki funkcji: . , \ / ! ;\n\n"

            for f in c_functions:
                desc = getattr(f, "desc", False)

                if hasattr(f, "rhyme") or desc == "hidden":
                    continue

                command = getattr(f, "command", False)

                ret += "." + getattr(f, "command")

                params = getattr(f, "params", False)

                if params:
                    for p in params:
                        ret += " [" + p + "]"

                if desc:
                    ret += " - " + desc

                ret += "\n"

            ret += "\nRymy i inne bzdety: .rymy"
            ret += "\nZadzwoń teraz, a podwoimy ofertę!"

            if len(ret) > 2000:
                n = 40
                groups = ret.split("\n")
                help = ["\n".join(groups[:n]), "\n".join(groups[n:])]
            else:
                help = [ret]

            for m in help:
                yield from client.send_message(message.channel, m)

        elif re.match(compile_command(r"(rymy|rhymes)"), content,
                      re.IGNORECASE):
            sh.debug("What an utter pillock")
            ret = "Rymy i inne bzdety:\n"

            for f in c_functions:
                if not hasattr(f, "rhyme"):
                    continue
                command = getattr(f, "command", False)
                ret += "." + getattr(f, "command") + "\n"

            yield from client.send_message(message.channel, ret[:-1])

        else:
            # iterate over functions
            for f in c_functions:
                c = getattr(f, "command", False)
                r = re.match(compile_command(c), content, re.IGNORECASE)
                if c and r:
                    sh.debug("Executing " + f.__name__ + "...")
                    yield from client.send_typing(message.channel)
                    try:
                        yield from f(client, message)
                        #billy_c_stats.update_msg_function(message, f.__name__)
                    except Exception:
                        yield from client.send_message(
                            message.channel,
                            "Oho, chyba jakiś błąd w kodzie. <@307949259658100736> to kiedyś naprawi, jak się skończy bawić pociągami."
                        )
                        print_warning("An error occured in " + f.__name__ +
                                      "!!! (" + content + ")")
                        #CZEMU TY CHUJU NIE DZIALASZ
                        #logging.exception("An error occured in " + f.__name__ + "!!! (" + content + ")")
                        raise
                        continue
                    break
Exemplo n.º 6
0
def on_message(message):
    #ignore bot messages

    if message.author == client.user:
        return

    perm = af.check_channel_whitelist(client, message)

    # channel blacklisted

    if perm["disallow"]:
        return

    # strip quotes
    content = sh.rm_leading_quotes(message)

    if perm["fulltext"]:
        # fulltext search
        for f in f_functions:
            c = getattr(f, "command", False)
            p = getattr(f, "prob", False)

            if c and p and re.search(c, content,
                                     re.IGNORECASE) and random.random() < p:
                sh.debug("Triggered " + f.__name__ + "...")
                try:
                    yield from f(client, message)
                except Exception:
                    print("An error occured in " + f.__name__ + "!!! (" +
                          content + ")")
                    raise
                    continue

    # commands

    if re.match(client.command_prefix, content):
        sh.debug("This seems to be a command: " + sh.get_command(message))

        # check antiflood

        if perm["flood"] and (
            (yield from af.check_flood_channel(client, message)) or
            (yield from af.check_flood(client, message))):
            sh.debug("Anti-flood kicked in yo")
            return

        # help

        if re.match(compile_command(r"(help|pomoc)"), content, re.IGNORECASE):
            sh.debug("What a noob")
            ret = "Witam witam, z tej strony Billy Mays z kolejnym fantastycznym produktem!\nDozwolone przedrostki funkcji: . , \ / !\n\n"

            for f in c_functions:
                desc = getattr(f, "desc", False)

                if hasattr(f, "rhyme") or desc == "hidden":
                    continue

                command = getattr(f, "command", False)

                ret += "." + getattr(f, "command")

                params = getattr(f, "params", False)

                if params:
                    for p in params:
                        ret += " [" + p + "]"

                if desc:
                    ret += " - " + desc

                ret += "\n"

            ret += "\nRymy i inne bzdety: .rymy"
            ret += "\nZadzwoń teraz, a podwoimy ofertę!"

            yield from client.send_message(message.channel, ret)

        elif re.match(compile_command(r"(rymy|rhymes)"), content,
                      re.IGNORECASE):
            sh.debug("What an utter pillock")
            ret = "Rymy i inne bzdety:\n"

            for f in c_functions:
                if not hasattr(f, "rhyme"):
                    continue
                command = getattr(f, "command", False)
                ret += "." + getattr(f, "command") + "\n"

            yield from client.send_message(message.channel, ret[:-1])

        else:
            # iterate over functions
            for f in c_functions:
                c = getattr(f, "command", False)
                r = re.match(compile_command(c), content, re.IGNORECASE)
                if c and r:
                    sh.debug("Executing " + f.__name__ + "...")
                    yield from client.send_typing(message.channel)
                    try:
                        yield from f(client, message)
                    except Exception:
                        yield from client.send_message(
                            message.channel,
                            "Oho, chyba jakiś błąd w kodzie. <@307949259658100736> to kiedyś naprawi, jak się skończy bawić pociągami."
                        )
                        print("An error occured in " + f.__name__ + "!!! (" +
                              content + ")")
                        #CZEMU TY CHUJU NIE DZIALASZ
                        #logging.exception("An error occured in " + f.__name__ + "!!! (" + content + ")")
                        raise
                        continue
                    break

        return
Exemplo n.º 7
0
def c_czyj(client, message):
    yield from client.send_message(
        message.channel,
        sh.mention(message) +
        get_random_nickname(message, "genitive", sh.get_command(message)))
Exemplo n.º 8
0
def c_kurwa(client, message):
    c = sh.get_command(message).lower()[1:]
    yield from client.send_message(
        message.channel,
        sh.mention(message) + sh.insert_word(c, sh.get_args(message)))