fix conflicts

This commit is contained in:
iDutchy
2020-12-04 19:05:58 -06:00
22 changed files with 564 additions and 157 deletions

View File

@ -32,7 +32,7 @@ import asyncio
from .iterators import HistoryIterator
from .context_managers import Typing
from .enums import ChannelType
from .errors import InvalidArgument, ClientException, HTTPException
from .errors import InvalidArgument, ClientException
from .permissions import PermissionOverwrite, Permissions
from .role import Role
from .invite import Invite
@ -805,7 +805,8 @@ class Messageable(metaclass=abc.ABCMeta):
async def send(self, content=None, *, tts=False, embed=None, file=None,
files=None, delete_after=None, nonce=None,
allowed_mentions=None, message_reference=None):
allowed_mentions=None, reference=None,
mention_author=None):
"""|coro|
Sends a message to the destination with the content given.
@ -857,6 +858,19 @@ class Messageable(metaclass=abc.ABCMeta):
.. versionadded:: 1.5.1.5
reference: Union[:class:`~discord.Message`, :class:`~discord.MessageReference`]
A reference to the :class:`~discord.Message` to which you are replying, this can be created using
:meth:`~discord.Message.to_reference` or passed directly as a :class:`~discord.Message`. You can control
whether this mentions the author of the referenced message using the :attr:`~discord.AllowedMentions.replied_user`
attribute of ``allowed_mentions`` or by setting ``mention_author``.
.. versionadded:: 1.6
mention_author: Optional[:class:`bool`]
If set, overrides the :attr:`~discord.AllowedMentions.replied_user` attribute of ``allowed_mentions``.
.. versionadded:: 1.6
Raises
--------
~discord.HTTPException
@ -864,8 +878,10 @@ class Messageable(metaclass=abc.ABCMeta):
~discord.Forbidden
You do not have the proper permissions to send the message.
~discord.InvalidArgument
The ``files`` list is not of the appropriate size or
you specified both ``file`` and ``files``.
The ``files`` list is not of the appropriate size,
you specified both ``file`` and ``files``,
or the ``reference`` object is not a :class:`~discord.Message`
or :class:`~discord.MessageReference`.
Returns
---------
@ -887,8 +903,15 @@ class Messageable(metaclass=abc.ABCMeta):
else:
allowed_mentions = state.allowed_mentions and state.allowed_mentions.to_dict()
if message_reference is not None:
message_reference = message_reference.to_dict()
if mention_author is not None:
allowed_mentions = allowed_mentions or {}
allowed_mentions['replied_user'] = bool(mention_author)
if reference is not None:
try:
reference = reference.to_message_reference_dict()
except AttributeError:
raise InvalidArgument('reference parameter must be Message or MessageReference') from None
if file is not None and files is not None:
raise InvalidArgument('cannot pass both file and files parameter to send()')
@ -899,8 +922,8 @@ class Messageable(metaclass=abc.ABCMeta):
try:
data = await state.http.send_files(channel.id, files=[file], allowed_mentions=allowed_mentions,
content=content, tts=tts, embed=embed, nonce=nonce,
message_reference=message_reference)
content=content, tts=tts, embed=embed, nonce=nonce,
message_reference=reference)
finally:
file.close()
@ -913,14 +936,14 @@ class Messageable(metaclass=abc.ABCMeta):
try:
data = await state.http.send_files(channel.id, files=files, content=content, tts=tts,
embed=embed, nonce=nonce, allowed_mentions=allowed_mentions,
message_reference=message_reference)
message_reference=reference)
finally:
for f in files:
f.close()
else:
data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
nonce=nonce, allowed_mentions=allowed_mentions,
message_reference=message_reference)
message_reference=reference)
ret = state.create_message(channel=channel, data=data)
if delete_after is not None: