INNER CODE UNIT · Python

handle_chat

zapek/Xeres · scripts/bot/bot.py:203

def handle_chat(own_id):
	conn = stomp.WSStompConnection([(XERES_API_HOST, XERES_API_PORT)], ws_path='/ws')
	conn.set_listener('', StompListener(conn, own_id))
	connect_and_subscribe(conn)
	while True:
		time.sleep(60)


def handle_incoming_room_message(conn, own_id, destination_id, room_id, sender, gxs_sender, content):
	own_nickname = own_id['name'].lower()

	# We need to do that because what we say in the room is echoed back, obviously
	if gxs_sender == own_id['gxsId']['bytes']:
		return

	lower_content = content.lower()

	if not (lower_content.startswith("@" + own_nickname + " ") or lower_content.startswith(own_nickname + ": ") or lower_content.startswith("@" + own_nickname + ": ")):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…