Exemple #1
0
def hello_command(whatsapp: WhatsApp, message: str, arg_len: int) -> (bool, str):
    if arg_len != 0:
        return True, "OMG Not like that"
    ws = WhatsAppStyle(whatsapp)
    ws.type("Hello ")
    ws.tag(whatsapp.get_user())
    ws.send()
    return False, ""
Exemple #2
0
def join_command(whatsapp: WhatsApp, message: str, arg_len: int) -> (bool, str):
    if not whatsapp.get_perms(whatsapp.get_user()):
        return True, "You can't do that"
    if arg_len < 1:
        return True, "OMG Not like that"

    user = whatsapp.get_user()

    if not message.__contains__("https://chat.whatsapp.com/"):
        return True, "Not a valid group"

    ws = WhatsAppStyle(whatsapp)
    ws.typewriter("Joining group: " + message.replace("https://chat.whatsapp.com/", ""))
    ws.send()

    sleep(1)

    message = message.replace("https://chat.whatsapp.com/", "https://web.whatsapp.com/accept?code=")
    whatsapp.driver.get(message)

    found = False

    start_ts = time()

    while not found:
        if start_ts + 30 < time():
            whatsapp.start()
            return True, "Something terrible happened\nI cant join the group " + message
        try:
            join_button = whatsapp.driver.find_element_by_xpath("//div[text()='Gruppe beitreten']")
            sleep(1)
            join_button.click()
            found = True
        except:
            pass

    sleep(2)

    try:
        ws.type("Hello world ")
        ws.tag(user)
        ws.type("added me")
        ws.send()
    except:
        pass

    while not whatsapp.select_chat(whatsapp.idle_chat):
        sleep(0.5)

    return False, ""
Exemple #3
0
def user_info_command(whatsapp: WhatsApp, message: str, arg_len: int) -> (bool, str):
    if arg_len < 1:
        return True, "OMG Not like that"

    msg = "Permission: " + str(whatsapp.get_perms(message)) + "\n"
    msg += "Blacklist: " + str(whatsapp.get_blacklist(message)) + "\n"

    ws = WhatsAppStyle(whatsapp)
    ws.type("Userinfo for ")
    ws.tag(message)
    ws.format_print("\n")
    ws.typewriter(msg)
    ws.send()

    return False, ""
Exemple #4
0
def spam_command(whatsapp: WhatsApp, message: str, arg_len: int) -> (bool, str):
    if not whatsapp.get_perms(whatsapp.get_user()):
        return True, "You can't do that"
    if arg_len < 1:
        return True, "OMG Not like that"
    if int(message.split("->")[1]) > 500:
        return True, "Please don't spam to much"

    ws = WhatsAppStyle(whatsapp)

    for i in range(0, int(message.split("->")[1])):

        ws.type("SPAM ")
        ws.tag(message.split("->")[0])
        ws.type(" " + str(i))
        ws.send()

    return False, ""