Reference des fonctions
Godot 4 · GDScript · Groups & clans
join_group
Directly joins an OPEN group.
Asynchronous (result via signal)
Signature
join_group(group_id: String) -> voidWhat it does
POSTs /groups/join. Works only for open groups; for request/invite_only groups use create_group_request() instead. error_code may be not_open / group_full / already_in_group / not_found / forbidden.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| group_id | String | required | Id of the group to join. Must be a group whose join_policy is "open". |
How to call it
Connect group_joined first, then call join_group(). For non-open groups this fails with not_open; use create_group_request().
Result signal: group_joined(success: bool, group_id: String, error_code: String)
Example
Gamdato.group_joined.connect(_on_joined)
Gamdato.join_group(group_id) # open groups only
func _on_joined(ok: bool, group_id: String, error_code: String) -> void:
if ok: print("Joined %s" % group_id)
else: print("Failed: %s" % error_code) # e.g. not_open, group_fullUse cases
- Let a player join an open clan with one tap.
- Wire up a 'Join' button on each open group in the browse list.