Browse Source

Add support for stage message types

pull/10109/head
Rapptz 2 years ago
committed by dolfies
parent
commit
841f1debdc
  1. 2
      discord/automod.py
  2. 2
      discord/channel.py
  3. 8
      discord/colour.py
  4. 10
      discord/enums.py
  5. 8
      discord/guild.py
  6. 15
      discord/message.py
  7. 4
      discord/webhook/async_.py
  8. 25
      docs/api.rst

2
discord/automod.py

@ -76,7 +76,7 @@ class AutoModRuleAction:
A custom message which will be shown to a user when their message is blocked.
Passing this sets :attr:`type` to :attr:`~AutoModRuleActionType.block_message`.
.. versionadded:: 2.2
.. versionadded:: 2.0
"""
__slots__ = ('type', 'channel_id', 'duration', 'custom_message')

2
discord/channel.py

@ -1449,7 +1449,7 @@ class StageChannel(VocalGuildChannel):
The last message ID of the message sent to this channel. It may
*not* point to an existing or valid message.
.. versionadded:: 2.2
.. versionadded:: 2.0
slowmode_delay: :class:`int`
The number of seconds a member must wait between sending messages
in this channel. A value of ``0`` denotes that it is disabled.

8
discord/colour.py

@ -459,8 +459,8 @@ class Colour:
.. versionadded:: 1.5
.. versionchanged:: 2.2
Updated colour from previous ``0x36393F`` to reflect discord theme changes.
.. versionchanged:: 2.0
Updated colour from previous ``0x36393F`` to reflect Discord theme changes.
"""
return cls(0x313338)
@ -490,7 +490,7 @@ class Colour:
.. colour:: #2B2D31
.. versionadded:: 2.2
.. versionadded:: 2.0
"""
return cls(0x2B2D31)
@ -500,7 +500,7 @@ class Colour:
.. colour:: #EEEFF1
.. versionadded:: 2.2
.. versionadded:: 2.0
"""
return cls(0xEEEFF1)

10
discord/enums.py

@ -286,11 +286,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

8
discord/guild.py

@ -1520,20 +1520,20 @@ class Guild(Hashable):
bitrate: :class:`int`
The channel's preferred audio bitrate in bits per second.
.. versionadded:: 2.2
.. versionadded:: 2.0
user_limit: :class:`int`
The channel's limit for number of members that can be in a voice channel.
.. versionadded:: 2.2
.. versionadded:: 2.0
rtc_region: Optional[:class:`str`]
The region for the voice channel's voice communication.
A value of ``None`` indicates automatic voice region detection.
.. versionadded:: 2.2
.. versionadded:: 2.0
video_quality_mode: :class:`VideoQualityMode`
The camera video quality for the voice channel's participants.
.. versionadded:: 2.2
.. versionadded:: 2.0
reason: Optional[:class:`str`]
The reason for creating this channel. Shows up on the audit log.

15
discord/message.py

@ -1899,6 +1899,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 self.content

4
discord/webhook/async_.py

@ -978,7 +978,7 @@ class Webhook(BaseWebhook):
attach the client's internal state. If ``session`` is not given
while this is given then the client's internal session will be used.
.. versionadded:: 2.2
.. versionadded:: 2.0
bot_token: Optional[:class:`str`]
The bot authentication token for authenticated requests
involving the webhook.
@ -1043,7 +1043,7 @@ class Webhook(BaseWebhook):
attach the client's internal state. If ``session`` is not given
while this is given then the client's internal session will be used.
.. versionadded:: 2.2
.. versionadded:: 2.0
bot_token: Optional[:class:`str`]
The bot authentication token for authenticated requests
involving the webhook.

25
docs/api.rst

@ -1716,6 +1716,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.0
.. attribute:: stage_start
The system message sent when the stage starts.
.. versionadded:: 2.0
.. attribute:: stage_end
The system message sent when the stage ends.
.. versionadded:: 2.0
.. attribute:: stage_speaker
The system message sent when the stage speaker changes.
.. versionadded:: 2.0
.. attribute:: stage_raise_hand
The system message sent when a user is requesting to speak by raising their hands.
.. versionadded:: 2.0
.. attribute:: stage_topic
The system message sent when the stage topic changes.
.. versionadded:: 2.0
.. attribute:: guild_application_premium_subscription

Loading…
Cancel
Save