Skip to content

Commit

Permalink
Remove userbot functionality
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Rapptz committed Apr 4, 2021
1 parent 59aa1a0 commit 5428887
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 1,541 deletions.
4 changes: 1 addition & 3 deletions discord/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,17 @@

from .client import Client
from .appinfo import AppInfo
from .user import User, ClientUser, Profile
from .user import User, ClientUser
from .emoji import Emoji
from .partial_emoji import PartialEmoji
from .activity import *
from .channel import *
from .guild import Guild
from .flags import *
from .relationship import Relationship
from .member import Member, VoiceState
from .message import *
from .asset import Asset
from .errors import *
from .calls import CallMessage, GroupCall
from .permissions import Permissions, PermissionOverwrite
from .role import Role, RoleTags
from .file import File
Expand Down
174 changes: 0 additions & 174 deletions discord/calls.py

This file was deleted.

98 changes: 2 additions & 96 deletions discord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,6 @@ async def purge(self, *, limit=100, check=None, before=None, after=None, around=
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
---------
Expand Down Expand Up @@ -345,8 +341,7 @@ def is_me(m):
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
-------
Expand All @@ -369,7 +364,7 @@ def is_me(m):
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:
Expand Down Expand Up @@ -1442,95 +1437,6 @@ def permissions_for(self, user):

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|
Expand Down
Loading

0 comments on commit 5428887

Please sign in to comment.