discord bot 命令从文本文件导入文本
discord bot command import text from text file
我想通过命令在我的 Discord Bot 中实现该功能以根据命令发送。变更日志中的 information/updates 位于同一文件夹中的 .txt 文件中。
如何在要发送的文件中获取该文本?
示例代码我想这就是你的意思
client = commands.Bot('!')
@client.command
async def command(ctx):
open_file_ = open('file.txt', 'r')
await ctx.send(open_file_.read())
这是你想要的吗?
我想通过命令在我的 Discord Bot 中实现该功能以根据命令发送。变更日志中的 information/updates 位于同一文件夹中的 .txt 文件中。 如何在要发送的文件中获取该文本?
示例代码我想这就是你的意思
client = commands.Bot('!')
@client.command
async def command(ctx):
open_file_ = open('file.txt', 'r')
await ctx.send(open_file_.read())
这是你想要的吗?