Ejemplo n.º 1
0
def messageHandler(session, uid, type, text, stime, ignore_level):
	for c in command:
		mx = command[c][0].search(text)
		if (mx):
			ekg.command(("/msg %s %s" % (uid, command[c][1](mx))).encode('UTF8'))
			break

def testMessageHandler(session, uid, type, text, stime, ignore_level):
	if text[-21:-4] == "!jirabot selftest":
		for i in color.test():
			ekg.command("/msg %s TEST [%s]" % (uid, i))

ekg.handler_bind("protocol-message-received", messageHandler)
ekg.handler_bind("protocol-message-received", testMessageHandler)
ekg.timer_bind(5, handleSignals)

ekg.variable_add("jirabot:url", "")
ekg.variable_add("jirabot:username", "")
ekg.variable_add("jirabot:password", "")
ekg.variable_add("jirabot:project", "")
ekg.variable_add("jirabot:channel", "")
ekg.variable_add("jirabot:sigdir", "/nonexistent")
ekg.variable_add("jirabot:projectregexp", "[A-Z]+")

ekg.command_bind("jirabot:initialize", initialize)
ekg.command_bind("jirabot:print_config", print_config)
ekg.command_bind("jirabot:signal", lambda n, a: messageHandler(None, ekg.config["jirabot:channel"], None, a, None, None))

initialize(None, None)
Ejemplo n.º 2
0
        getReminder = urllib.urlopen(domain + "time=" + i + "&method=gg")
        constReminder = getReminder.read()
        if constReminder != "":
            sendMessage = main.SendMessage()
            sendMessage.setUid(constReminder)
            sendMessage.setMsg(
                "Za %s dni/dzień stracisz ważność konta shell, aby dalej korzystać z konta, proszę o wpłatę, dane do przelewu sprawdzisz wysyłając do mnie wiadomość o treści !transfer\nJeśli nie chcesz dalej korzystać poinformuj o tym swojego admina.\nBrak informacji ze strony użytkownika lub wpłaty dzien po upływie terminu oznacza kasacje konta wraz z danymi."
                % i)
            sendMessage.sendMessageByUid()


def email_reminder():
    msg = open('content', 'r').read()
    s = smtplib.SMTP('localhost')
    for i in interval:
        get = urllib.urlopen(domain + "time=" + i +
                             "&method=email").read().split(',')
        for x in get:
            if x != '':
                tmp = x.split(':')
                try:
                    s.sendmail("*****@*****.**", tmp[1],
                               msg.format(tmp[1], tmp[0], i))
                    ekg.echo("Wysłano email z przypomnieniem do: %s" % tmp[1])
                except Exception as e:
                    ekg.echo(e)


ekg.timer_bind(86400, gg_reminder)
ekg.timer_bind(86400, email_reminder)
Ejemplo n.º 3
0
        elif text == "!rss":
            rssReader()
            return 1
    elif text == "!wersja":
        ekg.command("gg:msg %s Moja wersja to %s" % (uid, config.version))
        return 1
    elif text == "!autorzy":
        ekg.command("gg:msg %s Stworzyl mnie %s i nadal rozwija." % (uid, config.autor))
        return 1
    else:
        ekg.command(
            "gg:msg %s Witaj! Nazywam sie %s i jestem botem GG stworzonym i rozwijanym przez %s .\nBot zostal wylacznie do uzytku autora. Nie masz co szukac :)"
            % (uid, config.nazwa_kodowa, config.autor)
        )
        return 1


def connect_handler(session):
    ekg.echo("Sesja : " + session)
    sesja = ekg.session_get(session)
    if sesja.connected():
        ekg.echo("Połączony! Silnik i sto turbin poszło w ruch! :)")
    else:
        ekg.echo("W tym miejscu jeszcze nie połączony")


ekg.handler_bind("protocol-connected", connect_handler)
ekg.handler_bind("protocol-status", status_handler)
ekg.handler_bind("protocol-message-received", message_handler)
ekg.timer_bind(30, checkMail)
Ejemplo n.º 4
0
#!/usr/bin/python2.7
# -*- coding: ISO-8859-2 -*-

import ekg
import os

path = "/home/tacajushi/.ekg2/scripts/"


def ping():
    serversList = open(path + 'serversList', 'r')
    read_data = serversList.readlines()
    for i in read_data:
        i = i.replace('\n', '')
        response = os.system("ping -c 1 " + i + "  > /dev/null")
        if response != 0:
            response2 = os.system("ping -c 3 " + i + "  > /dev/null")
            if response2 != 0:
                ekg.echo(i + " nie działa")
    serversList.close()


ekg.timer_bind(900, ping)