def msg_command(whatsapp: WhatsApp, message: str, arg_len: int): 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" ws = WhatsAppStyle(whatsapp) ws.typewriter("Sending '" + message.split("->")[1] + "' to " + message.split("->")[0]) ws.send() whatsapp.send_message(message.split("->")[0], message.split("->")[1]) return False, ""
def crash_info_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" with open(message) as file: crash = file.read() ws = WhatsAppStyle(whatsapp) ws.typewriter(crash) ws.send() return False, ""
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, ""
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, ""
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, ""