discord-message-components-polarsbear-0.1.2
توضیحات
A python library that adds message component support to discord bots
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | discord-message-components-polarsbear-0.1.2 |
| نام | discord-message-components-polarsbear |
| نسخه کتابخانه | 0.1.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Lars Von Wangenheim |
| ایمیل نویسنده | larzitovw@gmail.com |
| آدرس صفحه اصلی | https://github.com/PolarsBear/Discord-Message-Components |
| آدرس اینترنتی | https://pypi.org/project/discord-message-components-polarsbear/ |
| مجوز | - |
# Discord Message Components
A python library that adds message component support to discord bots
## Usage
### I will add proper documentation very soon
```python
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
```
نیازمندی
| مقدار | نام |
|---|---|
| - | discord |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl discord-message-components-polarsbear-0.1.2:
pip install discord-message-components-polarsbear-0.1.2.whl
نصب پکیج tar.gz discord-message-components-polarsbear-0.1.2:
pip install discord-message-components-polarsbear-0.1.2.tar.gz