Group Interactions
Join a Group
Players can request to join open or public groups. An OPEN group will allow players to automatically join, whereas a join request to a PUBLIC group will need to be approved by an admin before the player can join.
- Unreal Engine
- Unity
FString GroupId = "SomeGroupId";
FRegistry::Group.JoinGroup(
GroupId,
THandler<FAccelByteModelsJoinGroupResponse>::CreateWeakLambda(this, [this](const FAccelByteModelsJoinGroupResponse& Result)
{
// Do something if JoinGroup has been successful
}),
FErrorHandler::CreateWeakLambda(this, [](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if JoinGroup has an error
}));
string groupId = "SomeGroupId";
AccelBytePlugin.GetGroup().JoinGroup(groupId, result =>
{
if (result.IsError)
{
// Do something if JoinGroup has an error
Debug.Log($"Error JoinGroup, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if JoinGroup has been successful
}
});
Cancel Join Request
After a player requests to join a group, that request can be canceled.
- Unreal Engine
- Unity
FString GroupId = "SomeGroupId";
FRegistry::Group.CancelJoinGroupRequest(
GroupId,
THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateWeakLambda(this, [this](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if CancelJoinGroupRequest has been successful
}),
FErrorHandler::CreateWeakLambda(this, [](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if CancelJoinGroupRequest has an error
}));
string groupId = "SomeGroupId";
AccelBytePlugin.GetGroup().CancelJoinGroupRequest(groupId, result =>
{
if (result.IsError)
{
// Do something if CancelJoinGroupRequest has an error
Debug.Log($"Error CancelJoinGroupRequest, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if CancelJoinGroupRequest has been successful
}
});
Leave a Group
To leave a group, you can use this function.
- Unreal Engine
- Unity
FRegistry::Group.LeaveGroup(
THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateWeakLambda(this, [this](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if LeaveGroup has been successful
}),
FErrorHandler::CreateWeakLambda(this, [](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if LeaveGroup has an error
}));
AccelBytePlugin.GetGroup().LeaveGroup(result =>
{
if (result.IsError)
{
// Do something if LeaveGroup has an error
Debug.Log($"Error LeaveGroup, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if LeaveGroup has been successful
}
});
Invite a Player to a Group
Group admins can also invite players to join their group. A PRIVATE group can use this function to add new members. Players need to accept the invitation before they can join the group.
- Unreal Engine
- Unity
FString UserId = "SomeUserId";
FRegistry::Group.InviteUserToGroup(
UserId,
THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateWeakLambda(this, [this](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if InviteUserToGroup has been successful
}),
FErrorHandler::CreateWeakLambda(this, [](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if InviteUserToGroup has an error
}));
string otherUserId = "SomeOtherUserId";
AccelBytePlugin.GetGroup().InviteOtherUserToGroup(otherUserId, result =>
{
if (result.IsError)
{
// Do something if InviteOtherUserToGroup has an error
Debug.Log($"Error InviteOtherUserToGroup, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if InviteOtherUserToGroup has been successful
}
});
string userId = "123456789";
AccelBytePlugin.GetGroup().InviteOtherUserToGroup(userId, result =>
{
Debug.Log("Successfully invite user to the group!");
});
Kick a Group Member
Group admins can also kick group members out of the group.
- Unreal Engine
- Unity
FString UserId = "SomeUserId";
FRegistry::Group.KickGroupMember(
UserId,
THandler<FAccelByteModelsKickGroupMemberResponse>::CreateWeakLambda(this, [this](const FAccelByteModelsKickGroupMemberResponse& Result)
{
// Do something if KickGroupMember has been successful
}),
FErrorHandler::CreateWeakLambda(this, [](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if KickGroupMember has an error
}));
string otherUserId = "SomeOtherUserId";
AccelBytePlugin.GetGroup().KickGroupMember(otherUserId, result =>
{
if (result.IsError)
{
// Do something if KickGroupMember has an error
Debug.Log($"Error KickGroupMember, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if KickGroupMember has been successful
}
});
Get a List of Group Invitation Requests
Players can get the list of group invitation requests, to either accept or reject these invitations.
- Unreal Engine
- Unity
FAccelByteModelsLimitOffsetRequest GroupInvitationListConfiguration;
FRegistry::Group.GetGroupInvitationRequests(
GroupInvitationListConfiguration,
THandler<FAccelByteModelsGetMemberRequestsListResponse>::CreateWeakLambda(this, [this](const FAccelByteModelsGetMemberRequestsListResponse& Result)
{
// Do something if GetGroupInvitationRequests has been successful
}),
FErrorHandler::CreateWeakLambda(this, [](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetGroupInvitationRequests has an error
}));
AccelBytePlugin.GetGroup().GetGroupInvitationRequests(result =>
{
if (result.IsError)
{
// Do something if GetGroupInvitationRequests has an error
Debug.Log($"Error GetGroupInvitatioNRequests, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if GetGroupInvitationRequests has been successful
}
});
Accept Group Invitation Request
After getting the invitation list, players can accept an invitation.
- Unreal Engine
- Unity
FString GroupId = "SomeGroupId";
FRegistry::Group.AcceptGroupInvitation(
GroupId,
THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateWeakLambda(this, [this](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if AcceptGroupInvitation has been successful
}),
FErrorHandler::CreateWeakLambda(this, [](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if AcceptGroupInvitation has an error
}));
string groupId = "SomeGroupId";
AccelBytePlugin.GetGroup().AcceptGroupInvitation(groupId, result =>
{
if (result.IsError)
{
// Do something if AcceptGroupInvitation has an error
Debug.Log($"Error AcceptGroupInvitation, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if AcceptGroupInvitation hasbeen successful
}
});
Reject Group Invitation Request
Players can also reject any invitation request.
- Unreal Engine
- Unity
FString GroupId = "SomeGroupId";
FRegistry::Group.RejectGroupInvitation(
GroupId,
THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateWeakLambda(this, [this](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if RejectGroupInvitation has been successful
}),
FErrorHandler::CreateWeakLambda(this, [](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if RejectGroupInvitation has an error
}));
string groupId = "SomeGroupId";
AccelBytePlugin.GetGroup().RejectGroupInvitation(groupId, result =>
{
if (result.IsError)
{
// Do something if RejectGroupInvitation has an error
Debug.Log($"Error RejectGroupInvitation, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if RejectGroupInvitation has been successful
}
});
Get List of Group Member Join Requests
Group admins can get the list of group member join requests, to either approve or reject them.
- Unreal Engine
- Unity
FString GroupId = "SomeGroupId";
FAccelByteModelsLimitOffsetRequest GroupRequestListConfiguration;
FRegistry::Group.GetGroupJoinRequests(
GroupId,
GroupRequestListConfiguration,
THandler<FAccelByteModelsGetMemberRequestsListResponse>::CreateWeakLambda(this, [this](const FAccelByteModelsGetMemberRequestsListResponse& Result)
{
// Do something if GetGroupJoinRequests has been successful
}),
FErrorHandler::CreateWeakLambda(this, [](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetGroupjoinRequests has an error
}));
string groupId = "SomeGroupId";
AccelBytePlugin.GetGroup().GetGroupJoinRequests(groupId, result =>
{
if (result.IsError)
{
// Do something if GetGroupjoinRequests has an error
Debug.Log($"Error GetGroupJoinRequests, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if GetGroupJoinRequests has been successful
}
});
Accept Group Member Join Request
After getting the list of join requests, a group admin can accept them to the group.
- Unreal Engine
- Unity
FString UserId = "SomeUserId";
FRegistry::Group.AcceptGroupJoinRequest(
UserId,
THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateWeakLambda(this, [this](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if AcceptGroupJoinRequest has been successful
}),
FErrorHandler::CreateWeakLambda(this, [](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if AcceptGroupJoinRequest has an error
}));
string otherUserId = "SomeOtherUserId";
AccelBytePlugin.GetGroup().AcceptOtherJoinRequest(otherUserId, result =>
{
if (result.IsError)
{
// Do something if AcceptOtherJoinRequest has an error
Debug.Log($"Error AcceptOtherJoinRequest, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if AcceptOtherJoinRequest has been successful
}
});
Reject Group Member Join Request
Group admin can also reject any member join request.
- Unreal Engine
- Unity
FString UserId = "SomeUserId";
FRegistry::Group.RejectGroupJoinRequest(
UserId,
THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateWeakLambda(this, [this](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if RejectGroupJoinRequest has been successful
}),
FErrorHandler::CreateWeakLambda(this, [](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if RejectGroupJoinRequest has an error
}));
string otherUserId = "SomeOtherUserId";
AccelBytePlugin.GetGroup().RejectOtherJoinRequest(otherUserId, result =>
{
if (result.IsError)
{
// Do something if RejectOtherJoinRequest has an error
Debug.Log($"Error RejectOtherJoinRequest, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if RejectOtherJoinRequest has been successful
}
});
Get Bulk Users' Presence
You can use this endpoint to get users' presence information in bulk.
- Unreal Engine
- Unity
TArray<FString> UserIds;
FRegistry::Lobby.BulkGetUserPresence(
UserIds,
THandler<FAccelByteModelsBulkUserStatusNotif>::CreateWeakLambda(this, [this](const FAccelByteModelsBulkUserStatusNotif& Result)
{
// Do something if BulkGetUserPresence has been successful
}),
FErrorHandler::CreateWeakLambda(this, [](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if BulkGetUserPresence has an error
}));
var userIds = new List<string>();
userIds.Add("SomeTargetUserId1");
userIds.Add("SomeTargetUserId2");
userIds.Add("SomeTargetUserId3");
AccelBytePlugin.GetLobby().Connect();
AccelBytePlugin.GetLobby().BulkGetUserPresence(userIds.ToArray(), result =>
{
if (result.IsError)
{
// Do something if BulkGetUserPresence has an error
Debug.Log($"Error BulkGetUserPresence, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if BulkGetUserPresence has been successful
}
});