예제 #1
0
파일: __init__.py 프로젝트: pjurik2/javabot
    def __init__(self, bot):
        self.bot = bot

        self.channel = status_list(bot, "channel")
        self.reset_colors()
        seed()
        self.bot.channel = self.channel

        self.bot.events.add(
            self,
            "BNCSChat",
            -1,
            0,
            0x01,
            self.EID_SHOWUSER,
            0x02,
            self.EID_JOIN,
            0x03,
            self.EID_LEAVE,
            0x04,
            self.EID_WHISPER,
            0x05,
            self.EID_TALK,
            0x06,
            self.EID_BROADCAST,
            0x07,
            self.EID_CHANNEL,
            0x09,
            self.EID_USERFLAGS,
            0x0A,
            self.EID_WHISPERSENT,
            0x0D,
            self.EID_CHANNELFULL,
            0x0E,
            self.EID_CHANNELDOESNOTEXIST,
            0x0F,
            self.EID_CHANNELRESTRICTED,
            0x12,
            self.EID_INFO,
            0x13,
            self.EID_ERROR,
            0x17,
            self.EID_EMOTE,
        )
        self.bot.events.add(self, "ui", 0, 0, "start", self.ui_start, "reload", self.reload_list)
        self.bot.events.add(self, "bot", 0, 0, "disc", self.clear)

        self.bot.events.add(self, "commands", 0, 0, "start", self.cmd_start)
        self.cmd_start()
예제 #2
0
파일: __init__.py 프로젝트: ensyde/javabot
    def recv_cand(self, packet):
        cookie, status, num = unpack('<L2B', packet['data'][:6])
        users = packet['data'][6:].split('\0')[:-1]
        users.sort()

        cmd = self.responses.pop(cookie)
        

        if num == 0 and status == 0x00:
            self.bot.respond(cmd, 'No candidates found.')
            return

        self.bot.respond(cmd, find_cand_results[status])
        
        self.cand = status_list(self.bot, 'cand')
        self.cand.tag, self.cand.name = cmd['arg'].split(' ', 1)

        if self.creating == False:
            self.bot.events.call('ui', 'list', 'add',
                                 ['list', 'cand', 'Candidates', 31, 19,
                                  'Username', 0, 175,
                                  'Type', 0, 75],  {})
            self.bot.events.call('ui', 'list', 'cand', 'menu',
                                 ['Invite', self.create_invite])

        self.creating = True

        for user in users:
            if self.bot.channel.has_user(user):
                info = {'username': user,
                        'type': 'Channel'}
            else:
                info = {'username': user,
                        'type': 'Friend'}

            self.cand.add_user(user, info, -1)

        self.reset_cand_list()
예제 #3
0
파일: friends.py 프로젝트: ensyde/javabot
    def __init__(self, bot):
        self.bot = bot
        
        self.friends = status_list(self.bot, 'friends')
        self.bot.friends = self.friends
        self.friends.updating = []
        self.friends.online = 0

        self.bot.events.add(self, 'bot', 2, 0,
                            'connected', self.in_friends,
                            'disc', self.out_friends,
                            'idle', self.get_friends)

        self.bot.events.add(self, 'BNCSRecv', -1, 0,
                            0x65, self.recv_friends,
                            0x66, self.recv_update,
                            0x67, self.recv_new,
                            0x68, self.recv_remove,
                            0x69, self.recv_move)

        self.bot.events.add(self, 'ui', 0, 0,
                            'reload', self.ui_reload)

        self.has_ui = False
예제 #4
0
파일: __init__.py 프로젝트: ensyde/javabot
    def in_clan(self):
        self.clanned = True
        self.clan = status_list(self.bot, 'clan')
        self.bot.clan = self.clan

        self.ui_start()