Jump to content
McKay Development

I am having trouble getting SteamChatRoomClient to work


Recommended Posts

Guest Tobi3944
Posted

Hi, I have been trying to send a message using the SteamChatRoomClient stuff (since it seems that the other one is deprecated)

This is the code that I use:

(in bot file)

const steamUser = require('steam-user');
const client = new steamUser();

module.exports.client = client;

client.on("friendMessage", function (steamID, message)
{
    chatHandler.chatManager(steamID, message);
});

(In chatHandler file)

const bot = require('./bot.js');
const config = require('./config.json');


module.exports.chatManager = chatManager;

function chatManager(steamID, message)
{
    console.log(bot.client.steamID);
    console.log("before switch statement");

    let steam3ID = '"[U:' + steamID.type + ":" + steamID.accountid + ']"';

    switch (true)
    {
        case (/test/i.test(message)):
            bot.client.chat.sendFriendMessage(steam3ID, "Hello World");
            break;
    };
};

(please note that I have removed some cases from the switch statement & stuff that I dont think have anything to do with this)*

Thanks in advance,

Tobi

Dont need this post anyways, just realised that I needed to just use steamID... The example at the top threw me a bit off :D

  • 1 year later...
Posted
On 8/25/2020 at 1:05 AM, Dr. McKay said:

The friendMessage event you're using is deprecated and you should use the SteamChatRoomClient version instead, but that should still work and I don't really see any reason why it wouldn't. What kind of behavior are you seeing and what console output are you getting?

but the friendMessage event is exactly the same name as the one in SteamChatRoomClient, no?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...