mtproto-core icon indicating copy to clipboard operation
mtproto-core copied to clipboard

channels.readHistory, error_code 400, CHANNEL_INVALID

Open YabberWalkie opened this issue 3 years ago • 1 comments

Version 6.0.1

I've been trying for hours to get my messages set as read with different attempts, but whever i do, i always receive the message CHANNEL_INVALID. I've tried with channels.readHistory, and messages.readHistory but all give me either CHANNEL_INVALID or PEER_ID_INVALID..

My code:

var channel_id = 1405736404;
var hash = '801376899527371106';
var message_id = 389113;


var inputPeer = {
	_: 'inputPeerChannel',
	channel_id: channel_id,
	access_hash: hash,
};


return this.call('channels.readHistory', {
	channel: inputPeer,
	max_id: message_id
}).then(a => {
	console.log('read success:' ,a);
}).catch(err => {
	//console.log('failed :' ,err);
});

The id's i got from an update message i just received. In the updates i read the .chats and the updates

from the .chats i took the access_hash: { _: 'channel', flags: 1323328, creator: false, left: false, broadcast: false, verified: false, megagroup: true, restricted: false, signatures: false, min: true, scam: false, has_link: true, has_geo: false, slowmode_enabled: false, call_active: false, id: 1405736404, access_hash: '801376899527371106', title: 'PooCoin Chat', username: 'poocointokenchat', photo: { _: 'chatPhoto', flags: 0, has_video: false, photo_small: { _: 'fileLocationToBeDeprecated', volume_id: '400091100683', local_id: 483259 }, photo_big: { _: 'fileLocationToBeDeprecated', volume_id: '400091100683', local_id: 483261 }, dc_id: 4 }, date: 1614397442, version: 0, default_banned_rights: { _: 'chatBannedRights', flags: 165120, view_messages: false, send_messages: false, send_media: false, send_stickers: false, send_gifs: false, send_games: false, send_inline: false, embed_links: false, send_polls: true, change_info: true, invite_users: true, pin_messages: true, until_date: 2147483647 } }

Updates info: { _: 'updateNewChannelMessage', message: { _: 'message', flags: 264, out: false, mentioned: false, media_unread: false, silent: false, post: false, from_scheduled: false, legacy: false, edit_hide: false, pinned: false, id: 389113, from_id: { _: 'peerUser', user_id: 1815605884 }, peer_id: { _: 'peerChannel', channel_id: 1405736404 }, reply_to: { _: 'messageReplyHeader', flags: 0, reply_to_msg_id: 389008 }, date: 1624640424, message: 'that is rather random.' }, pts: 1546497, pts_count: 1 }

Errror: channels.readHistory error: { _: 'mt_rpc_error', error_code: 400, error_message: 'CHANNEL_INVALID' }

YabberWalkie avatar Jun 25 '21 17:06 YabberWalkie

U need use type InputChannel instead of inputPeerChannel https://core.telegram.org/method/channels.readHistory

exilibriss avatar Sep 13 '21 04:09 exilibriss