session-pysogs icon indicating copy to clipboard operation
session-pysogs copied to clipboard

[QUESTION] How to get room's name in python?

Open qdhj opened this issue 2 years ago • 1 comments

For example, in sogs/routes/dm.py

@auth.user_required
def send_inbox(sid): 

how to add

    if room=sudoku {do this}
    if room=atari {do that}

Many thanks in advance

qdhj avatar Nov 08 '23 00:11 qdhj

For endpoints that are room specific they have a room argument, and room.name is the name of the room. For example, sogs/routes/rooms.py has get_one_room for the /room/NAME endpoint that has such a room argument.

send_inbox, however, doesn't have a room at all as it is a general SOGS server feature and not a room-specific command; the user issuing it could be in one or 10 rooms on the server, but we don't know which one when the send_inbox endpoint is invoked.

jagerman avatar Nov 08 '23 16:11 jagerman