def channel_user_joined_channel(bot,origin,data): if data[2] not in bot.channel_channels: bot.channel_channels[data[2]] = {} bot.channel_channels[data[2]][data[1]] = [data[1],data[0],datetime.now(),None] l = len(bot.channel_channels[data[2]]) CHANNEL_MAX = bot.config.channel_limit #banlist management nick = normalize_nick(data[0]).lower() if data[1] in bot.clan_roster: if bot.config.promote_clan: bot.write_packet( ID.HON_CS_CHANNEL_PROMOTE, data[2], data[1] ) if not 'upgrades' in bot.clan_roster[data[1]]: bot.clan_roster[data[1]]['upgrades'] = user_upgrades(data, 1) if CHANNEL_MAX == 0: return if l > CHANNEL_MAX: l -= CHANNEL_MAX for i in sorted(bot.channel_channels[data[2]].values(), key=lambda x:x[2]): if l <= 0:break nick = normalize_nick(i[1]) if i[0] not in bot.clan_roster and nick not in bot.config.whitelist and i[1].split(']')[0] not in ['[GM','[S2']: bot.write_packet(ID.HON_CS_CHANNEL_KICK,data[2],i[0]) sleep(0.5) bot.write_packet(ID.HON_CS_WHISPER,i[1],'Sorry, too many people in channel, we need some place for active members') l -= 1 sleep(0.5)
def channel_user_joined_channel(bot,origin,data): if data[0] not in bot.channel_channels: bot.channel_channels[data[0]] = {} bot.channel_channels[data[0]][data[2]] = [data[2],data[1],datetime.now(),None] l = len(bot.channel_channels[data[0]]) CHANNEL_MAX = bot.config.channel_limit #banlist management nick = normalize_nick(data[1]).lower() if data[2] in bot.clan_roster: if bot.config.promote_clan: bot.write_packet( ID.HON_CS_CHANNEL_PROMOTE, data[0], data[2] ) if not 'upgrades' in bot.clan_roster[data[2]]: bot.clan_roster[data[2]]['upgrades'] = user_upgrades(data, 1) if CHANNEL_MAX == 0: return if l > CHANNEL_MAX: l -= CHANNEL_MAX for i in sorted(bot.channel_channels[data[0]].values(), key=lambda x:x[2]): if l <= 0:break nick = normalize_nick(i[1]) if i[0] not in bot.clan_roster and nick not in bot.config.whitelist and i[1].split(']')[0] not in ['[GM','[S2']: bot.write_packet(ID.HON_CS_CHANNEL_KICK,data[2],i[0]) sleep(0.5) bot.write_packet(ID.HON_CS_WHISPER,i[1],'Sorry, too many people in channel, we need some place for active members') l -= 1 sleep(0.5)
def channel_joined_channel(bot,origin,data): bot.channel_channels[data[1]] = dict([[m[1],[m[1],m[0],datetime.now(),None]] for m in data[-1]]) for m in data[-1]: if m[1] in bot.clan_roster: if not 'upgrades' in bot.clan_roster[m[1]]: bot.clan_roster[m[1]]['upgrades'] = user_upgrades(m) # Default topic setting topic = data[3] if ( len(topic) == 0 ) or ( topic == "Welcome to the {0} clan channel!".format( bot.clan_info['name'] ) ): cname = bot.id2chan[data[1]] if getTopic(bot, cname): bot.write_packet( ID.HON_CS_UPDATE_TOPIC, data[1], getTopic(bot, cname) )
def channel_joined_channel(bot,origin,data): bot.channel_channels[data[1]] = dict([[m[1],[m[1],m[0],datetime.now(),None]] for m in data[-1]]) for m in data[-1]: if m[1] in bot.clan_roster: if not 'upgrades' in bot.clan_roster[m[1]]: bot.clan_roster[m[1]]['upgrades'] = user_upgrades(m) # Default topic setting cname = bot.id2chan[data[1]] topic = data[3] if 'name' in bot.clan_info: if ( len(topic) == 0 ) or ( topic == "Welcome to the {0} clan channel!".format( bot.clan_info['name'] ) ): if getTopic(bot, cname): bot.write_packet( ID.HON_CS_UPDATE_TOPIC, data[1], getTopic(bot, cname) ) if cname in bot.config.default_auth: bot.write_packet( ID.HON_CS_CHANNEL_AUTH_ENABLE, data[1] )