👋
I've created a channel, and it got -1001222207990 as its id. When I try to get the members of that channel via tdlib-json-cli, I get:
[ 1][t 0][1548697912.680639744][ClientJson.cpp:78][&status.is_error()] Failed to parse [request:{\042supergroup_id\042:-1001222207990,\042offset\042:null,\042limit\042:null,\042filter\042:null,\042@type\042:\042getSupergroupMembers\042}] [Error : 0 : Can't parse "-1001222207990" as number]
What am I supposed to pass to tdlib as supergroup_id?
I also get that parsing error for other supergroup methods, like getSupergroupFullInfo.
According to https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1get_supergroup_full_info.html, supergroup_id is int32, and -1001222207990 overflows that, but it's the only "id" that I get when, for example, I post a message in the channel or when I invite a bot to it.
-1001222207990 is a chat id, not supergroup id. Supergroup id is 1222207990.
Don't mix these concepts.
Hi @zelenin! I wonder if you could tell me how I can get the supergroup id from a chat id?
Hi @zelenin! I wonder if you could tell me how I can get the supergroup id from a chat id?
Its in “type” of the chat
@zevlg hi! What do you mean by a chat here? For example, in a bot webhook (bot api) I get this chat included for any activity in the channel:
chat: {
first_name: nil,
id: -1001222207990,
last_name: nil,
photo: nil,
title: "alsdkfjhlkajsdhf",
type: "channel",
username: nil
}
So where can I get 1222207990 from? Is it some method in TDLib, if so which one?
Oh, silly me. I just need to remove the leading -100 from -1001222207990 to get 1222207990! Thank you both @zevlg and @zelenin!
It is some your interpretation of what TDLib returns, see the description of chat -
https://github.com/tdlib/td/blob/master/td/generate/scheme/td_api.tl#L566
It has “type” field with the value you actually need
Most helpful comment
-1001222207990 is a chat id, not supergroup id. Supergroup id is 1222207990.
Don't mix these concepts.