Skip to content

feat!: remove deprecated guild create features #1293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions changelog/1292.breaking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Remove the deprecated :meth:`Guild.delete`, :meth:`Client.guild_builder`, :meth:`Client.create_guild`, :meth:`Template.create_guild` and :class:`GuildBuilder` discord API features.
For more information look at https://github.com/discord/discord-api-docs/pull/7469.
99 changes: 1 addition & 98 deletions disnake/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
)
from .flags import ApplicationFlags, Intents, MemberCacheFlags
from .gateway import DiscordWebSocket, ReconnectWebSocket
from .guild import Guild, GuildBuilder
from .guild import Guild
from .guild_preview import GuildPreview
from .http import HTTPClient
from .i18n import LocalizationProtocol, LocalizationStore
Expand Down Expand Up @@ -87,7 +87,6 @@

from .abc import GuildChannel, PrivateChannel, Snowflake, SnowflakeTime
from .app_commands import APIApplicationCommand, MessageCommand, SlashCommand, UserCommand
from .asset import AssetBytes
from .channel import DMChannel
from .member import Member
from .message import Message
Expand Down Expand Up @@ -2099,102 +2098,6 @@ async def fetch_guild_preview(
data = await self.http.get_guild_preview(guild_id)
return GuildPreview(data=data, state=self._connection)

async def create_guild(
self,
*,
name: str,
icon: AssetBytes = MISSING,
code: str = MISSING,
) -> Guild:
"""|coro|

Creates a :class:`.Guild`.

See :func:`guild_builder` for a more comprehensive alternative.

Bot accounts in 10 or more guilds are not allowed to create guilds.

.. note::

Using this, you will **not** receive :attr:`.Guild.channels`, :attr:`.Guild.members`,
:attr:`.Member.activity` and :attr:`.Member.voice` per :class:`.Member`.

.. versionchanged:: 2.5
Removed the ``region`` parameter.

.. versionchanged:: 2.6
Raises :exc:`ValueError` instead of ``InvalidArgument``.

Parameters
----------
name: :class:`str`
The name of the guild.
icon: |resource_type|
The icon of the guild.
See :meth:`.ClientUser.edit` for more details on what is expected.

.. versionchanged:: 2.5
Now accepts various resource types in addition to :class:`bytes`.

code: :class:`str`
The code for a template to create the guild with.

.. versionadded:: 1.4

Raises
------
NotFound
The ``icon`` asset couldn't be found.
HTTPException
Guild creation failed.
ValueError
Invalid icon image format given. Must be PNG or JPG.
TypeError
The ``icon`` asset is a lottie sticker (see :func:`Sticker.read <disnake.Sticker.read>`).

Returns
-------
:class:`.Guild`
The created guild. This is not the same guild that is added to cache.
"""
if icon is not MISSING:
icon_base64 = await utils._assetbytes_to_base64_data(icon)
else:
icon_base64 = None

if code:
data = await self.http.create_from_template(code, name, icon_base64)
else:
data = await self.http.create_guild(name, icon_base64)
return Guild(data=data, state=self._connection)

def guild_builder(self, name: str) -> GuildBuilder:
"""Creates a builder object that can be used to create more complex guilds.

This is a more comprehensive alternative to :func:`create_guild`.
See :class:`.GuildBuilder` for details and examples.

Bot accounts in 10 or more guilds are not allowed to create guilds.

.. note::

Using this, you will **not** receive :attr:`.Guild.channels`, :attr:`.Guild.members`,
:attr:`.Member.activity` and :attr:`.Member.voice` per :class:`.Member`.

.. versionadded:: 2.8

Parameters
----------
name: :class:`str`
The name of the guild.

Returns
-------
:class:`.GuildBuilder`
The guild builder object for configuring and creating a new guild.
"""
return GuildBuilder(name=name, state=self._connection)

async def fetch_stage_instance(self, channel_id: int, /) -> StageInstance:
"""|coro|

Expand Down
Loading
Loading