Skip to content

Commit f933de3

Browse files
handle descriptions not existing
for projects like builders. Builders doesn't have descriptions for everything on each element and the bot needs to handle that
1 parent b7d3f13 commit f933de3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/commands/docs/djs.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ export function searchDJSDoc(doc: Doc, query: string, searchPrivate?: boolean) {
112112
const searchResults = doc.search(query, options);
113113
if (!searchResults) return null;
114114
return searchResults.map((res) => {
115+
const parsedDescription = res.description?.trim?.() ?? "No description provided";
115116
// Labels and values have a limit of 100 characters
116-
const description = res.description.length >= 99 ? res.description.slice(0, 96) + "..." : res.description;
117+
const description = parsedDescription.length >= 99 ? parsedDescription.slice(0, 96) + "..." : parsedDescription;
117118
return {
118119
label: res.formattedName,
119120
description,

0 commit comments

Comments
 (0)