Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Fix feed parameter in /search command #203

Merged
merged 3 commits into from
May 29, 2023
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
9 changes: 6 additions & 3 deletions buttercup/cogs/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from buttercup.cogs.helpers import (
BlossomException,
BlossomUser,
extract_sub_name,
get_discord_time_str,
get_duration_str,
get_initial_username,
Expand Down Expand Up @@ -269,7 +270,8 @@ async def _search_from_cache(

from_str = after_time.isoformat() if after_time else None
until_str = before_time.isoformat() if before_time else None
feed = feed if feed else None
feed = "/r/" + extract_sub_name(feed) if feed else None
feed_str = feed if feed else "all feeds"

request_page = (discord_page * self.discord_page_size) // self.request_page_size

Expand All @@ -280,7 +282,7 @@ async def _search_from_cache(
"author": user_id,
"create_time__gte": from_str,
"create_time__lte": until_str,
"feed": feed,
"submission__feed__iexact": feed,
"url__isnull": False,
"ordering": "-create_time",
"page_size": self.request_page_size,
Expand All @@ -299,7 +301,7 @@ async def _search_from_cache(
query=query,
user=get_username(user),
time_str=time_str,
feed_str=feed if feed else "all feeds",
feed_str=feed_str,
duration_str=get_duration_str(start),
)
)
Expand Down Expand Up @@ -344,6 +346,7 @@ async def _search_from_cache(
query=query,
user=get_username(user),
time_str=time_str,
feed_str=feed_str,
duration_str=get_duration_str(start),
),
embed=Embed(
Expand Down
2 changes: 1 addition & 1 deletion buttercup/strings/en_US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ search:
more_occurrences: |-
... and {count} more occurrence(s).
embed_message: |-
Here are your results for `{query}` in transcriptions by {user} {time_str}! ({duration_str})
Here are your results for `{query}` in transcriptions by {user} {time_str} in {feed_str}! ({duration_str})
embed_title: |-
Results for `{query}` by {user}
embed_footer: |-
Expand Down