-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
There was a problem hiding this 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) toplatformUserId
for clarity.
export async function checkIfGuildIsTrackingChannelAlready(
src/utils/database.ts:37
- The code still uses
db.prepare
(SQLite style) even though a PostgreSQLPool
was imported. Update this helper to usepool.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 usedstreamerId
. Ensure the correct variable is passed orplatformUserId
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(", ")}!`, |
There was a problem hiding this comment.
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yolo
it now lists which channels a given user is already being tracked in
closes #32