예제 #1
0
    def __init__(self, Hakcbot):
        self.Hakcbot = Hakcbot
        self.Execute = Execute(self.Hakcbot)
        self.Automate = Automate(self.Hakcbot)
        self.Spam = Spam(self.Hakcbot)

        self.linecount = 0
예제 #2
0
class Run:
    def __init__(self, Hakcbot):
        self.Hakcbot = Hakcbot
        self.Execute = Execute(self.Hakcbot)
        self.Automate = Automate(self.Hakcbot)
        self.Spam = Spam(self.Hakcbot)

        self.linecount = 0

    def Processes(self):

        threading.Thread(target=self.Hakc).start()
        threading.Thread(target=self.Hakc2).start()

    def Hakc(self):
        rb = ''
        try:
            while True:
                rb = rb + self.Hakcbot.s.recv(1024).decode('utf-8', 'ignore')
                chat = rb.split('\n')
                rb = chat.pop()

                for line in chat:
                    if ('PING :tmi.twitch.tv\r' == line):
                        print(line)
                        self.linecount = 0
                        self.Automate.linecount = self.linecount
                        self.Hakcbot.s.send(
                            'PONG :tmi.twitch.tv\r\n'.encode("utf-8"))
                    elif ('JOIN' in line):
                        pass
                    else:
                        spam = self.Spam.Main(line)
                        if (not spam):
                            self.Execute.Main(line)
                            self.linecount += 1
                            self.Automate.linecount = self.linecount
                        else:
                            pass
        except Exception as E:
            print('Main Process Error: {}'.format(E))

    def Hakc2(self):
        key = ['Sub', 'Commands', 'Discord', 'Github']
        value = [99, 87, 59, 47]

        try:
            loop = asyncio.new_event_loop()
            asyncio.set_event_loop(loop)
            loop.run_until_complete(
                asyncio.gather(self.Automate.Timers(key[0], value[0]),
                               self.Automate.Timers(key[1], value[1]),
                               self.Automate.Timers(key[2], value[2]),
                               self.Automate.Timers(key[3], value[3])))

        except Exception as E:
            print('AsyncIO General Error')
예제 #3
0
    def __init__(self):
        self.sock = socket()
        self.Init = Init(self)

        self.Automate = Automate(self)
        self.Threads  = Threads(self)
        self.Spam     = Spam(self)
        self.Execute  = Execute(self)
        self.Commands = Commands(self)
        self.AccountAge = AccountAge(self)

        self.online = False
        self.linecount = 0
        self.last_message = 0
        self.uptime_message = 'hakbot is still initializing! try again in a bit.'

        self.announced_titles = {}