在电报或电报中使用机器人创建新频道 api

Create new channel using bot in telegram or telegram api

如何使用 Telegram 或电报中的机器人创建新频道 api?

我使用了库'telegram-mtproto'。我在 https://core.telegram.org/methods 中使用的方法 'channels.createChannel' 这是我的代码

import MTProto from 'telegram-mtproto'

const api = {
    layer: 57,
    // initConnection: 0x69796de9,
    api_id: 1153141
}

const server = {
    dev: true //We will connect to the test server.
} //Any empty configurations fields can just not be specified

const client = MTProto({ server, api })

export const connect = async () => {
    const result = await client('channels.createChannel', {
        title: 'This is title',
        about: 'This is description',
        address: 't.me/test123456'
    })
    console.log('TCL: result', result)
}

我明白了

Error 401 AUTH_KEY_UNREGISTERED 2 2
(node:14408) UnhandledPromiseRejectionWarning: Error: 401 AUTH_KEY_UNREGISTERED CODE#401 AUTH_KEY_UNREGISTERED

没有人可以帮助我或给我一个想法。非常感谢 。

只有用户可以在电报中创建新组或频道

机器人不能groups/channel。只有一个用户可以。您可以通过以用户身份登录来尝试此操作。