Skip to main content

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

Project description

interactions-files

PyPI - Downloads Version Python Requirement

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

Table of Contents

Installation

pip install -U interactions-files

Information

This is interactions-files, an extension library for interactions.py allowing files in interaction responses.

By default, interactions.py does not allow you to send files in CommandContext and ComponentContext. This extension exists to solve that problem by adding files field to the .send() and .edit().

Quickstart

You can load interactions-files like every other Extension by using:

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

After that, you can start sending files in Context. For example of doing this, go to this.

Alternatively, you can use the functions provided by the Extension. Take a look at an example below:

import io
import interactions
from interactions.ext.files import command_send

client = interactions.Client(token="Pfft!")

@client.command(
    name="file",
    description="Send a file.",
)
async def _test(ctx: interactions.CommandContext):
    txt = io.StringIO("This is a text file.")
    file = interactions.File(filename="file.txt", fp=txt)
    await command_send(ctx, "Below is a file.", files=file)

client.start()

For more information on the fuctions, check out the documentation.

Documentation

API Reference

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

interactions-files-1.1.5.tar.gz (7.2 kB view hashes)

Uploaded Source

Built Distribution

interactions_files-1.1.5-py3-none-any.whl (6.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page