From a0fa7208fc8c091351473479ffde68df3c22da23 Mon Sep 17 00:00:00 2001 From: Jimmy-Blue <60958064+Jimmy-Blue@users.noreply.github.com> Date: Thu, 26 May 2022 13:32:23 +0700 Subject: [PATCH] docs: Fix example --- README.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e188084..1045d01 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,22 @@ import io client = interactions.Client(...) client.load('interactions.ext.files') - -async def test(ctx: interactions.CommandContext): - data = "Hey look, this is a file from CommandContext." - file = io.StringIO(data) +@client.command( + name="file", + description="Send a message as a text file", + options=[ + interactions.Option( + type=interactions.OptionType.STRING, + name="message", + description="Message", + required=True + ) + ] +) +async def _file(ctx: interactions.CommandContext, message: str): + file = io.StringIO(message) with file as f: - file = interactions.File(filename="aaaaa.txt", fp=f) + file = interactions.File(filename="message.txt", fp=f) await ctx.send(files=file)