Пример #1
0
def uptime(text, irc, ex, nick, commands):
    if text.find(":!uptime full\r\n") != -1:
        sendm(irc, utf(check_output("uptime")), ex[2] )
    else:
        sendm(irc, utf(Uptime.uptime()), ex[2] )
Пример #2
0
    + " "
    + GS["connect"]["servername"]
    + " :"
    + GS["connect"]["realname"]
    + "\n",
)
rawsend(irc, "NICK " + GS["connect"]["nick"] + "\n")
rawsend(irc, "PRIVMSG NickServ :IDENTIFY " + GS["connect"]["nickpass"] + "\n")
rawsend(irc, "JOIN " + GS["connect"]["channels"] + "\n")

while 1:
    text = irc.recv(2040)
    if not text:
        break

    text = utf(text)
    print(text)
    ex = text.split()
    p = re.compile("(?<=:)(.*?)(?=!)")
    print(p.findall(ex[0]))
    if p.findall(ex[0]):
        nick = p.findall(ex[0])[0]

    if p.findall(ex[0]):
        if ex[2] == GS["connect"]["nick"]:
            ex[2] = nick

    # if text.find(" JOIN :#") != -1 or text.find(" JOIN #") != -1 and text.find( GS['connect']['nick'] ) == -1 and ex[4].strip() != 'JOIN':
    #     if text.find(" JOIN #") != -1:
    #         sendm(irc, 'Hello ' + nick + ' :-) Welcome to ' + ex[2].strip() + '.', ex[2].strip())
    #     else: