Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes bot.send_filtered return the message that is sent #3052

Merged
merged 3 commits into from
Oct 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3052.enhance.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
``bot.send_filtered`` now returns the message that is sent.
7 changes: 6 additions & 1 deletion redbot/core/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,11 @@ async def send_filtered(
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
Flame442 marked this conversation as resolved.
Show resolved Hide resolved
The message that was sent.
"""

content = kwargs.pop("content", None)
Expand All @@ -702,7 +707,7 @@ async def send_filtered(
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):
Expand Down