-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
77 lines (28 loc) · 1.12 KB
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from discord.ext.commands import Bot
from discord_components import DiscordComponents, Button, Select, SelectOption
bot = Bot(command_prefix = "w!")
@bot.event
async def on_ready():
DiscordComponents(bot)
print(f"Logged in as {bot.user}!")
@bot.command()
async def button(ctx):
await ctx.send(
"Hello, World!",
components = [
Button(label = "WOW button!")
]
)
interaction = await bot.wait_for("button_click", check = lambda i: i.component.label.startswith("WOW"))
await interaction.respond(content = "Button clicked!")
@bot.command()
async def select(ctx):
await ctx.send(
"Hello, World!",
components = [
Select(placeholder="select something!", options=[SelectOption(label="a", value="A"), SelectOption(label="b", value="B")])
]
)
interaction = await bot.wait_for("select_option", check = lambda i: i.component[0].value == "A")
await interaction.respond(content = f"{interaction.component[0].label} selected!")
bot.run("ODYzMDY5MjMyMzM2ODYzMjgy.YOhh3A.JLdtaIoqAje4ubHwJVBwXe7LP4U")