Пример #1
0
def say_command(whatsapp: WhatsApp, message: str, arg_len: int) -> (bool, str):
    if arg_len < 1:
        return True, "OMG Not like that"
    ws = WhatsAppStyle(whatsapp)
    ws.format_print(message)
    ws.send()
    return False, ""
Пример #2
0
def wikipedia_command(whatsapp: WhatsApp, message: str, arg_len: int) -> (bool, str):
    if arg_len < 1:
        return True, "OMG Not like that"
    with urllib.request.urlopen(
            "https://en.wikipedia.org/api/rest_v1/page/summary/" + message.replace(" ", "_")) as response:
        result = response.read()
    result = json.loads(result)
    ws = WhatsAppStyle(whatsapp)
    ws.format_print(result["extract"])
    ws.send()
    return False, ""
Пример #3
0
def help_command(whatsapp: WhatsApp, message: str, arg_len: int) -> (bool, str):
    if arg_len != 0:
        return True, "OMG Not like that"
    ws = WhatsAppStyle(whatsapp)

    for x in whatsapp.command_types:
        ws.fat(x)
        for y in whatsapp.command_types[x]:
            ws.typewriter(">> " + y)
        ws.format_print("")

    ws.send()

    return False, ""
Пример #4
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, ""