Metadata-Version: 2.1
Name: interactions-files
Version: 1.0.2
Summary: An external for interactions.py, adding files to CommandContext for file sending
Home-page: https://github.com/Jimmy-Blue/interactions-files
Author: Jimmy-Blue
Author-email: jimmyblue00@duck.com
License: GNU GPL-3
Classifier: Programming Language :: Python :: 3
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: discord-py-interactions (>=4.2.0)

# interactions-files
An extension library for interactions.py allowing files in interaction responses.

# How to use

It is pretty straight forward. Here is an example.
```py
import interactions

client = interactions.Client(...)

client.load('interactions.ext.files')
```

After that, you can use use ``files`` in CommandContext to send file. Take an example below.
```py
import interactions
import io

client = interactions.Client(...)
client.load('interactions.ext.files')

@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="message.txt", fp=f)
        await ctx.send(files=file)


client.start()
```

You can use it in an ``Extension``, a.k.a Cogs. Just load ``interactions.ext.files`` and you are done.

If you need an in-depth explanation on how ``interactions-files`` can be used, check out the [examples](./examples/) folder.

# Credits

- Credits to [Toricane](https://github.com/Toricane) for the original idea.
