aboutsummaryrefslogtreecommitdiff
path: root/discord/abc.py
diff options
context:
space:
mode:
Diffstat (limited to 'discord/abc.py')
-rw-r--r--discord/abc.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/discord/abc.py b/discord/abc.py
index ec668f5c..b0ee61fe 100644
--- a/discord/abc.py
+++ b/discord/abc.py
@@ -603,6 +603,46 @@ class GuildChannel:
else:
raise InvalidArgument('Invalid overwrite type provided.')
+ async def _clone_impl(self, base_attrs, *, name=None, reason=None):
+ base_attrs['permission_overwrites'] = [
+ x._asdict() for x in self._overwrites
+ ]
+ base_attrs['parent_id'] = self.category_id
+ base_attrs['name'] = name or self.name
+ guild_id = self.guild.id
+ cls = self.__class__
+ data = await self._state.http.create_channel(guild_id, self._type, reason=reason, **base_attrs)
+ obj = cls(state=self._state, guild=self.guild, data=data)
+
+ # temporarily add it to the cache
+ self.guild._channels[obj.id] = obj
+ return obj
+
+ async def clone(self, *, name=None, reason=None):
+ """|coro|
+
+ Clones this channel. This creates a channel with the same properties
+ as this channel.
+
+ .. versionadded:: 1.1.0
+
+ Parameters
+ ------------
+ name: Optional[:class:`str`]
+ The name of the new channel. If not provided, defaults to this
+ channel name.
+ reason: Optional[:class:`str`]
+ The reason for cloning this channel. Shows up on the audit log.
+
+ Raises
+ -------
+ Forbidden
+ You do not have the proper permissions to create this channel.
+ HTTPException
+ Creating the channel failed.
+ """
+ raise NotImplementedError
+
async def create_invite(self, *, reason=None, **fields):
"""|coro|