Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions discord/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -3008,7 +3008,9 @@ async def edit_welcome_screen(self, **options):
The welcome channels. The order of the channels would be same as the passed list order.
enabled: Optional[:class:`bool`]
Whether the welcome screen should be displayed.

reason: Optional[:class:`str`]
The reason that shows up on audit log.

Raises
-------

Expand Down Expand Up @@ -3038,6 +3040,6 @@ async def edit_welcome_screen(self, **options):
options['welcome_channels'] = welcome_channels_data

if options:
new = await self._state.http.edit_welcome_screen(self.id, options)
new = await self._state.http.edit_welcome_screen(self.id, options, reason=options.get('reason'))
return WelcomeScreen(data=new, guild=self)

4 changes: 2 additions & 2 deletions discord/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,7 @@ def delete_channel_permissions(
def get_welcome_screen(self, guild_id: Snowflake) -> Response[welcome_screen.WelcomeScreen]:
return self.request(Route('GET', '/guilds/{guild_id}/welcome-screen', guild_id=guild_id))

def edit_welcome_screen(self, guild_id: Snowflake, payload: Any) -> Response[welcome_screen.WelcomeScreen]:
def edit_welcome_screen(self, guild_id: Snowflake, payload: Any, *, reason: Optional[str] = None) -> Response[welcome_screen.WelcomeScreen]:
keys = (
'description',
'welcome_channels',
Expand All @@ -1505,7 +1505,7 @@ def edit_welcome_screen(self, guild_id: Snowflake, payload: Any) -> Response[wel
payload = {
key: val for key, val in payload.items() if key in keys
}
return self.request(Route('PATCH', '/guilds/{guild_id}/welcome-screen', guild_id=guild_id), json=payload)
return self.request(Route('PATCH', '/guilds/{guild_id}/welcome-screen', guild_id=guild_id), json=payload, reason=reason)

# Voice management

Expand Down
9 changes: 6 additions & 3 deletions discord/welcome_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ async def edit(
description: Optional[str] = ...,
welcome_channels: Optional[List[WelcomeChannel]] = ...,
enabled: Optional[bool] = ...,
reason: Optional[str] = ...,
) -> None:
...

Expand Down Expand Up @@ -188,7 +189,9 @@ async def edit(self, **options):
The welcome channels. The order of the channels would be same as the passed list order.
enabled: Optional[:class:`bool`]
Whether the welcome screen should be displayed.

reason: Optional[:class:`str`]
The reason that shows up on Audit log.

Raises
-------

Expand All @@ -213,7 +216,7 @@ async def edit(self, **options):
options['welcome_channels'] = welcome_channels_data

if options:
new = await self._guild._state.http.edit_welcome_screen(self._guild.id, options)
new = await self._guild._state.http.edit_welcome_screen(self._guild.id, options, reason=options.get('reason'))
self._update(new)

return self
return self