Package: gather-client-ws
Installationpip install gather-client-wsDocumentationAuthGenerate yourAPI_KEYhere:https://gather.town/apiKeysBasic Usageimportasynciofromgather_client_wsimportGatherClientasyncdefproducer(client):awaitclient.set_text_status("new status text")awaitclient.set_emoji_status("😁")asyncdefmain():client=GatherClient(api_key=API_KEY,space_id=SPACE_ID)awaitclient.run(producer)asyncio.run(main())# Output[2023-03-1922:44:57,340][INFO]Connectedtowss://engine-a00a0.aaa0-.prod.do.gather.town:443/[2023-03-1922:44:57,637][INFO]ConnectedasuserUSER_IDAdding extra args and kwargsimportasynciofromgather_client_wsimportGatherClientasyncdefproducer(client,*args,**kwargs):awaitclient.set_text_status("new status text")awaitclient.set_emoji_status("😁")print(args)print(kwargs)asyncdefmain():client=GatherClient(api_key=API_KEY,space_id=SPACE_ID)awaitclient.run(producer,'arg',k='kwarg')asyncio.run(main())# Output[2023-03-1922:44:57,340][INFO]Connectedtowss://engine-a00a0.aaa0-.prod.do.gather.town:443/[2023-03-1922:44:57,637][INFO]ConnectedasuserUSER_ID('arg',){'k':'kwarg'}Server response callbackA callback function can be defined, this function will receive theclientand theServerClientBatchmessage:...asyncdefcallback(client,server_response):foreventinserver_response.events:print(event.WhichOneof("event"))asyncdefproducer(client):awaitasyncio.sleep(30)# hold the connection for 30 secondsasyncdefmain():client=GatherClient(api_key=API_KEY,space_id=SPACE_ID,callback=callback)awaitclient.run(producer)asyncio.run(main())# Output[2023-03-1922:56:33,840][INFO]Connectedtowss://engine-a00a0.aaa0-.prod.do.gather.town:443/[2023-03-1922:56:34,351][INFO]ConnectedasuserUSER_IDtransactionStatustransactionStatusserverHeartbeatserverHeartbeatserverHeartbeatLogger levelIt is possible to define the client log level.importlogging...asyncdefmain():client=GatherClient(api_key=API_KEY,space_id=SPACE_ID,log_level=logging.DEBUG)awaitclient.run(producer)asyncio.run(main())# Output[2023-03-1923:01:08,274][INFO]Connectedtowss://engine-a00a0.aaa0-a.prod.do.gather.town:443/[2023-03-1923:01:08,581][INFO]ConnectedasuserUSER_ID[2023-03-1923:01:08,582][DEBUG]Receivingmessages[2023-03-1923:01:08,582][DEBUG]Heartbeatsent[2023-03-1923:01:08,743][DEBUG]Messagereceived:events{transactionStatus{txnId:3675756270succeeded:true}}events{transactionStatus{txnId:226152914succeeded:true}}[2023-03-1923:01:18,514][DEBUG]Messagereceived:events{serverHeartbeat{lastRTT:4240423196}}ActionsListing the available actions:...print(client.available_actions)# Output['client_heartbeat','client_backup_heartbeat','update_subscriptions','move','set_affiliation','set_status','spotlight','ring','ban','kick','set_impassable','chat','interact','enter_whisper','leave_whisper','set_emoji_status','actively_speaking','set_name','set_text_status','teleport','exit','enter','set_work_condition','respawn','spawn','ghost','init','set_outfit_string','shoot_confetti','set_event_status','set_in_conversation','set_current_desk','set_current_area','set_image_pointer','set_go_kart_id','map_set_dimensions','map_set_collisions','map_set_background_image_path','map_set_foreground_image_path','map_set_sprites','map_set_spawns','map_set_spaces','map_set_portals','map_set_announcer','map_set_assets','map_set_objects','map_set_name','map_set_mute_on_entry','map_set_use_drawn_b_g','map_set_walls','map_set_floors','map_set_areas','map_add_object','map_delete_object','map_set_spawn','set_is_alone','map_set_mini_map_image_path','map_set_enabled_chats','map_set_description','map_set_decoration','map_set_tutorial_tasks','play_sound','map_set_script','set_is_mobile','set_screen_pointer','set_emote_v2','set_focus_mode_end_time','map_delete_object_by_id','custom_action','block','set_item_string','trigger_item','notify','set_follow_target','request_to_lead','enter_portal','set_manual_video_src','set_subtitle','player_updates_session','map_move_object','chat_message_updated','fx_shake_object','fx_shake_camera','register_command','send_command','speaker_updates_session','add_inventory_item','remove_inventory_item','set_vehicle_id','set_speed_modifier','high_five','update_space_items','stop_sound','hip_to_be_square','craft','trigger_inventory_item','set_allow_screen_pointer','precompute_enter','request_mute','set_desk_info','map_set_nooks','request_to_join_nook','update_nook_permission','wave','set_pronouns','set_title','set_timezone','set_phone','set_description','set_profile_image_url','set_personal_image_url','set_away','set_city','set_country','set_start_date','start_recording']Accessing the basic documentation of each action:...print(client.set_text_status.__doc__)# Outputset_text_statusArgs:text_status(str)target_id(str)ORhelp(client.craft)# OutputHelponmethodmethodinmodulegather_client_ws.actions:asyncmethod(*args,**kwargs)methodofgather_client_ws.client.GatherClientinstancecraftArgs:inputs(InputsEntry)