Closed azro352 closed 5 years ago
I think it should be working. "that command is not registered" is still happening?
Yes :/
Anyway, this.sendNotification(ARTICLE_NEXT)
will not delivered to the module itself which emit that notification.
You can use receivedNotification
instead.
Back to main issue;
getCommands: function(commander){
return [{
command: "ARTICLE_NEXT'
})
}
If this command be registered
getCommands: function(commander){
return [{
command: "infonext',
callback : "command_infonext'
})
},
command_infonext: function(command, handler){
this.sendNotification("ARTICLE_NEXT")
}
this should be registered also. (Even the command be failed to executed)
But... I find the syntax error now.
return [{
command: "ARTICLE_NEXT'
}) //<--
It should be ]
, not )
I’ve edited :
The solution would be to put the code from the “ifs” is notificationreceived in methods, to be accessible from inside this js file
You can use this.receivedNotification("ARTICLE_NEXT", null, null)
instead sendNotification
inside of same module. It will work like "receiving notification from somewhere".
Not working, nothing happen, and no reply from the handler :/I've add an issue in the newsfeed repo too
Show your full command_infonext
And See this also;
https://github.com/eouia/MMM-News/blob/081fcb219b3bba459d5486b6e1836e8dc429e60e/MMM-News.js#L56-L103
I think receivedNotification
was wrong. Sorry, I type with only my memory. notificationReceived
will be right.
It's simply the name of the function defined below notificationReceived : function(...
:D
Final Solution :
getCommands: function(commander){
return [{
command: "infonext",
callback : "cmd_next"
}]
},
cmd_next: function(command, handler){
this.notificationReceived("ARTICLE_NEXT")
handler.reply("TEXT", "Next news shown")
}
I just learned how to use Telegram and MMM-TelegramBot, it works good, so I tried to use it for the newsfeed module (the default one) as it has some notification availables : newsfeed notif
In the file newsfeed/newsfeed.js I add (line 43) the following code :
So when I use
/ARTICLE_NEXT
it works, but how to change the name of the command ? Like/infonext
triggersARTICLE_NEXT
notif ?Edit : I tried :
But i got ""that command is not registered for this one above
, and
But nothing happen :/