Skip to content

Commit 51e5291

Browse files
committed
Handle if no match
1 parent a37d4fc commit 51e5291

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/commands/api/lookup.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ export class LookupCommand implements Command {
7979
}
8080
}
8181

82+
if (rows.length === 0) {
83+
await interaction.reply('Verilen ile eşleşen hiçbir oyuncu bulunamadı.');
84+
return;
85+
}
86+
8287
const longestCkey = rows.reduce(
8388
(max, row) => Math.max(max, row[2].length),
8489
0
@@ -87,7 +92,7 @@ export class LookupCommand implements Command {
8792
// :tf:
8893
const message =
8994
'```md\n' +
90-
`| CID | IP | ${' '.repeat(Math.floor(longestCkey / 2) - 2)}CKEY${' '.repeat(Math.ceil(longestCkey / 2) - 2)} |\n` +
95+
`| CID | IP | ${' '.repeat(Math.max(Math.floor(longestCkey / 2) - 2, 0))}CKEY${' '.repeat(Math.max(Math.ceil(longestCkey / 2) - 2, 0))} |\n` +
9196
`|------------|-----------------|-${'-'.repeat(longestCkey)}-|\n` +
9297
rows
9398
.map(

0 commit comments

Comments
 (0)