|
9 | 9 | <a href="https://pypi.org/project/discord-components"><img src="https://img.shields.io/pypi/dm/discord-components" alt="PyPI downloads"></a> |
10 | 10 | </div> |
11 | 11 | <div> |
12 | | - <h3>An unofficial library for discord components.</h3> |
| 12 | + <h3>An unofficial third party library of discord.py for discord components.</h3> |
13 | 13 | </div> |
14 | 14 | </div> |
15 | 15 |
|
16 | 16 | ## Welcome! |
17 | | -Discord components are cool, but discord.py will support it on version 2.0. It is hard to wait, so we made a third-party library for using components such as buttons or selects! |
| 17 | + |
| 18 | +Discord components are cool, but discord.py will support it on version 2.0. It |
| 19 | +is hard to wait, so we made a third-party library for using components such as |
| 20 | +buttons or selects! |
18 | 21 |
|
19 | 22 | This project is open source ⭐. |
20 | 23 |
|
21 | | -Also, there is an [official discord server](https://discord.gg/pKM6stqPxS), so if you have any questions, feel free to ask it on this server. |
| 24 | +Also, there is an [official discord server](https://discord.gg/pKM6stqPxS), so |
| 25 | +if you have any questions, feel free to ask it on this server. |
22 | 26 |
|
23 | 27 | ## Features |
24 | | -+ You can use message components and handle component interactions easily! |
25 | | -+ third-party of discord.py. |
| 28 | + |
| 29 | +- You can use message components and handle component interactions easily! |
| 30 | +- Third-party of discord.py. |
26 | 31 |
|
27 | 32 | ## Docs |
28 | | -We are currently making a new docs! But you can use ([Gitbook version](https://devkiki7000.gitbook.io/discord-components) (up to date) |
| 33 | +- [Gitbook version](https://devkiki7000.gitbook.io/discord-components) (Up to |
| 34 | + date) |
| 35 | +- [Sphinx Version](https://discord-components.readthedocs.io/en/0.5.2.4) |
| 36 | + (Currently outdated) |
29 | 37 |
|
30 | 38 | ## Install |
| 39 | + |
31 | 40 | ``` |
32 | 41 | pip install --upgrade discord-components |
33 | 42 | ``` |
34 | 43 |
|
35 | 44 | ## Example |
36 | | -```py |
37 | | -from discord.ext.commands import Bot |
38 | | -from discord_components import DiscordComponents, Button, Select, SelectOption |
39 | | - |
40 | | -bot = Bot(command_prefix = "your prefix") |
41 | | - |
42 | | - |
43 | | -@bot.event |
44 | | -async def on_ready(): |
45 | | - DiscordComponents(bot) |
46 | | - print(f"Logged in as {bot.user}!") |
47 | | - |
48 | | - |
49 | | -@bot.command() |
50 | | -async def button(ctx): |
51 | | - await ctx.send( |
52 | | - "Hello, World!", |
53 | | - components = [ |
54 | | - Button(label = "WOW button!") |
55 | | - ] |
56 | | - ) |
57 | 45 |
|
58 | | - interaction = await bot.wait_for("button_click", check = lambda i: i.component.label.startswith("WOW")) |
59 | | - await interaction.respond(content = "Button clicked!") |
60 | | - |
61 | | - |
62 | | -@bot.command() |
63 | | -async def select(ctx): |
64 | | - await ctx.send( |
65 | | - "Hello, World!", |
66 | | - components = [ |
67 | | - Select(placeholder="select something!", options=[SelectOption(label="a", value="A"), SelectOption(label="b", value="B")]) |
68 | | - ] |
69 | | - ) |
70 | | - |
71 | | - interaction = await bot.wait_for("select_option", check = lambda i: i.component[0].value == "A") |
72 | | - await interaction.respond(content = f"{interaction.component[0].label} selected!") |
73 | | - |
74 | | - |
75 | | -bot.run("your token") |
76 | | -``` |
77 | | -You can see more examples [here](https://gitlab.com/discord.py-components/discord.py-components/-/tree/master/examples). |
| 46 | +You can see many examples |
| 47 | +[here](https://gitlab.com/discord.py-components/discord.py-components/-/tree/master/examples). |
78 | 48 |
|
79 | 49 | ## License |
| 50 | + |
80 | 51 | This project is under the MIT License. |
0 commit comments