Remove userbot functionality

This has a lot of legacy and cruft so there may be some stuff I've
missed but this first pass is enough to get a clear separation.
This commit is contained in:
Rapptz
2021-04-04 10:09:25 -04:00
parent 59aa1a0e5f
commit 54288879e2
16 changed files with 57 additions and 1539 deletions

View File

@@ -311,10 +311,6 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
account). The :attr:`~Permissions.read_message_history` permission is
also needed to retrieve message history.
Internally, this employs a different number of strategies depending
on the conditions met such as if a bulk delete is possible or if
the account is a user bot or not.
Examples
---------
@@ -345,8 +341,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
bulk: :class:`bool`
If ``True``, use bulk delete. Setting this to ``False`` is useful for mass-deleting
a bot's own messages without :attr:`Permissions.manage_messages`. When ``True``, will
fall back to single delete if current account is a user bot (now deprecated), or if messages are
older than two weeks.
fall back to single delete if messages are older than two weeks.
Raises
-------
@@ -369,7 +364,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
count = 0
minimum_time = int((time.time() - 14 * 24 * 60 * 60) * 1000.0 - 1420070400000) << 22
strategy = self.delete_messages if self._state.is_bot and bulk else _single_delete_strategy
strategy = self.delete_messages if bulk else _single_delete_strategy
while True:
try:
@@ -1442,95 +1437,6 @@ class GroupChannel(discord.abc.Messageable, Hashable):
return base
@utils.deprecated()
async def add_recipients(self, *recipients):
r"""|coro|
Adds recipients to this group.
A group can only have a maximum of 10 members.
Attempting to add more ends up in an exception. To
add a recipient to the group, you must have a relationship
with the user of type :attr:`RelationshipType.friend`.
.. deprecated:: 1.7
Parameters
-----------
\*recipients: :class:`User`
An argument list of users to add to this group.
Raises
-------
HTTPException
Adding a recipient to this group failed.
"""
# TODO: wait for the corresponding WS event
req = self._state.http.add_group_recipient
for recipient in recipients:
await req(self.id, recipient.id)
@utils.deprecated()
async def remove_recipients(self, *recipients):
r"""|coro|
Removes recipients from this group.
.. deprecated:: 1.7
Parameters
-----------
\*recipients: :class:`User`
An argument list of users to remove from this group.
Raises
-------
HTTPException
Removing a recipient from this group failed.
"""
# TODO: wait for the corresponding WS event
req = self._state.http.remove_group_recipient
for recipient in recipients:
await req(self.id, recipient.id)
@utils.deprecated()
async def edit(self, **fields):
"""|coro|
Edits the group.
.. deprecated:: 1.7
Parameters
-----------
name: Optional[:class:`str`]
The new name to change the group to.
Could be ``None`` to remove the name.
icon: Optional[:class:`bytes`]
A :term:`py:bytes-like object` representing the new icon.
Could be ``None`` to remove the icon.
Raises
-------
HTTPException
Editing the group failed.
"""
try:
icon_bytes = fields['icon']
except KeyError:
pass
else:
if icon_bytes is not None:
fields['icon'] = utils._bytes_to_base64_data(icon_bytes)
data = await self._state.http.edit_group(self.id, **fields)
self._update_group(data)
async def leave(self):
"""|coro|