async def set_prefix(data): logging.info(f"Data received: {data}") for prefix in data: dkeys = prefix.keys() session = Session() if 'channel_id' in dkeys: target = session.query(Channels).get(prefix['channel_id']) elif 'server_id' in dkeys: target = session.query(Servers).get(prefix['server_id']) else: target = None if target and target.prefix == prefix.get('prefix', None): update_live_prefix(target.id, target.prefix)
def receive_after_insert(mapper, connection, channel): update_live_prefix(channel.id, channel.prefix)
def receive_after_insert(mapper, connection, server): update_live_prefix(server.id, server.prefix)