Naltox / telegram-node-bot

Node module for creating Telegram bots.
MIT License
720 stars 144 forks source link

[error] No processor found for update: Update { Bot cannot work with channel ... Is there a way to fix that? #206

Closed RasmonT closed 5 years ago

RasmonT commented 5 years ago

[error] No processor found for update: Update { _updateId: 58337940, _message: null, _editedMessage: null, _channelPost: Message { _messageId: 181, _from: null, _date: 1554741118, _chat: Chat { _id: -1001175605616, _type: 'channel', _title: 'My TEST Channel', _username: 'MyTESTChannelFor', _firstName: null, _lastName: null, _allMembersAreAdministrators: null },

Im receiving this error when i type any text on my channel that i want to forward to my group.

code i'm using

'use strict';

console.log("\u{1F61E}");

const Telegram = require('telegram-node-bot');

class OtherwiseController extends Telegram.TelegramBaseController {
handle(scope) {
if ('RasmonT and Luis TEST Group Spanish' == scope.message.chat._title) {
scope.api.sendMessage(scope.message._chat._id, "Bienvenido " + 
scope.message._newChatMember._firstName + "! yo soy *Bot*", { 'parse_mode' : 'Markdown' });   
//Welcome Message Spanish
} else if ('RasmonT and Luis TEST Group' == scope.message.chat._title) {
scope.api.sendMessage(scope.message._chat._id, "Приветствую " + 
scope.message._newChatMember._firstName + "! Я *бот*", { 'parse_mode' : 'Markdown' }); //Welcome 
Message Russian
} else {
scope.api.sendMessage(scope.message._chat._id, "Welcome " + 
scope.message._newChatMember._firstName + "! I'm *Bot*", { 'parse_mode' : 'Markdown' }); // 
Welcome message defualt = English , will be used in all different groups (working fine)
}
if ('channel' == scope.message.chat._type) {
scope.forwardMessage(-1001492692652, scope.chatId, scope._message._messageId); //This is forward 
Message, that does not work
    }
  }
}

module.exports = OtherwiseController;

CODE FOR

RasmonT commented 5 years ago

Fixed inside pull Request