示例#1
0
文件: mail.py 项目: h4ckl4bm3/botbot
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"
示例#2
0
文件: mail.py 项目: Exceltior/botbot
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"
示例#3
0
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"
示例#4
0
文件: who.py 项目: Exceltior/botbot
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"