Code Monkey home page Code Monkey logo

Comments (3)

miyagawa avatar miyagawa commented on August 21, 2024

Yes, i need further information :) There's no code in this script that initiates a restart, so i guess there's a problem in the XMPP library, or a message causes runtime exception that somehow causes a restart, i don't know.

If you can capture what is causing the exception or a stacktrace that would be useful.

from hubot-cron.

swaroopbutala avatar swaroopbutala commented on August 21, 2024

Here is what seems to have happened, and here is how i fixed it,

When I created a job from a group chat, this is the requesting user(some fields blurred)
@envelope.user = {"id":"Sam Mcgotes","room":"[email protected]","jid":"[email protected]/Sam Mcgotes","name":"Sam Mcgotes","type":"groupchat","privateChatJID":"[email protected]/SamMcgotes-Macbook","roles":[]}
When it does robot.send @envelope, @message it fails and restarts the bot.

When I created a job from private chat,
@envelope.user = {"id":"smcgotes","name":"smcgotes","type":"chat","privateChatJID":"[email protected]/SamMcgotes-Macbook","roles":[]}
When it does robot.send @envelope, @message it works.

I have changed the sendMessage logic to do this:
sendMessage: (robot) ->
try
if @envelope.user.type == 'groupchat'
@user = robot.brain.userForId 'broadcast'
@user.room = @envelope.user.room
@user.type = 'groupchat'
robot.send @user, @message
else
robot.send @envelope, @message
catch error
console.warn("Error caught: #{error}");

So now if it is a group chat, it will try to send a broadcast message to the room.

Did not get a chance to dive deep in why the robot.send fails for group chat user.

from hubot-cron.

miyagawa avatar miyagawa commented on August 21, 2024

That's odd and it feels like there's an issue with envelope API on xmpp hubot adapter.

from hubot-cron.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.