Open irmandos opened 8 years ago
Here is my steam.coffee file Please let me know if you require any other information.
{Robot, Adapter, TextMessage, EnterMessage, LeaveMessage, Response} = require 'hubot' Steam = require 'steam' request = require 'request' class SteamBot extends Adapter constructor: ( robot ) -> @robot = robot run: -> login = accountName: process.env.HUBOT_STEAM_NAME, password: process.env.HUBOT_STEAM_PASSWORD, if process.env.HUBOT_STEAM_CODE login.authCode = process.env.HUBOT_STEAM_CODE if process.env.HUBOT_STEAM_SENTRY_HASH login.shaSentryfile = process.env.HUBOT_STEAM_SENTRY_HASH @robot.logger.info login @steam = new Steam.SteamClient @steam.logOn login @robot.logger.info "Running!" @steam.on 'friendMsg', @gotFriendMessage @steam.on 'loggedOn', @loggedOn @steam.on 'chatMsg', @gotGroupMessage @steam.on 'friend', @gotFriendActivity @steam.on 'error', @error @on 'connected', @joinChats loggedOn: () => @steam.setPersonaState(Steam.EPersonaState.Online) @robot.logger.info "Connected" @emit "connected" @emit "relationships" gotFriendMessage: (source, message, type) => if message != "" @getProfileUrl source, () -> user = id: source, name: @steamurl, room: 'priv' @receive new TextMessage user, message, 1 gotGroupMessage: (source, message, type, chatter) => if message != "" @getProfileUrl chatter, () -> details = id: source, name: @steamurl, room: source @receive new TextMessage details, message, 1 gotFriendActivity: (source, type) => if type == Steam.EFriendRelationship.PendingInvitee @robot.logger.info "Recived friend request" @steam.addFriend(source) send: (envelope, messages...) => for message in messages @steam.sendMessage(envelope.user.id,message, Steam.EChatEntryType.ChatMsg) reply: (envelope, messages...) => for message in messages @steam.sendMessage(envelope.user.id,message, Steam.EChatEntryType.ChatMsg) error: (e) => @robot.logger.error e.cause joinChats: () => for room in process.env.HUBOT_STEAM_CHATS.split "," @robot.logger.info "Joining groupchat #{room}" @steam.joinChat room unless room is ""
getProfileUrl: (id, callback) => if @robot.brain.userForId(id).name isnt id @steamurl = @robot.brain.userForId(id).name callback.call @ else parent = @ request uri: "https://steamcommunity.com/profiles/#{id}" followRedirect: false , (err, res, body) -> parent.steamurl = "noname" if res.statusCode is 302 parent.robot.logger.error err if err redirect = res.headers.location.split "/" parent.steamurl = redirect[4] unless redirect[3] is "profiles" parent.robot.brain.userForId id, { name: parent.steamurl, room: "steam" } callback.call parent .call @ exports.use = (robot) -> new SteamBot robot
I am having the same issue :/
Any news?
The connection is not set up properly, the underlying steam npm has probably changed since this script was made.
This fork seems to work.
irmandos@irbot:~/irhubot/hubot$ ./bin/hubot --name HubotOpenShift --adapter steam npm WARN hubot-openshift@1.0.0 No license field. [Mon Jun 27 2016 10:09:44 GMT+0000 (UTC)] INFO { accountName: 'bot', password: 'superbot' } TypeError: this.steam.logOn is not a function at SteamBot.run (/home/irmandos/irhubot/hubot/node_modules/hubot-steam/src/steam.coffee:25:5,:44:18)
at Robot.run (/home/irmandos/irhubot/hubot/node_modules/hubot/src/robot.coffee:590:5, :464:27)
at Object. (/home/irmandos/irhubot/hubot/node_modules/hubot/bin/hubot:168:8, :182:11)
at Object. (/home/irmandos/irhubot/hubot/node_modules/hubot/bin/hubot:5:1, :185:4)
at Module._compile (module.js:541:32)
at Object.exports.run (/home/irmandos/irhubot/hubot/node_modules/coffee-script/lib/coffee-script/coffee-script.js:103:25)
at compileScript (/home/irmandos/irhubot/hubot/node_modules/coffee-script/lib/coffee-script/command.js:171:29)
at /home/irmandos/irhubot/hubot/node_modules/coffee-script/lib/coffee-script/command.js:143:18
at FSReqWrap.readFileAfterClose as oncomplete