Steamkit2 给特定用户的消息

Steamkit2 Message to specific user

一旦有人将机器人添加到好友列表中,机器人就会接受请求并向新 "friend" 发送消息,我希望它也向我的 steamID 发送消息,但由于某种原因它不工作

它确实接受并向新朋友发送消息,但不向我发送消息,

static void OnFriendsList(SteamFriends.FriendsListCallback callback)
        {
            Thread.Sleep(2500);
            foreach(var friend in callback.FriendList)
            {
                if (friend.Relationship == EFriendRelationship.RequestRecipient)
                {
                    steamFriends.AddFriend(friend.SteamID);
                    Thread.Sleep(500);
                    steamFriends.SendChatMessage(friend.SteamID, EChatEntryType.ChatMsg, "Hello I am a bot");
                    steamFriends.SendChatMessage(new SteamID { Value = "76561198145164176" }, EChatEntryType.ChatMsg, "A friend had added me!"); //This ain't working
                }
            }
        }

值也出现语法错误,

Severity    Code    Description Project File    Line
Error   CS0117  'SteamID' does not contain a definition for 'Value' Tutorialbot C:\Users\Stagiair\Documents\Visual Studio 2015\Projects\Tutorialbot\Tutorialbot\Program.cs  180

文档:http://www.nudoq.org/#!/Packages/SteamKit2/SteamKit2/SteamFriends/M/SendChatMessage

根据消息,"Value" 不是 SteamID 对象的字段。查看 SteamID,您要查找的项目似乎是 AccountID。

基于 constructors for SteamID,它看起来像而不是:

steamFriends.SendChatMessage(new SteamID { Value = "76561198145164176" }, EChatEntryType.ChatMsg, "A friend had added me!");

你会想改用这个:

steamFriends.SendChatMessage(new SteamID(76561198145164176), EChatEntryType.ChatMsg, "A friend had added me!");