Skip to content

feat(commands): better errors for /track #135

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

Merged
merged 2 commits into from
Jun 23, 2025

Conversation

ToastedDev
Copy link

it now lists which channels a given user is already being tracked in
closes #32

@ToastedDev ToastedDev requested a review from GalvinPython as a code owner June 23, 2025 10:52
@GalvinPython GalvinPython requested a review from Copilot June 23, 2025 11:46
@GalvinPython GalvinPython added enhancement New feature or request component: bot labels Jun 23, 2025
@GalvinPython GalvinPython moved this to In review in Feedr Jun 23, 2025
@GalvinPython GalvinPython added this to the 2.0.0 milestone Jun 23, 2025
@GalvinPython GalvinPython linked an issue Jun 23, 2025 that may be closed by this pull request
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the /track command by showing exactly which guild channels a user is already being tracked in.

  • Changed the database helper to return full rows instead of a boolean and removed the duplicate Twitch helper.
  • Updated both YouTube and Twitch handlers to retrieve tracked channels and list them in the error message.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/utils/database.ts Modified checkIfGuildIsTrackingChannelAlready to return an array of rows; cleaned up unused imports.
src/commands.ts Refactored tracking checks to use the new helper and enhanced error replies to list channel mentions.
Comments suppressed due to low confidence (3)

src/utils/database.ts:30

  • [nitpick] The parameter channelId actually represents the platform user ID. Consider renaming it (and its usages) to platformUserId for clarity.
export async function checkIfGuildIsTrackingChannelAlready(

src/utils/database.ts:37

  • The code still uses db.prepare (SQLite style) even though a PostgreSQL Pool was imported. Update this helper to use pool.query(...) or remove the unused client to avoid runtime errors.
        const statement = db.prepare(query);

src/commands.ts:417

  • In the Twitch block you’re calling this helper with platformUserId, but the original code used streamerId. Ensure the correct variable is passed or platformUserId is defined here, otherwise this will throw a reference error.
                        await checkIfGuildIsTrackingChannelAlready(

await interaction.reply({
flags: MessageFlags.Ephemeral,
content: "This channel is already being tracked!",
content: `This channel is already being tracked in ${trackedChannels.map((channel, index) => `${index > 0 && index === trackedChannels.length - 1 ? "and " : ""}<#${channel.guild_channel_id}>`).join(", ")}!`,
Copy link
Preview

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

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

[nitpick] For a two-item list this will render <#A>, and <#B> (with an extra comma). You might want to handle the two-item case specially or use a small utility to format lists in natural language.

Suggested change
content: `This channel is already being tracked in ${trackedChannels.map((channel, index) => `${index > 0 && index === trackedChannels.length - 1 ? "and " : ""}<#${channel.guild_channel_id}>`).join(", ")}!`,
content: `This channel is already being tracked in ${formatList(trackedChannels.map(channel => `<#${channel.guild_channel_id}>`))}!`,

Copilot uses AI. Check for mistakes.

Copy link
Owner

@GalvinPython GalvinPython left a comment

Choose a reason for hiding this comment

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

yolo

@GalvinPython GalvinPython merged commit b3783bc into GalvinPython:dev Jun 23, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In review to Done in Feedr Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: bot enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Improve errors in /track
2 participants