Discord Message Components
A python library that adds message component support to discord bots
Usage
I will add proper documentation very soon
from discord_message_components import *
from discord.ext.commands import Bot
import discord
bot = Bot("prefix")
components = ComponentHelper()
button = Button("visible label", 1, "custom_id")
components.addComponent(button)
@bot.event
async def on_socket_raw_receive(msg):
interaction = await websocket_wrap(msg)
if interaction is not None: # Making sure the interaction actually happened and was for message components
await respond(interaction,f"{interaction.member_data.username} clicked button {components.getFirstComponent(interaction.data.custom_id)}") # This acts just like discord_message_components.send_message, except it requires an interaction, and cannot have a message reference
@bot.command()
async def mycommand(ctx):
await send_message(ctx.channel,"content",components=components)
config.token = "My Token" #the token is required for sending the messages with components
Release files for discord-message-components-polarsbear 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| discord_message_components-polarsbear-0.1.2.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| discord_message_components_polarsbear-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.7 kB
Release files / discord_message_components-polarsbear-0.1.2.tar.gz
| Download URL | discord_message_components-polarsbear-0.1.2.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a74582f43d07ba3b69ee31a5ec040a2fab9b54708c5736e6b973e05cff320255
|
|
BLAKE2b-256 checksum How to use checksums |
98c510ba89eb6b56cd918a611ec3a6221545a1569ba17f2a9ec8a1b03c143a88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.1
|
Release files / discord_message_components_polarsbear-0.1.2-py3-none-any.whl
| Download URL | discord_message_components_polarsbear-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
232c7f8dd9c7542ed4438323e4a6819d28c55297be93c14d2650b33fc7594c22
|
|
BLAKE2b-256 checksum How to use checksums |
467eef71f342b77c5a168a8635b27602aed92eb4b63ffbad773f2eb56528904a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.1
|