mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
Add support for stage message types
This commit is contained in:
parent
ef4240dcd7
commit
bd6bbdab00
@ -234,11 +234,11 @@ class MessageType(Enum):
|
||||
auto_moderation_action = 24
|
||||
role_subscription_purchase = 25
|
||||
interaction_premium_upsell = 26
|
||||
# stage_start = 27
|
||||
# stage_end = 28
|
||||
# stage_speaker = 29
|
||||
# stage_raise_hand = 30
|
||||
# stage_topic = 31
|
||||
stage_start = 27
|
||||
stage_end = 28
|
||||
stage_speaker = 29
|
||||
stage_raise_hand = 30
|
||||
stage_topic = 31
|
||||
guild_application_premium_subscription = 32
|
||||
|
||||
|
||||
|
@ -2017,6 +2017,21 @@ class Message(PartialMessage, Hashable):
|
||||
months = '1 month' if total_months == 1 else f'{total_months} months'
|
||||
return f'{self.author.name} joined {self.role_subscription.tier_name} and has been a subscriber of {self.guild} for {months}!'
|
||||
|
||||
if self.type is MessageType.stage_start:
|
||||
return f'{self.author.name} started **{self.content}**.'
|
||||
|
||||
if self.type is MessageType.stage_end:
|
||||
return f'{self.author.name} ended **{self.content}**.'
|
||||
|
||||
if self.type is MessageType.stage_speaker:
|
||||
return f'{self.author.name} is now a speaker.'
|
||||
|
||||
if self.type is MessageType.stage_raise_hand:
|
||||
return f'{self.author.name} requested to speak.'
|
||||
|
||||
if self.type is MessageType.stage_topic:
|
||||
return f'{self.author.name} changed Stage topic: **{self.content}**.'
|
||||
|
||||
# Fallback for unknown message types
|
||||
return ''
|
||||
|
||||
|
25
docs/api.rst
25
docs/api.rst
@ -1653,6 +1653,31 @@ of :class:`enum.Enum`.
|
||||
The system message sent when a user is given an advertisement to purchase a premium tier for
|
||||
an application during an interaction.
|
||||
|
||||
.. versionadded:: 2.2
|
||||
.. attribute:: stage_start
|
||||
|
||||
The system message sent when the stage starts.
|
||||
|
||||
.. versionadded:: 2.2
|
||||
.. attribute:: stage_end
|
||||
|
||||
The system message sent when the stage ends.
|
||||
|
||||
.. versionadded:: 2.2
|
||||
.. attribute:: stage_speaker
|
||||
|
||||
The system message sent when the stage speaker changes.
|
||||
|
||||
.. versionadded:: 2.2
|
||||
.. attribute:: stage_raise_hand
|
||||
|
||||
The system message sent when a user is requesting to speak by raising their hands.
|
||||
|
||||
.. versionadded:: 2.2
|
||||
.. attribute:: stage_topic
|
||||
|
||||
The system message sent when the stage topic changes.
|
||||
|
||||
.. versionadded:: 2.2
|
||||
.. attribute:: guild_application_premium_subscription
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user