Chat room - cannot join and communicate
Closed this issue · 3 comments
Hello,
I tried your lib to run a bot on a chat room, but I can't get it to work as expected
- On a simple "friend chat" it's working perfectly (receiving messages & can send responses)
- On a room chat, I try to join the chat (using
steamFriends.joinChat('id')
as shown in the exemple) and I'm getting onchatEnter
event a status 1 (Success), but I don't see the bot in the chat room, cannot send message and do not recieve messages 😞
I tried with group's chats and private chats, for group's chat I have thechatEnter
event but not for the private ones
There is an issue with the ID itself ?
For the group chat I used this technique :
For a given group : https://steamcommunity.com/groups/the-name
I check : https://steamcommunity.com/groups/the-name/memberslistxml/?xml=1 -> groupID64
For a private chat I tried many ids found on the steam web client (chat_id, chat_group_id) but I don't have result with any of them
Am I supposed to build a SteamID with "accountId" being this id (chat_id ?) and the rest like a group id ?
var steamID = new SteamID({
accountID: 123456,
accountInstance: SteamID.ChatInstanceFlags.Clan,
accountType: Steam.EAccountType.Chat,
accountUniverse: Steam.EUniverse.Public
});
About the code, I'm not trying anything fancy yet, it's almost the exemple code with other credentials, chat id and some debuging lines (like listing all messages)
Running node 12.13.1 and npm 6.12.1
Can you help me with this ?
The chat functionality works only with "old" chats which are not visible in the Steam client unless you run it with the -no-browser
argument. To work with "new" chats, you have to use unified messages. See #432 (comment) for details.
OK, I'll try with this method
It might be useful to have some helper method for this and update the doc for future users
After a bit of SK2 documentation and testing I have something working :
To send a message :
const chatRoom = new Steam.SteamUnifiedMessages(steamClient, 'ChatRoom');
chatRoom.send('SendChatMessage', {
chat_id : '',
chat_group_id : '',
message: 'message'
}, (eresult, resp) => { console.log(eresult, resp); });
--
To recieve messages :
steamClient.send({
msg: Steam.EMsg.ClientCurrentUIMode,
proto: {}
}, new Steam.Internal.CMsgClientUIMode({ chat_mode: 2 }).toBuffer());
Then
const friendMessagesClient = new Steam.SteamUnifiedMessages(steamClient, 'ChatRoomClient');
friendMessagesClient.on('message', (methodName, body) => {
if (methodName === 'NotifyIncomingChatMessage') {
// do things with body
}
});