|
3 | 3 | import os
|
4 | 4 | import uuid
|
5 | 5 |
|
| 6 | +from interactions.models.internal.context import SlashContext |
| 7 | + |
6 | 8 | from thefuzz import process
|
7 | 9 |
|
8 | 10 | import interactions
|
@@ -69,6 +71,48 @@ async def components(ctx):
|
69 | 71 | )
|
70 | 72 |
|
71 | 73 |
|
| 74 | +@slash_command("v2") |
| 75 | +async def v2(ctx: SlashContext): |
| 76 | + from interactions.models.discord.components import ( |
| 77 | + SectionComponent, |
| 78 | + Button, |
| 79 | + TextDisplayComponent, |
| 80 | + ContainerComponent, |
| 81 | + ButtonStyle, |
| 82 | + ActionRow, |
| 83 | + SeparatorComponent, |
| 84 | + ThumbnailComponent, |
| 85 | + UnfurledMediaItem, |
| 86 | + ) |
| 87 | + |
| 88 | + components = [ |
| 89 | + SectionComponent( |
| 90 | + components=[ |
| 91 | + TextDisplayComponent("This is some"), |
| 92 | + TextDisplayComponent("Text"), |
| 93 | + ], |
| 94 | + accessory=Button(style=ButtonStyle.PRIMARY, label="Click me"), |
| 95 | + ), |
| 96 | + TextDisplayComponent("Hello World"), |
| 97 | + ContainerComponent( |
| 98 | + ActionRow( |
| 99 | + Button(style=ButtonStyle.RED, label="Red Button"), Button(style=ButtonStyle.GREEN, label="Green Button") |
| 100 | + ), |
| 101 | + SeparatorComponent(divider=True), |
| 102 | + TextDisplayComponent("👀"), |
| 103 | + ), |
| 104 | + SectionComponent( |
| 105 | + components=[ |
| 106 | + TextDisplayComponent("This one has a thumbnail"), |
| 107 | + ], |
| 108 | + accessory=ThumbnailComponent( |
| 109 | + UnfurledMediaItem("https://avatars.githubusercontent.com/u/98242689?s=200&v=4") |
| 110 | + ), |
| 111 | + ), |
| 112 | + ] |
| 113 | + await ctx.send(components=components) |
| 114 | + |
| 115 | + |
72 | 116 | @slash_command("record", description="Record audio in your voice channel")
|
73 | 117 | @slash_option("duration", "The duration of the recording", opt_type=interactions.OptionType.NUMBER, required=True)
|
74 | 118 | async def record(ctx: interactions.SlashContext, duration: int) -> None:
|
|
0 commit comments