Skip to content

Commit 808c262

Browse files
authored
Merge branch 'master' into role-connections
2 parents bc6adc1 + c7e60d4 commit 808c262

File tree

5 files changed

+146
-0
lines changed

5 files changed

+146
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ These changes are available on the `master` branch, but have not yet been releas
2121
metadata, along with the `fetch_role_connection_metadata_records` and
2222
`update_role_connection_metadata_records` methods in `Client`.
2323
([#1791](https://github.com/Pycord-Development/pycord/pull/1791))
24+
- Added new message types, `interaction_premium_upsell`, `stage_start`, `stage_end`,
25+
`stage_speaker`, `stage_raise_hand`, `stage_topic`, and
26+
`guild_application_premium_subscription`.
27+
([#1852](https://github.com/Pycord-Development/pycord/pull/1852))
2428

2529
## [2.3.2] - 2022-12-03
2630

discord/enums.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,14 @@ class MessageType(Enum):
249249
guild_invite_reminder = 22
250250
context_menu_command = 23
251251
auto_moderation_action = 24
252+
role_subscription_purchase = 25
253+
interaction_premium_upsell = 26
254+
stage_start = 27
255+
stage_end = 28
256+
stage_speaker = 29
257+
stage_raise_hand = 30
258+
stage_topic = 31
259+
guild_application_premium_subscription = 32
252260

253261

254262
class VoiceRegion(Enum):

docs/api/enums.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,58 @@ of :class:`enum.Enum`.
242242
The system message denoting that an context menu command was executed.
243243

244244
.. versionadded:: 2.0
245+
.. attribute:: auto_moderation_action
246+
247+
The system message denoting an action by automod.
248+
249+
.. versionadded:: 2.3
250+
.. attribute:: role_subscription_purchase
251+
252+
The system message denoting a role-subscription purchase.
253+
254+
.. versionadded:: 2.4
255+
256+
.. attribute:: interaction_premium_upsell
257+
258+
The system message denoting an interaction premium upsell.
259+
260+
.. versionadded:: 2.4
261+
262+
.. attribute:: stage_start
263+
264+
The system message denoting that a stage event has started.
265+
266+
.. versionadded:: 2.4
267+
268+
.. attribute:: stage_end
269+
270+
The system message denoting that a stage event has ended.
271+
272+
.. versionadded:: 2.4
273+
274+
.. attribute:: stage_speaker
275+
276+
The system message denoting that a stage event has a new speaker.
277+
278+
.. versionadded:: 2.4
279+
280+
.. attribute:: stage_raise_hand
281+
282+
The system message denoting that a stage event has someone has raised their hand.
283+
284+
.. versionadded:: 2.4
285+
286+
.. attribute:: stage_topic
287+
288+
The system message denoting that a stage event has a new topic.
289+
290+
.. versionadded:: 2.4
291+
292+
.. attribute:: guild_application_premium_subscription
293+
294+
The system message denoting that a member has subscribed to a guild application.
295+
296+
.. versionadded:: 2.4
245297

246298
.. class:: UserFlags
247299

examples/views/channel_select.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import discord
2+
3+
# Channel selects (dropdowns) are a new type of select menu/dropdown Discord has added so users can select channels from a dropdown.
4+
5+
# Defines a simple View that allows the user to use the Select menu.
6+
# In this view, we define the channel_select with `discord.ui.channel_select`
7+
# Using the decorator automatically sets `select_type` to `discord.ComponentType.channel_select`.
8+
class DropdownView(discord.ui.View):
9+
@discord.ui.channel_select(
10+
placeholder="Select channels...", min_values=1, max_values=3
11+
) # Users can select a maximum of 3 channels in the dropdown
12+
async def channel_select_dropdown(
13+
self, select: discord.ui.Select, interaction: discord.Interaction
14+
) -> None:
15+
await interaction.response.send_message(
16+
f"You selected the following channels:"
17+
+ f", ".join(f"{channel.mention}" for channel in select.values)
18+
)
19+
20+
21+
bot: discord.Bot = discord.Bot(debug_guilds=[...])
22+
23+
24+
@bot.slash_command()
25+
async def channel_select(ctx: discord.ApplicationContext) -> None:
26+
"""Sends a message with our dropdown that contains a channel select."""
27+
28+
# Create the view containing our dropdown
29+
view = DropdownView()
30+
31+
# Sending a message containing our View
32+
await ctx.respond("Select channels:", view=view)
33+
34+
35+
@bot.event
36+
async def on_ready() -> None:
37+
print(f"Logged in as {bot.user} (ID: {bot.user.id})")
38+
print("------")
39+
40+
41+
bot.run("TOKEN")

examples/views/role_select.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import discord
2+
3+
# Role selects (dropdowns) are a new type of select menu/dropdown Discord has added so people can select server roles from a dropdown.
4+
5+
# Defines a simple View that allows the user to use the Select menu.
6+
# In this view, we define the role_select with `discord.ui.role_select`
7+
# Using the decorator automatically sets `select_type` to `discord.ComponentType.role_select`.
8+
class DropdownView(discord.ui.View):
9+
@discord.ui.role_select(
10+
placeholder="Select roles...", min_values=1, max_values=3
11+
) # Users can select a maximum of 3 roles in the dropdown
12+
async def role_select_dropdown(
13+
self, select: discord.ui.Select, interaction: discord.Interaction
14+
) -> None:
15+
await interaction.response.send_message(
16+
f"You selected the following roles:"
17+
+ f", ".join(f"{role.mention}" for role in select.values)
18+
)
19+
20+
21+
bot: discord.Bot = discord.Bot(debug_guilds=[...])
22+
23+
24+
@bot.slash_command()
25+
async def role_select(ctx: discord.ApplicationContext) -> None:
26+
"""Sends a message with our dropdown that contains a role select."""
27+
28+
# Create the view containing our dropdown
29+
view = DropdownView()
30+
31+
# Sending a message containing our View
32+
await ctx.respond("Select roles:", view=view)
33+
34+
35+
@bot.event
36+
async def on_ready() -> None:
37+
print(f"Logged in as {bot.user} (ID: {bot.user.id})")
38+
print("------")
39+
40+
41+
bot.run("TOKEN")

0 commit comments

Comments
 (0)