Comments (3)
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.
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.
That's odd and it feels like there's an issue with envelope API on xmpp hubot adapter.
from hubot-cron.
Related Issues (12)
- Run another hubot script HOT 1
- Cronjob to call a function HOT 5
- Error when running cron job HOT 17
- Old version being installed through npm
- Jobs are being sent twice just seconds apart
- Configure default timezone HOT 4
- What channel are crons run in? HOT 1
- Use cronjob to send a command to Hubot itself HOT 2
- Creates job but never sends reminders
- Brain is not persisting Channel
- Support setting timezone HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hubot-cron.