【发布时间】:2020-08-21 09:19:06
【问题描述】:
我正在处理一个不和谐的命令,它将整个文本文件逐行写入聊天,我尝试制作它,但不知何故它不能正常工作。
file = open('story.txt', 'r')
@client.command(alisases = ['readfile'])
async def story(ctx):
for x in file:
await ctx.send(file)
它运行,但只写这些行:
<_io.textiowrapper name="story.txt" mode="r" encoding="cp1250">
【问题讨论】:
-
您正在发送文件对象的字符串表示形式。你的意思是
ctx.send(x)?
标签: python discord discord.py