Quick fix for a problem with edited messages (no `msg.message`; but messages include a `msg.edited_message`)
convexset opened this issue · 5 comments
There is a problem with _poll
when messages are edited before being read.
msg.message
is missing when a message is edited, msg.edited_message
is available
I've provided a very quick fix. But you might want to do something more comprehensive.
Bot.prototype._poll = function () {
var self = this;
/* Some Code */
if (self.parseCommand) {
////////////////////////////////////////////////////////////
// QUICK FIX HERE
////////////////////////////////////////////////////////////
// a quick fix because msg.message is missing when a message is edited, ...
// but msg.edited_message is available
// put this where you think it makes sense
if (!!msg.edited_message) {
msg.message = msg.edited_message;
console.log("Monkey Patch for Edited Messages:", msg);
}
////////////////////////////////////////////////////////////
if (msg.message.text && msg.message.text.charAt(0) === '/') {
/**
/* Some Code */
Here's what a msg.edited_message
looks like:
{ message_id: 869,
from: { id: 179442020, first_name: 'xxx', username: 'xxxx' },
chat:
{ id: 0000,
first_name: 'xxx',
username: 'xxxx',
type: 'private' },
date: 1463978414,
edit_date: 1463978429,
text: 'f' },
works brilliantly!
Great. Thanks for the package.
On Tuesday, 24 May 2016, Shaun Walker notifications@github.com wrote:
works brilliantly!
—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#70 (comment)
Regards,
Jeremy Chen
Is anyone planning to do a PR for this? I'm willing to jump in if no one is working on one.
Not me. I don't know enough about the package and API. I've checked that
forwarding messages to it works, receiving audio is also fine. The only
strange exception I've noted is edited messages.
Waiting for a new version to replace my monkey patched one.
Regards,
Jeremy Chen
On Wed, May 25, 2016 at 10:01 AM, Kelvin De Moya notifications@github.com
wrote:
Is anyone planning to do a PR for this? I'm willing to jump in if no one
is working on one.—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#70 (comment)
I've created a PR that should resolve this issue, happy to make adjustments where required