Skip to content

Commit

Permalink
fix: package command error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
espimarisa committed Aug 28, 2024
1 parent 4215b5d commit 5e9a38e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"@chatsift/pino-rotate-file": "^0.5.1",
"@discordjs/rest": "^2.3.0",
"@sentry/bun": "^8.26.0",
"@sentry/bun": "^8.27.0",
"date-fns": "^3.6.0",
"discord-api-types": "^0.37.98",
"discord.js": "^14.15.3",
Expand Down
4 changes: 2 additions & 2 deletions src/commands/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ export class PackageCommand extends HibikiCommand {
const version = interaction.options.getString(this.options[1]!.options[1]!.name, false);

// Gets the initial response
const response = await hibikiFetch(`${API_BASE_URL}/${encodeURIComponent(query)}`);
const response = await hibikiFetch(`${API_BASE_URL}/${encodeURIComponent(query.toLowerCase())}`);

// Converts response; handles errors
const body = await response?.json();
if (!(response || !body?.["dist-tags"]?.latest || body?.error)) {
if (!(response && body?.["dist-tags"]?.latest) || body?.error) {
await sendErrorReply("commands:COMMAND_PACKAGE_NOTFOUND", interaction);
return;
}
Expand Down

0 comments on commit 5e9a38e

Please sign in to comment.