Справочник функций
Godot 4 · GDScript · Friends
cancel_invitation
Cancels an outgoing friend invitation you previously sent.
Asynchronous (result via signal)
Signature
cancel_invitation(invitation_id: String) -> voidWhat it does
POSTs /friends/invitations/cancel. Only the player who sent the invitation can cancel it; on failure error_code explains why.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| invitation_id | String | required | The id of an outgoing invitation (only the sender may cancel it). |
How to call it
Connect invitation_cancelled first, then call cancel_invitation(). No-op with error_code internal when there is no active session or the id is empty.
Result signal: invitation_cancelled(success: bool, error_code: String)
Example
Gamdato.invitation_cancelled.connect(_on_cancelled)
Gamdato.cancel_invitation(invitation_id)
func _on_cancelled(ok: bool, error_code: String) -> void:
if ok: print("cancelled")
else: print("failed: %s" % error_code)Use cases
- Let a player retract a friend request from their outgoing list.
- Clean up a duplicate or mistaken invite before it's answered.