在用户对话框中找不到任何输入 - Telegram

问题描述 投票:0回答:0

电报机器人连接正常,我有访问权限,但是在 forwardgram.py 中调用 iter_dialogs() 时,它没有在 config.yml 中列出的对话框中找到频道

Forwardgram.py

  input_channels_entities = []
    output_channel_entities = []

    # Iterating over dialogs and finding new entities and pushing them to our empty entities list above
    for d in client.iter_dialogs():
        if d.name in config["input_channel_names"] or d.entity.id in config["input_channel_ids"]:
            input_channels_entities.append(InputChannel(d.entity.id, d.entity.access_hash))
        if d.name in config["output_channel_names"] or d.entity.id in config["output_channel_ids"]:
            output_channel_entities.append(InputChannel(d.entity.id, d.entity.access_hash))

    # Exit, dont wait for fire.        
    if not output_channel_entities:
        logger.error(f"Could not find any output channels in the user's dialogs")
        sys.exit(1)

    if not input_channels_entities:
        logger.error(f"Could not find any input channels in the user's dialogs")
        sys.exit(1)

配置.yml

input_channel_names:
  - 'xf_trading_free'

# The output channel names that the messages will be forwarded to.
# The user running the client must have a write access to those channels, and have the channels present on theirs dialogs.
output_channel_names: 
  - 'lwstrades'

# The channel IDs that you'd like to forward messages from. Just get channel id from channels you put as input_channel_names above (You can get a channel ID by forwarding any message from it to @userinfobot , and removing the -100 from the start ) 
input_channel_ids:
  - 1138137518

# The output channel IDs that the messages will be forwarded to. Just get channel id from channels you put as output_channel_names above (You can get a channel ID by forwarding any message from it to @userinfobot , and removing the -100 from the start )
output_channel_ids:
  - 1880401257

# Do not touch this: 
input_channel_ids: []

自己找不到要尝试的更改。

python telegram-bot python-telegram-bot py-telegram-bot-api
© www.soinside.com 2019 - 2024. All rights reserved.