Exemple #1
0
        internal async Task <HashSet <ulong> > GetMyChatGroupIDs()
        {
            if (!Client.IsConnected)
            {
                return(null);
            }

            CChatRoom_GetMyChatRoomGroups_Request request = new CChatRoom_GetMyChatRoomGroups_Request();

            SteamUnifiedMessages.ServiceMethodResponse response;

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

                return(null);
            }

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

                return(null);
            }

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

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

            return(body.chat_room_groups.Select(chatRoom => chatRoom.group_summary.chat_group_id).ToHashSet());
        }
Exemple #2
0
        static void OnLoggedOn()
        {
            // now that we're logged onto Steam, lets query the IPlayer service for our badge levels

            // first, build our request object, these are autogenerated and can normally be found in the SteamKit2.Unified.Internal namespace
            //CPlayer_GetGameBadgeLevels_Request req = new CPlayer_GetGameBadgeLevels_Request {
            //    // we want to know our 440 (TF2) badge level
            //    appid = 440,
            //};

            bool send_chat = true;

            if (send_chat)
            {
                {
                    // ha ezt küldöd, akkor fogsz notificationoket kapni
                    uint chatMode = 2;
                    ClientMsgProtobuf <CMsgClientUIMode> request = new ClientMsgProtobuf <CMsgClientUIMode>(EMsg.ClientCurrentUIMode)
                    {
                        Body = { chat_mode = chatMode }
                    };
                    steamClient.Send(request);
                }



                CChatRoom_SendChatMessage_Request req = new CChatRoom_SendChatMessage_Request {
                    message                = "Bot logged in.",
                    messageSpecified       = true,
                    chat_group_id          = myGroupId,
                    chat_group_idSpecified = true,
                    chat_id                = defualtChatId,
                    chat_idSpecified       = true
                };
                chatRoomService.SendMessage(x => x.SendChatMessage(req));
            }
            else
            {
                CChatRoom_GetMyChatRoomGroups_Request req = new CChatRoom_GetMyChatRoomGroups_Request {
                    // empty message
                };


                // now lets send the request, this is done by building an expression tree with the IPlayer interface
                myJobID = chatRoomService.SendMessage(x => x.GetMyChatRoomGroups(req));
            }



            // alternatively, the request can be made using SteamUnifiedMessages directly, but then you must build the service request name manually
            // the name format is in the form of <Service>.<Method>#<Version>
            //steamUnifiedMessages.SendMessage("Player.GetGameBadgeLevels#1", req);
        }