gpt4 book ai didi

c# - Steamkit2 给特定用户的消息

转载 作者:太空宇宙 更新时间:2023-11-03 15:33:41 27 4
gpt4 key购买 nike

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

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

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

最佳答案

根据消息,“值”不是 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!");

关于c# - Steamkit2 给特定用户的消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32696828/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com