Skip to content

Commit

Permalink
fix: stream.duration being a string
Browse files Browse the repository at this point in the history
  • Loading branch information
maybeanerd authored and renovate[bot] committed Feb 22, 2024
1 parent 98b2574 commit 3b90940
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/commands/joinsound/management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ export async function validateAndSaveJoinsound(
}
if (attachment.size > maximumSingleFileSize) {
interaction.followUp(
`The file you sent is larger than ${
maximumSingleFileSize / 1024
`The file you sent is larger than ${maximumSingleFileSize / 1024
} KB, which is the limit per file!`,
);
return;
Expand Down Expand Up @@ -187,13 +186,14 @@ export async function validateAndSaveJoinsound(
);
return;
}
if (!firstStream.duration) {
const duration = firstStream.duration ? Number(firstStream.duration) : null;
if (!duration || Number.isNaN(duration)) {
interaction.followUp(
"Failed to calculate the duration of the joinsound you're trying to add.",
);
return;
}
if (firstStream.duration > 8) {
if (duration > 8) {
interaction.followUp(
"The joinsound you're trying to add is longer than 8 seconds.",
);
Expand Down Expand Up @@ -346,8 +346,7 @@ export async function getJoinsoundOverviewOfUser(

info.push({
name: 'Storage Used by Joinsounds',
value: `**${(storageUsed / 1024).toFixed(1)} KB** / ${
joinsoundStorageUserLimit / 1024
value: `**${(storageUsed / 1024).toFixed(1)} KB** / ${joinsoundStorageUserLimit / 1024
} KB`,
inline: false,
});
Expand Down

0 comments on commit 3b90940

Please sign in to comment.