我有以下代码登录到我的帐户并加入列表中的频道:
from telethon.sync import TelegramClient
from telethon.tl.functions.channels import JoinChannelRequest
from telethon.errors.rpcerrorlist import FloodWaitError
from dotenv import load_dotenv
import os
import asyncio
load_dotenv()
API_ID = os.getenv('API_ID')
API_HASH = os.getenv('API_HASH')
CHANNELS = ['techngames'] # the channels you want to join
async def main():
async with TelegramClient('tg_session', API_ID, API_HASH) as client:
for channel in CHANNELS:
try:
await client(JoinChannelRequest(channel))
except FloodWaitError as fwe:
print(f'Waiting for {fwe}')
await asyncio.sleep(delay=fwe.seconds)
asyncio.run(main())
然而,我似乎找不到如何向这些特定的频道发送消息?有人能帮我吗?我想向我加入的所有渠道发送相同的信息
目前没有回答
相关问题 更多 >
编程相关推荐