def mail(inp, nick="", chan="", isis=None, api_key=None): if not isinstance(api_key, dict) or any( key not in api_key for key in ('username', 'password')): return "error: api keys not set" handle, msg = inp.split(None, 1) addr = irc.handle_to_email(isis, handle) if addr: mail = PlainSmtp('isis.poly.edu', 25) mail.starttls() mail.login(api_key['username'], api_key['password']) text = """From: botbot <*****@*****.**> To: <{0}> Subject: New IRC message from {1} in {3} You have a new message from {1}: {2} """.format(addr, nick, msg, chan) sender = "*****@*****.**" recv = [addr] try: mail.sendmail(sender, recv, text) return "Sent" except: return "Something went wrong..." else: return "I don't have their email address"
def mail(inp, nick="", chan="", isis=None, api_key=None): if not isinstance(api_key, dict) or any(key not in api_key for key in ('username', 'password')): return "error: api keys not set" handle, msg = inp.split(None, 1) addr = irc.handle_to_email(isis, handle) if addr: mail = PlainSmtp('isis.poly.edu', 25) mail.starttls() mail.login(api_key['username'], api_key['password']) text = """From: botbot <*****@*****.**> To: <{0}> Subject: New IRC message from {1} in {3} You have a new message from {1}: {2} """.format(addr, nick, msg, chan) sender = "*****@*****.**" recv = [addr] try: mail.sendmail(sender, recv, text) return "Sent" except: return "Something went wrong..." else: return "I don't have their email address"
def who(inp, nick="", msg="", chan="", isis=None): try: handle = msg.split(" ")[1] row = irc.handle_to_email(isis, handle) if row: return row else: return "idk that person" except: return "idk that person"