Rename allowed mention parameters to allowed_mentions

This commit is contained in:
Rapptz
2020-04-04 13:03:08 -04:00
parent 730d79d60a
commit d853a57e86
5 changed files with 35 additions and 34 deletions

View File

@ -770,7 +770,7 @@ class Messageable(metaclass=abc.ABCMeta):
async def send(self, content=None, *, tts=False, embed=None, file=None,
files=None, delete_after=None, nonce=None,
mentions=None):
allowed_mentions=None):
"""|coro|
Sends a message to the destination with the content given.
@ -806,7 +806,7 @@ class Messageable(metaclass=abc.ABCMeta):
If provided, the number of seconds to wait in the background
before deleting the message we just sent. If the deletion fails,
then it is silently ignored.
mentions: :class:`AllowedMentions`
allowed_mentions: :class:`AllowedMentions`
Controls the mentions being processed in this message.
.. versionadded:: 1.4
@ -833,13 +833,13 @@ class Messageable(metaclass=abc.ABCMeta):
if embed is not None:
embed = embed.to_dict()
if mentions is not None:
if state.mentions is not None:
mentions = state.mentions.merge(mentions).to_dict()
if allowed_mentions is not None:
if state.allowed_mentions is not None:
allowed_mentions = state.allowed_mentions.merge(allowed_mentions).to_dict()
else:
mentions = mentions.to_dict()
allowed_mentions = allowed_mentions.to_dict()
else:
mentions = state.mentions and state.mentions.to_dict()
allowed_mentions = state.allowed_mentions and state.allowed_mentions.to_dict()
if file is not None and files is not None:
raise InvalidArgument('cannot pass both file and files parameter to send()')
@ -862,12 +862,13 @@ class Messageable(metaclass=abc.ABCMeta):
try:
data = await state.http.send_files(channel.id, files=files, content=content, tts=tts,
embed=embed, nonce=nonce, mentions=mentions)
embed=embed, nonce=nonce, allowed_mentions=allowed_mentions)
finally:
for f in files:
f.close()
else:
data = await state.http.send_message(channel.id, content, tts=tts, embed=embed, nonce=nonce, mentions=mentions)
data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
nonce=nonce, allowed_mentions=allowed_mentions)
ret = state.create_message(channel=channel, data=data)
if delete_after is not None: