-2
我想使用Node製作一個Steam Bot,並且我已成功設置並運行起來。Node.js蒸汽聊天機器人
事情是,如果我想記錄命令,只有一個(到目前爲止)工作,那就是/ test命令。
我檢查的消息(S)代碼又名命令:「它的工作原理」
steamBot.on('message', function(source, message, type, chatter) {
console.log('Received message: ' + message);
if (message == '/test') {
steamBot.sendMessage(source, 'It works!', Steam.EChatEntryType.ChatMsg);
} else {
steamBot.sendMessage(source, 'Use /help.', Steam.EchatEntryType.ChatMsg);
}});
所以,如果我用另一個帳戶發送/測試命令的機器人,它的工作原理,展示,但如果我發送任何其他消息,它不會顯示「使用/幫助」。它會關閉應用程序,然後出現以下錯誤:
TypeError: Cannot read property 'ChatMsg' of undefined
at SteamClient.<anonymous> (/home/juniper/Downloads/Please/please3.js:32:105)
at emitThree (events.js:97:13)
at SteamClient.emit (events.js:175:7)
at SteamClient.handlers.(anonymous function) (/home/juniper/node_modules/steam/lib/handlers/friends.js:250:8)
at SteamClient._netMsgReceived (/home/juniper/node_modules/steam/lib/steam_client.js:106:26)
at SteamClient.handlers.(anonymous function) (/home/juniper/node_modules/steam/lib/steam_client.js:192:10)
at SteamClient._netMsgReceived (/home/juniper/node_modules/steam/lib/steam_client.js:106:26)
at emitOne (events.js:77:13)
at Connection.emit (events.js:169:7)
at Connection._readPacket (/home/juniper/node_modules/steam/lib/connection.js:50:8)
謝謝。
EChatEntryType似乎是正確的 –
該死的。我很慚愧。謝謝! – nori
嘿,它發生了。對我來說,這通常是我意識到自己編碼的時間太長,所以我需要長時間休息,讓我的頭腦休息。玩的開心! – juandemarco