Skip to content

feat(snippets): add member filtering to list snippets command#1205

Merged
kzndotsh merged 1 commit intomainfrom
feat/snippets-list-by-member
Mar 8, 2026
Merged

feat(snippets): add member filtering to list snippets command#1205
kzndotsh merged 1 commit intomainfrom
feat/snippets-list-by-member

Conversation

@kzndotsh
Copy link
Contributor

@kzndotsh kzndotsh commented Mar 8, 2026

Summary

  • $snippets/$ls now accepts an optional member argument to list snippets created by a specific user (e.g. $ls @user)
  • Uses FlexibleUserConverter to support mentions, user IDs, and usernames — including users who have left the guild
  • Embed title updates to show "Snippets by username" when filtering by member
  • Falls back gracefully to search or list-all when no member is provided

Test plan

  • $snippets — lists all snippets as before
  • $snippets @user — lists only snippets created by that user
  • $snippets some text — search still works when input isn't a valid user
  • $ls @user — alias works
  • Mention a user who has left the guild by ID — should still resolve
  • User with no snippets — shows appropriate error message

🤖 Generated with Claude Code

Summary by Sourcery

Add optional member-based filtering to the snippets listing command and update related presentation and changelog entries.

New Features:

  • Allow the $snippets/$ls command to accept an optional member argument to list snippets created by a specific user.
  • Update snippets list embeds to show a member-specific title when filtering by creator.

Documentation:

  • Document the new member filtering option for the snippets command in the changelog.

$snippets/$ls now accepts an optional member argument to list snippets
created by a specific user. Uses FlexibleUserConverter to support
mentions, user IDs, and usernames, including users who have left the
guild. Falls back to search or list-all when no member is provided.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 8, 2026

Reviewer's Guide

Adds optional member-based filtering to the $snippets/$ls command using FlexibleUserConverter, updates embeds and error messages to reflect the filter, and documents the new behavior in the changelog.

Sequence diagram for member-filtered snippet listing

sequenceDiagram
    actor User
    participant Discord
    participant TuxBot
    participant ListSnippets
    participant SnippetRepository as SnippetRepository
    participant ViewMenu

    User->>Discord: send message "$snippets @member"
    Discord->>TuxBot: create command Context
    TuxBot->>ListSnippets: list_snippets(ctx, member, search_query=None)

    alt member argument provided
        ListSnippets->>SnippetRepository: get_snippets_by_creator(member.id, ctx.guild.id)
        SnippetRepository-->>ListSnippets: list[Snippet]
        ListSnippets->>ListSnippets: sort(snippets, key=uses, descending)
    else search_query provided
        ListSnippets->>SnippetRepository: search_snippets(ctx.guild.id, search_query)
        SnippetRepository-->>ListSnippets: list[Snippet]
        ListSnippets->>ListSnippets: sort(snippets, key=uses, descending)
    else no member or search_query
        ListSnippets->>SnippetRepository: get_all_snippets_by_guild_id(ctx.guild.id, order_by=uses_desc)
        SnippetRepository-->>ListSnippets: list[Snippet]
    end

    alt no snippets found
        ListSnippets->>TuxBot: send_snippet_error(ctx, message based on member/search)
        TuxBot-->>Discord: send error embed
        Discord-->>User: display error
    else snippets found
        ListSnippets->>ViewMenu: create ViewMenu(ctx)
        loop pages of SNIPPET_PAGINATION_LIMIT
            ListSnippets->>ListSnippets: _create_snippets_list_embed(ctx, page_snippets, total_snippets, search_query, member)
            ListSnippets-->>ViewMenu: embed page
        end
        ViewMenu->>Discord: start pagination
        Discord-->>User: display paginated snippet embeds
    end
Loading

Class diagram for ListSnippets member-filtered listing flow

classDiagram
    class ListSnippets {
        +Tux bot
        +list_snippets(ctx, member, search_query) void
    }

    class SnippetRepository {
        +get_snippets_by_creator(creator_id, guild_id) list~Snippet~
        +search_snippets(guild_id, search_query) list~Snippet~
        +get_all_snippets_by_guild_id(guild_id, order_by) list~Snippet~
    }

    class Snippet {
        +int id
        +int guild_id
        +int creator_id
        +string name
        +string content
        +int uses
    }

    class FlexibleUserConverter {
        +convert(ctx, argument) discord.User
    }

    class SnippetsModule {
        +_create_snippets_list_embed(ctx, snippets, total_snippets, search_query, member) discord.Embed
    }

    class ViewMenu {
        +ViewMenu(ctx)
        +add_page(embed) void
        +start() void
    }

    ListSnippets --> SnippetRepository : uses
    ListSnippets --> Snippet : returns
    ListSnippets --> FlexibleUserConverter : member parameter converter
    ListSnippets --> SnippetsModule : calls _create_snippets_list_embed
    ListSnippets --> ViewMenu : creates and populates

    SnippetRepository --> Snippet : manages
Loading

File-Level Changes

Change Details Files
Add optional member parameter to list snippets and wire it into snippet retrieval and embed generation.
  • Introduce a _MEMBER_PARAM using FlexibleUserConverter and add a `member: discord.User
Noneparameter to thelist_snippetscommand.</li><li>Update the command docstring to describe member-based filtering alongside search queries.</li><li>Route snippet fetching toget_snippets_by_creatorwhen a member is provided, falling back to search or full-list logic otherwise, and ensure results are sorted by usage count in all cases.</li><li>Pass the resolvedmember` through to the embed creation helper when building paginated results.
Update snippet list embed to reflect member-specific views.
  • Extend _create_snippets_list_embed to accept an optional member argument.
  • Change the embed title to "Snippets by <display_name>" when a member filter is active, keeping the existing count formatting.
  • Preserve existing footer and description behavior while incorporating the new title format.
src/tux/modules/snippets/__init__.py
Improve user-facing messaging and documentation for the new member filter.
  • Adjust the no-results error message to distinguish between member-filtered and search/no-filter cases, using the member’s display_name when applicable.
  • Add a changelog entry describing the new optional member argument, the FlexibleUserConverter support, and example usage for $snippets/$ls.
src/tux/modules/snippets/list_snippets.py
CHANGELOG.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the snippet listing functionality by introducing the ability to filter snippets by their creator. Users can now easily view snippets made by a specific individual using a new optional argument, improving discoverability and organization within the snippet system. The implementation ensures robust user resolution and provides clear feedback through dynamic embed titles and appropriate error messages.

Highlights

  • Member Filtering for Snippets: The $snippets and $ls commands now support an optional member argument, allowing users to list snippets created by a specific user.
  • Flexible User Resolution: The FlexibleUserConverter is utilized to resolve members, supporting mentions, user IDs, and usernames, even for users who have left the guild.
  • Dynamic Embed Titles: The embed title for snippet lists dynamically updates to display "Snippets by username" when filtering by a specific member.
  • Robust Fallback: The command gracefully falls back to searching or listing all snippets if no valid member argument is provided.
Changelog
  • CHANGELOG.md
    • Added a changelog entry detailing the new snippet filtering feature for the $snippets/$ls command.
  • src/tux/modules/snippets/init.py
    • Modified the _create_snippets_list_embed function to accept an optional member parameter.
    • Updated the embed title logic to display "Snippets by username" when a member filter is applied.
  • src/tux/modules/snippets/list_snippets.py
    • Imported discord and FlexibleUserConverter for user resolution.
    • Defined _MEMBER_PARAM to use FlexibleUserConverter for the new member command parameter.
    • Updated the list_snippets command to accept an optional member argument.
    • Implemented logic to fetch snippets specifically by a creator's ID if a member is provided.
    • Refined the error message displayed when no snippets are found, making it specific to member filtering if applicable.
    • Passed the member argument to the _create_snippets_list_embed function for dynamic title generation.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Mar 8, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4e05a5a7-a474-493b-815a-eef130f68db7

📥 Commits

Reviewing files that changed from the base of the PR and between a4526aa and a480deb.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/tux/modules/snippets/__init__.py
  • src/tux/modules/snippets/list_snippets.py

📝 Walkthrough

Walkthrough

Added an optional member parameter to the snippets list command, enabling users to filter snippets by a specific member using FlexibleUserConverter. The feature supports mentions, user IDs, and usernames, including users who have left the guild. Updated command signature, filtering logic, and embed generation accordingly.

Changes

Cohort / File(s) Summary
Documentation
CHANGELOG.md
Added changelog entry documenting the new member argument feature for the snippets list command.
Snippets Module Enhancement
src/tux/modules/snippets/__init__.py, src/tux/modules/snippets/list_snippets.py
Extended snippets list functionality with optional member parameter. Updated embed title generation to display snippets by specific member when provided. Added FlexibleUserConverter import and member filtering logic that fetches snippets by creator ID when member is specified; preserves existing search and all-snippets behavior when member is not provided. Updated error messages to reference specific member when applicable.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/snippets-list-by-member

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@amazon-q-developer amazon-q-developer bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation correctly adds member filtering to the list snippets command. The code properly uses FlexibleUserConverter for flexible user input handling, maintains consistency with existing patterns, and includes appropriate error messages for different scenarios. The changes are well-integrated and ready for merge.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The nested ternary in the send_snippet_error call makes the description logic hard to follow and behaves oddly when member is set but search_query is not (it falls back to the generic "No snippets found." text); consider rewriting this as a straightforward if/elif/else block so member-specific messages are always used when a member is provided.
  • When both a member and trailing text are supplied (e.g. $snippets @user foo), the extra text is parsed into search_query but then ignored because the member branch short‑circuits the search logic; consider either supporting combined member+search filtering or validating and rejecting unexpected extra input to avoid confusing behavior.
  • get_snippets_by_creator results are sorted in Python by uses, whereas the other paths push ordering into the database; if possible, aligning this to use DB-level ordering as well would keep the behavior consistent and avoid an extra in‑memory sort.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The nested ternary in the `send_snippet_error` call makes the description logic hard to follow and behaves oddly when `member` is set but `search_query` is not (it falls back to the generic "No snippets found." text); consider rewriting this as a straightforward if/elif/else block so member-specific messages are always used when a member is provided.
- When both a member and trailing text are supplied (e.g. `$snippets @user foo`), the extra text is parsed into `search_query` but then ignored because the `member` branch short‑circuits the search logic; consider either supporting combined member+search filtering or validating and rejecting unexpected extra input to avoid confusing behavior.
- `get_snippets_by_creator` results are sorted in Python by `uses`, whereas the other paths push ordering into the database; if possible, aligning this to use DB-level ordering as well would keep the behavior consistent and avoid an extra in‑memory sort.

## Individual Comments

### Comment 1
<location path="src/tux/modules/snippets/list_snippets.py" line_range="65-69" />
<code_context>
-        # Fetch snippets with database-level ordering and optional search
-        if search_query:
+        if member is not None:
+            filtered_snippets = await self.db.snippet.get_snippets_by_creator(
+                member.id,
+                ctx.guild.id,
+            )
+            filtered_snippets.sort(key=lambda s: s.uses, reverse=True)
+        elif search_query:
             filtered_snippets = await self.db.snippet.search_snippets(
</code_context>
<issue_to_address>
**suggestion (performance):** Consider pushing the ordering by usage count into the DB for the member-filtered query as well.

In `get_all_snippets_by_guild_id` ordering is done in the DB via `order_by=desc(...)`, but for the member-specific path you fetch then sort in Python. To keep behavior consistent and avoid in-memory sorting for large result sets, consider adding an `order_by` option (or a variant) to `get_snippets_by_creator` so the DB returns results already ordered by `uses`.

Suggested implementation:

```python
        if member is not None:
            filtered_snippets = await self.db.snippet.get_snippets_by_creator(
                member.id,
                ctx.guild.id,
                order_by=desc(Snippet.__table__.c.uses),  # type: ignore[attr-defined]
            )
        elif search_query:

```

To make this compile and work correctly, you'll also need to:

1. Update the signature of `get_snippets_by_creator` (likely in your snippet repository/DAO) to accept an optional `order_by` parameter, defaulting to `None`, e.g.:

   ```python
   async def get_snippets_by_creator(
       self,
       creator_id: int,
       guild_id: int,
       order_by: Any | None = None,
   ) -> list[Snippet]:
   ```

2. Thread the `order_by` argument into the underlying query, similar to how it's done in `get_all_snippets_by_guild_id`, e.g.:

   ```python
   query = select(Snippet).where(...)

   if order_by is not None:
       query = query.order_by(order_by)
   ```

3. Ensure any other call sites of `get_snippets_by_creator` are updated if the new parameter is not keyword-only or if its position changes.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +65 to +69
filtered_snippets = await self.db.snippet.get_snippets_by_creator(
member.id,
ctx.guild.id,
)
filtered_snippets.sort(key=lambda s: s.uses, reverse=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (performance): Consider pushing the ordering by usage count into the DB for the member-filtered query as well.

In get_all_snippets_by_guild_id ordering is done in the DB via order_by=desc(...), but for the member-specific path you fetch then sort in Python. To keep behavior consistent and avoid in-memory sorting for large result sets, consider adding an order_by option (or a variant) to get_snippets_by_creator so the DB returns results already ordered by uses.

Suggested implementation:

        if member is not None:
            filtered_snippets = await self.db.snippet.get_snippets_by_creator(
                member.id,
                ctx.guild.id,
                order_by=desc(Snippet.__table__.c.uses),  # type: ignore[attr-defined]
            )
        elif search_query:

To make this compile and work correctly, you'll also need to:

  1. Update the signature of get_snippets_by_creator (likely in your snippet repository/DAO) to accept an optional order_by parameter, defaulting to None, e.g.:

    async def get_snippets_by_creator(
        self,
        creator_id: int,
        guild_id: int,
        order_by: Any | None = None,
    ) -> list[Snippet]:
  2. Thread the order_by argument into the underlying query, similar to how it's done in get_all_snippets_by_guild_id, e.g.:

    query = select(Snippet).where(...)
    
    if order_by is not None:
        query = query.order_by(order_by)
  3. Ensure any other call sites of get_snippets_by_creator are updated if the new parameter is not keyword-only or if its position changes.

@kzndotsh kzndotsh merged commit 3eebc28 into main Mar 8, 2026
28 of 29 checks passed
@kzndotsh kzndotsh deleted the feat/snippets-list-by-member branch March 8, 2026 15:16
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

📚 Documentation Preview

Type URL Version Message
Production https://tux.atl.dev - -
Preview https://92f85391-tux-docs.allthingslinux.workers.dev 92f85391-5f11-4f50-bf8c-2228123c4831 Preview: tux@6d4d1f9c4601cdab78263a8f5130625e923ff02e on 1205/merge by kzndotsh (run 457)

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA a480deb.
Ensure that dependencies are being submitted on PR branches. Re-running this action after a short time may resolve the issue. See the documentation for more information and troubleshooting advice.

Scanned Files

None

@sentry
Copy link

sentry bot commented Mar 8, 2026

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
664 2 662 36
View the full list of 2 ❄️ flaky test(s)
tests/cache/test_backend.py::TestValkeyBackend::test_setex_called_when_ttl_sec_provided

Flake rate in main: 100.00% (Passed 0 times, Failed 32 times)

Stack Traces | 0.005s run time
tests/cache/test_backend.py:162: in test_setex_called_when_ttl_sec_provided
    assert args[2] == "v"
E   assert '"v"' == 'v'
E     
E     #x1B[0m#x1B[91m- v#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
E     #x1B[92m+ "v"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
tests/cache/test_backend.py::TestValkeyBackend::test_string_value_stored_as_is

Flake rate in main: 100.00% (Passed 0 times, Failed 32 times)

Stack Traces | 0.007s run time
tests/cache/test_backend.py:128: in test_string_value_stored_as_is
    assert mock_client.set.call_args[0][1] == "plain"
E   assert '"plain"' == 'plain'
E     
E     #x1B[0m#x1B[91m- plain#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
E     #x1B[92m+ "plain"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
E     ? +     +#x1B[90m#x1B[39;49;00m

To view more test analytics, go to the [Prevent Tests Dashboard](https://All Things Linux.sentry.io/prevent/tests/?preventPeriod=30d&integratedOrgName=allthingslinux&repository=tux&branch=feat%2Fsnippets-list-by-member)

Comment on lines 41 to 46
async def list_snippets(
self,
ctx: commands.Context[Tux],
member: discord.User | None = _MEMBER_PARAM,
*,
search_query: str | None = None,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: When list_snippets is called with text that is not a valid user, the text is silently ignored instead of being used as the search_query.
Severity: MEDIUM

Suggested Fix

Modify the command's signature to ensure that text not matching a user is passed to the search_query. This could involve making search_query a regular positional parameter that can consume the remaining arguments, potentially by using a greedy converter or changing the parameter order.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/tux/modules/snippets/list_snippets.py#L41-L46

Potential issue: In the `list_snippets` command, the `member` parameter is a positional
argument with a custom converter, while `search_query` is a keyword-only argument. When
a user provides input that is not a valid user (e.g., `$snippets some text`), the
converter for `member` fails. The optional fallback correctly sets `member` to `None`,
but the remaining text is discarded because the keyword-only `search_query` parameter
cannot accept positional arguments. This results in the search functionality being
silently ignored when the command is invoked with a search term that doesn't parse as a
user.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Confidence score: 3/5

  • There is a concrete regression risk in src/tux/modules/snippets/list_snippets.py: the new positional member converter changes parsing so non-user first tokens error instead of falling back to snippet text search.
  • Given the high confidence (9/10) and meaningful severity (7/10), this is likely user-facing behavior change rather than a minor edge case, so merge risk is moderate.
  • Pay close attention to src/tux/modules/snippets/list_snippets.py - argument parsing now blocks intended search fallback behavior for some queries.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/tux/modules/snippets/list_snippets.py">

<violation number="1" location="src/tux/modules/snippets/list_snippets.py:44">
P1: The new positional `member` converter prevents text queries from falling back to search: non-user first tokens now error out instead of running snippet search.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

async def list_snippets(
self,
ctx: commands.Context[Tux],
member: discord.User | None = _MEMBER_PARAM,
Copy link

@cubic-dev-ai cubic-dev-ai bot Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: The new positional member converter prevents text queries from falling back to search: non-user first tokens now error out instead of running snippet search.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/tux/modules/snippets/list_snippets.py, line 44:

<comment>The new positional `member` converter prevents text queries from falling back to search: non-user first tokens now error out instead of running snippet search.</comment>

<file context>
@@ -37,33 +41,39 @@ def __init__(self, bot: Tux) -> None:
     async def list_snippets(
         self,
         ctx: commands.Context[Tux],
+        member: discord.User | None = _MEMBER_PARAM,
         *,
         search_query: str | None = None,
</file context>
Fix with Cubic

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a useful feature to filter snippets by member. My review focuses on improving the filtering logic to correctly handle cases where both a member and a search query are provided, as the current implementation ignores the search query in this scenario. I've also suggested improvements to the error messaging for better clarity and readability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant