From 428bf55480ace1729da47aa821266fdd92d9726e Mon Sep 17 00:00:00 2001 From: Flame442 <34169552+Flame442@users.noreply.github.com> Date: Sun, 13 Oct 2019 19:32:24 -0400 Subject: [PATCH] Makes bot.send_filtered return the message that is sent (#3052) * Makes bot.send_filtered return the sent msg * Create 3052.enhance.rst * :that: Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com> --- changelog.d/3052.enhance.rst | 1 + redbot/core/bot.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelog.d/3052.enhance.rst diff --git a/changelog.d/3052.enhance.rst b/changelog.d/3052.enhance.rst new file mode 100644 index 000000000..76366d55f --- /dev/null +++ b/changelog.d/3052.enhance.rst @@ -0,0 +1 @@ +``bot.send_filtered`` now returns the message that is sent. diff --git a/redbot/core/bot.py b/redbot/core/bot.py index 33e02b653..636d515c2 100644 --- a/redbot/core/bot.py +++ b/redbot/core/bot.py @@ -690,6 +690,11 @@ class RedBase(commands.GroupMixin, commands.bot.BotBase, RPCMixin): # pylint: d This should realistically only be used for responding using user provided input. (unfortunately, including usernames) Manually crafted messages which dont take any user input have no need of this + + Returns + ------- + discord.Message + The message that was sent. """ content = kwargs.pop("content", None) @@ -702,7 +707,7 @@ class RedBase(commands.GroupMixin, commands.bot.BotBase, RPCMixin): # pylint: d if filter_all_links: content = common_filters.filter_urls(content) - await destination.send(content=content, **kwargs) + return await destination.send(content=content, **kwargs) def add_cog(self, cog: commands.Cog): if not isinstance(cog, commands.Cog):