Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steam group chats no longer work? #408

Closed
ghost opened this issue Jun 25, 2017 · 12 comments
Closed

Steam group chats no longer work? #408

ghost opened this issue Jun 25, 2017 · 12 comments

Comments

@ghost
Copy link

ghost commented Jun 25, 2017

I've been registering SteamFriends.ChatMsgCallback but it never seems to fire. All other functionality does seem to work - it's just the group ones. Strangely, it does seem to recognize when I go in and out of a group chat.




        static void OnGroupMessaged(SteamFriends.ChatMsgCallback obj)
        {
            throw new NotImplementedException();
        }

      CallbackManager.Subscribe < SteamFriends.ChatMsgCallback>(SteamBotChat.OnGroupMessaged);


@JustArchi
Copy link
Contributor

JustArchi commented Jun 25, 2017

Sounds like chat ghost to me - typical chat room restart in which nobody is in chat anymore. Happens on usual basis with each group chat.

There is no good way to fight with it either, most stupid one is simply joining the chat on usual basis, such as each hour. A bit better one is doing the same but only when you don't register any activity such as chat message or join/leave, this could indicate that chat ghosted as well.

The best one that I use right now is tracking number of active users internally and checking number of chat users on steam community group page. If it's suddenly less than the amount that bot registered then very likely this is a ghost as well. Works decent, as long as you do that on usual basis.

@ghost
Copy link
Author

ghost commented Jun 25, 2017

Any ideas on how to go about this more practically? I'm trying to bot a few dozen group chats and process what's being said. I'm pretty new to Steamkit and bots in general, used to work with making games.

@ghost
Copy link
Author

ghost commented Jun 25, 2017

Any examples would be sweet too.

@Netshroud
Copy link

@JustArchi any idea what the Steam client does to prevent this? Or does it suffer from this as well?

@ghost
Copy link
Author

ghost commented Jun 25, 2017

I'm surprised Steam does even anything. I've been logging into the same account every two minutes for debugging, got it also logged in on another computer, and haven't gotten any issues at all. This is really a great library.

@JustArchi
Copy link
Contributor

JustArchi commented Jun 25, 2017

@ItsEddie Most practical yet very stupid approach is like I said, registering last chat event for each chatID. For example DateTime LastChatEvent. You set it to DateTime.UtcNow on ChatActionResultCallback, ChatEnterCallback, ChatMemberInfoCallback, ChatMsgCallback and ChatRoomInfoCallback that arrives for given chatID, you have ID in each callback.

Each chat has a Timer that triggers each minute. If DateTime.UtcNow - LastChatEvent > TimeSpan.FromMinutes(1) (or anything other you set as "might ghost due to lack of activity") you trigger SteamFriends.JoinChat(chatID) that will also result in setting it back to DateTime.UtcNow because it triggers ChatEnterCallback. This is the best I can come up with without bringing in HTTP check.

Obviously this approach fights with the problem, but absolutely can't tell you when ghost in fact happens. Ghost detecthing requires HTTP checking of group page, at least until I find out something better. This works for you, can't work for me (check below why).

@Netshroud Absolutely nothing. If chat ghosts, there are no messages happening, nobody is leaving/entering, and the only "indicator" that chat ghost happened is when one of chat visitors go offline - then you have a nice fuckup of user being on chat with "last online: 5 minutes ago" or something like that. Unless you manually rejoin that chat, you're in limbo.

Basically I added very "stupid" way of detecting chat ghosts - like pointed out above, so when chat ghost happens my bot is messaging all chat visitors about ghost, then reconnects to chat itself. This is working just fine and allowed me to fight with this almost perfectly, since the worst case is bot telling you "chat ghosted, close tab then click here to reconnect: steam://joinchat/..."

@JustArchi
Copy link
Contributor

JustArchi commented Jun 25, 2017

And BTW this issue is driving me crazy as well - from SK2 there is absolutely no way of detecting that whatsoever, which is caused by Steam client not being aware of it at all. Sure you can "ignore" this problem by doing SteamFriends.JoinChat(chatID) on usual basis (e.g. like I suggested above, each minute) but detecting the problem is far more complicated and only possible by comparing some external resource (in my case, group page stating number of chat users) with what bot actually knows (number of chat visitors calculated from initial chat members list callback + tracking chat actions such as entering/leaving).

Hence if you just want to ignore the issue, call SteamFriends.JoinChat(chatID) on usual basis. If you want to detect the ghost and do something with it, like letting people know, you'll need some external resource.

(I also have on TODO finding a better way to fight with this, maybe 100% SK2-based)

@ghost
Copy link
Author

ghost commented Jun 25, 2017

Your approach is exactly how I created a spam filter, well almost the same.


                Console.WriteLine(SteamBot.SteamFriends.GetFriendPersonaName(ID) + " said: " + Message);
                LogOther(ID, callback.Message);

                if (!SpamProtection.ContainsKey(ID))
                {
                    LastMessages[ID] = Message;
                    SpamProtection[ID] = DateTime.Now;
                    ChatSessions[ID] = ChatFactory.Create(ChatterBotType.PANDORABOTS,
                        "b0dafd24ee35a477").CreateSession();

                    new Thread(() => ThinkofResponse(ID, Message)).Start();
                }
                else if ((DateTime.Now - SpamProtection[ID]).TotalMilliseconds > 600)
                {
                    LastMessages[ID] = Message;

                    new Thread(() => ThinkofResponse(ID, Message)).Start();
                }

        /// <summary>
        /// A simple way to prevent spam.
        /// </summary>
        public static Dictionary<SteamID, DateTime> SpamProtection = new Dictionary<SteamID, DateTime>();

Anyways, I manually go into chatrooms, maybe that was part of my problem too. I'll take a look into it later, thank you a lot for your quick and kind responses.

By the way, something else - do you have a way to interact with the Steam community market? Or is that not yet available, or not even part of this kit?

I'm talking just getting prices for certain items, maybe buying ones, and selling some from the inventory.

@JustArchi
Copy link
Contributor

JustArchi commented Jun 25, 2017

Steam community, store as well as any HTTP-based functionality is out of the scope of SK2. You can find some functions extracted and implemented in my ASF project, but nothing related to market, as botting market is against Steam ToS, so I'm not dealing with that.

Anyways, I manually go into chatrooms, maybe that was part of my problem too.

Could be, Steam network doesn't work well when there are multiple sessions with the same LoginID. This is mainly why I added #217 - you should make use of it if you're not doing that yet, unless you have dedicated account for your bot that you're not using yourself at all.

@ghost
Copy link
Author

ghost commented Jun 25, 2017

Cheers.

@ghost
Copy link
Author

ghost commented Jun 25, 2017

Good news. The reason the method wouldn't be executed is indeed that I manually joined it. After turning off my secondary computer, and using SteamFriends to join the chat, it finally throws the unimplemented error.

@yaakov-h
Copy link
Member

Closing as this isn't a bug in SteamKit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants