Beispiel #1
0
        internal async Task <ulong> GetClanChatGroupID(ulong steamID)
        {
            if ((steamID == 0) || !new SteamID(steamID).IsClanAccount)
            {
                ArchiLogger.LogNullError(nameof(steamID));

                return(0);
            }

            if (!Client.IsConnected)
            {
                return(0);
            }

            CClanChatRooms_GetClanChatRoomInfo_Request request = new CClanChatRooms_GetClanChatRoomInfo_Request {
                autocreate = true,
                steamid    = steamID
            };

            SteamUnifiedMessages.ServiceMethodResponse response;

            try {
                response = await UnifiedClanChatRoomsService.SendMessage(x => x.GetClanChatRoomInfo(request));
            } catch (Exception e) {
                ArchiLogger.LogGenericWarningException(e);

                return(0);
            }

            if (response == null)
            {
                ArchiLogger.LogNullError(nameof(response));

                return(0);
            }

            if (response.Result != EResult.OK)
            {
                return(0);
            }

            CClanChatRooms_GetClanChatRoomInfo_Response body = response.GetDeserializedResponse <CClanChatRooms_GetClanChatRoomInfo_Response>();

            return(body.chat_group_summary.chat_group_id);
        }
Beispiel #2
0
        internal async Task <ulong> GetClanChatGroupID(ulong steamID)
        {
            if ((steamID == 0) || !new SteamID(steamID).IsClanAccount)
            {
                throw new ArgumentOutOfRangeException(nameof(steamID));
            }

            if (Client == null)
            {
                throw new InvalidOperationException(nameof(Client));
            }

            if (!Client.IsConnected)
            {
                return(0);
            }

            CClanChatRooms_GetClanChatRoomInfo_Request request = new() {
                autocreate = true,
                steamid    = steamID
            };

            SteamUnifiedMessages.ServiceMethodResponse response;

            try {
                response = await UnifiedClanChatRoomsService.SendMessage(x => x.GetClanChatRoomInfo(request)).ToLongRunningTask().ConfigureAwait(false);
            } catch (Exception e) {
                ArchiLogger.LogGenericWarningException(e);

                return(0);
            }

            if (response.Result != EResult.OK)
            {
                return(0);
            }

            CClanChatRooms_GetClanChatRoomInfo_Response body = response.GetDeserializedResponse <CClanChatRooms_GetClanChatRoomInfo_Response>();

            return(body.chat_group_summary.chat_group_id);
        }