2

一旦有人将机器人添加到好友列表中,机器人就会接受请求并向新的“朋友”发送消息,我希望它也向我的 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
                }
            }
        }

在 Value 处也出现语法错误,

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

4

1 回答 1

0

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

基于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!");
于 2015-09-21T13:56:15.077 回答