def h_bridge_names_req(bot, target, source, name_query): for work in mc_work: if work.minecraft.name.lower() != target.lower(): continue name = work.minecraft_state.map_name or work.minecraft.display or target if name_query and name_query.lower() not in (name.lower(), target.lower()): continue (state, value) = yield query(work, 'players') if state == 'success': bridge.notice( bot, target, 'NAMES_RES', source, name, [sub_name(work, n) for n in value.split()]) elif state == 'failure': bridge.notice(bot, target, 'NAMES_ERR', source, name, value)
def h_bridge_names_req(bot, target, source, query): work = te_work.get(target.lower()) if work is None: return name = world_name(work) if query and name.lower() not in (query.lower(), '+'+query.lower()): return if not hasattr(work, 'terraria_protocol') or work.terraria_protocol.stage < 3: bridge.notice(bot, target, 'NAMES_ERR', source, name, 'No contact with server.') return names = work.terraria_protocol.players.values() names = [bridge.substitute_name(target, n) for n in names] bridge.notice(bot, target, 'NAMES_RES', source, name, names)