Fixing error message formatting
This commit is contained in:
8
index.js
8
index.js
@@ -225,7 +225,7 @@ Searxng.prototype.handleMessage = function(event, room) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const name = toSearch;
|
const name = toSearch.trim();
|
||||||
toSearch = encodeURIComponent(toSearch);
|
toSearch = encodeURIComponent(toSearch);
|
||||||
|
|
||||||
const searchURL = this.searxngInstance + "/search?category_images=1&pageno=1&time_range=&format=json&"+this.searxngParameters+"&safesearch="+(messagePieces[0] == unsafeImageSearchCmd ? "0" : "1")+"&q=" + toSearch;
|
const searchURL = this.searxngInstance + "/search?category_images=1&pageno=1&time_range=&format=json&"+this.searxngParameters+"&safesearch="+(messagePieces[0] == unsafeImageSearchCmd ? "0" : "1")+"&q=" + toSearch;
|
||||||
@@ -240,15 +240,15 @@ Searxng.prototype.handleMessage = function(event, room) {
|
|||||||
const results = bodyObj.results;
|
const results = bodyObj.results;
|
||||||
|
|
||||||
if (typeof results === 'undefined' || results == null || results.length <= 0) {
|
if (typeof results === 'undefined' || results == null || results.length <= 0) {
|
||||||
matrixClient.sendNotice(room.roomId, "No results found for \""+toSearch+"\"");
|
matrixClient.sendNotice(room.roomId, "No results found for \""+name+"\"");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (resultIndex > (results.length - 1)) {
|
else if (resultIndex > (results.length - 1)) {
|
||||||
matrixClient.sendNotice(room.roomId, "No result found for \""+toSearch+"\" at position "+(resultIndex+1));
|
matrixClient.sendNotice(room.roomId, "No result found for \""+name+"\" at position "+(resultIndex+1));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendImage(results, resultIndex, room.roomId, name.trim(), event.getContent().body, 0, matrixClient, uploadMatrixClient, event.getSender(), logSearches);
|
sendImage(results, resultIndex, room.roomId, name, event.getContent().body, 0, matrixClient, uploadMatrixClient, event.getSender(), logSearches);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
matrixClient.sendNotice(room.roomId, "Error occurred during \"" + event.getContent().body + "\"");
|
matrixClient.sendNotice(room.roomId, "Error occurred during \"" + event.getContent().body + "\"");
|
||||||
|
|||||||
Reference in New Issue
Block a user