【发布时间】:2021-11-08 08:57:54
【问题描述】:
需要快速帮助 这是仅发布到不和谐频道的代码',我已经使用了 while 循环和所有这些,但没有任何效果。
def post_discord():
print('POSTING NEW OFFER TO DISCORD')
token = 'token here'
while True:
bot = commands.Bot(command_prefix='!')
@bot.command()
async def on_ready():
await bot.wait_until_ready()
channel = bot.get_channel(12345678) # replace with channel ID that you want to send to
# await channel.send()
await channel.send(text,file =discord.File('promo.png'))
await asyncio.sleep(2)
# exit()
# await bot.close()
bot.loop.create_task(on_ready())
bot.run(token)
time.sleep(3)
【问题讨论】:
-
我建议改用 Discord webhook。详细答案见here
标签: python discord.py