我有这个代码来测试telethon,它运行了一次,我添加了几个通道来测试,第二次运行时,我得到了“name”main“没有定义”,即使我没有更改代码,也只是更改了通道列表中的通道。有人能解释一下并提出建议吗
from telethon.sync import TelegramClient
from telethon.tl.functions.channels import JoinChannelRequest
from telethon.errors.rpcerrorlist import FloodWaitError
import time
from dotenv import load_dotenv
import os
import asyncio
channel_list=[
'Realblockways','alaskainu','creampyetoken']
client = TelegramClient('session_name',
2583714,
'myhashpw')
client.start()
for values in channel_list:
try:
destination_channel_username=values
entity=client.get_entity(destination_channel_username)
client(JoinChannelRequest(channel=values))
client.send_message(entity=entity,message='testing')
time.sleep(20)
except:
continue
time.sleep(20)
asyncio.run(main())
目前没有回答
相关问题 更多 >
编程相关推荐