async def purge(self, *, limit=<NUM_LIT:100>, check=None, before=None, after=None, around=None, oldest_first=False, bulk=True):
if check is None:<EOL><INDENT>check = lambda m: True<EOL><DEDENT>iterator = self.history(limit=limit, before=before, after=after, oldest_first=oldest_first, around=around)<EOL>ret = []<EOL>count = <NUM_LIT:0><EOL>minimum_time = int((time.time() - <NUM_LIT> * <NUM_LIT> * <NUM_LIT> * <NUM_LIT>) * <NUM_LIT> - <NUM_LIT>) << <NUM_LIT><EOL>strategy = self.delete_messages if self._state.is_bot and bulk else _single_delete_strategy<EOL>while True:<EOL><INDENT>try:<EOL><INDENT>msg = await iterator.next()<EOL><DEDENT>except NoMoreItems:<EOL><INDENT>if count >= <NUM_LIT:2>:<EOL><INDENT>to_delete = ret[-count:]<EOL>await strategy(to_delete)<EOL><DEDENT>elif count == <NUM_LIT:1>:<EOL><INDENT>await ret[-<NUM_LIT:1>].delete()<EOL><DEDENT>return ret<EOL><DEDENT>else:<EOL><INDENT>if count == <NUM_LIT:100>:<EOL><INDENT>to_delete = ret[-<NUM_LIT:100>:]<EOL>await strategy(to_delete)<EOL>count = <NUM_LIT:0><EOL>await asyncio.sleep(<NUM_LIT:1>)<EOL><DEDENT>if check(msg):<EOL><INDENT>if msg.id < minimum_time:<EOL><INDENT>if count == <NUM_LIT:1>:<EOL><INDENT>await ret[-<NUM_LIT:1>].delete()<EOL><DEDENT>elif count >= <NUM_LIT:2>:<EOL><INDENT>to_delete = ret[-count:]<EOL>await strategy(to_delete)<EOL><DEDENT>count = <NUM_LIT:0><EOL>strategy = _single_delete_strategy<EOL><DEDENT>count += <NUM_LIT:1><EOL>ret.append(msg)<EOL><DEDENT><DEDENT><DEDENT>
|coro|

        Purges a list of messages that meet the criteria given by the predicate
        ``check``. If a ``check`` is not provided then all messages are deleted
        without discrimination.

        You must have the :attr:`~Permissions.manage_messages` permission to
        delete messages even if they are your own (unless you are a user
        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
        ---------

        Deleting bot's messages ::

            def is_me(m):
                return m.author == client.user

            deleted = await channel.purge(limit=100, check=is_me)
            await channel.send('Deleted {} message(s)'.format(len(deleted)))

        Parameters
        -----------
        limit: Optional[:class:`int`]
            The number of messages to search through. This is not the number
            of messages that will be deleted, though it can be.
        check: predicate
            The function used to check if a message should be deleted.
            It must take a :class:`Message` as its sole parameter.
        before
            Same as ``before`` in :meth:`history`.
        after
            Same as ``after`` in :meth:`history`.
        around
            Same as ``around`` in :meth:`history`.
        oldest_first
            Same as ``oldest_first`` in :meth:`history`.
        bulk: :class:`bool`
            If True, use bulk delete. bulk=False is useful for mass-deleting
            a bot's own messages without manage_messages. When True, will fall
            back to single delete if current account is a user bot, or if
            messages are older than two weeks.

        Raises
        -------
        Forbidden
            You do not have proper permissions to do the actions required.
        HTTPException
            Purging the messages failed.

        Returns
        --------
        List[:class:`.Message`]
            The list of messages that were deleted.