Update example.js

This commit is contained in:
q
2026-05-25 02:21:01 -04:00
parent d281e00405
commit 89305d32fa
+13 -13
View File
@@ -22,9 +22,9 @@ const matrixClient = sdk.createClient({
accessToken: myAccessToken,
userId: myUserId
});
const Searx = require('./index.js');
const searx = new Searx(matrixClient)
searx.setSearxInstance(searxng_server);
const Searxng = require('./index.js');
const searxng = new Searxng(matrixClient)
searxng.setSearxngInstance(searxng_server);
// --------- The following settings are all optional: ----------------------
@@ -36,25 +36,25 @@ const uploadMatrixClient = sdk.createClient({
accessToken: "syt_AnotherRealAccessTokenDoNotCommit",
userId: "@upload_leech:midov.pl"
});
searx.setUploadMatrixClient(uploadMatrixClient);
searxng.setUploadMatrixClient(uploadMatrixClient);
*/
// Set which rooms are not allowed to search for images.
//searx.setBlacklistedImgRooms(["!wehateimagesearching:matrix.org", "!wehateittoo:nerdsin.space"]);
//searxng.setBlacklistedImgRooms(["!wehateimagesearching:matrix.org", "!wehateittoo:nerdsin.space"]);
// Set which rooms are not allowed to search for images with safesearch disabled.
//searx.setBlacklistedUimgRooms(["!sfw:matrix.org", "!church:nerdsin.space"]);
//searxng.setBlacklistedUimgRooms(["!sfw:matrix.org", "!church:nerdsin.space"]);
// Set the amount of time in milliseconds users in a room are required to wait between searches (and allow some users to be immune to the cooldown and send as many as they want)
/*
searx.setCooldownImmuneUsers(["@q:glowers.club", "@romanticusgondolaticus:glowers.club"]);
searx.setRoomCooldowns(new Map([
searxng.setCooldownImmuneUsers(["@q:glowers.club", "@romanticusgondolaticus:glowers.club"]);
searxng.setRoomCooldowns(new Map([
["!sCbWouzHiLEyfOAaSJ:midov.pl",30000]
]));
*/
// Lets you set which URL parameters are used in SearXNG queries. Useful for changing which search engines are included and excluded. See SearXNG's documentation for all of the parameters available.
//searx.setSearxParameters("disabled_engines=flickr__images");
//searxng.setSearxngParameters("disabled_engines=flickr__images");
// Lets you add a whitelist for a room. When added, only the users in that whitelist will be able to search. Other users will receive an error.
/*
@@ -74,8 +74,8 @@ matrixClient.on("Room.timeline", function(event, room, toStartOfTimeline) {
if (event.getTs() >= startupTime && event.getType() == "m.room.message" && event.getContent().body != null) {
if (event.getContent().body.indexOf("!help") == 0) {
const helpMessage = "Commands:\n"+searx.getHelp();
const formattedHelpMessage = "Commands:<br />"+searx.getFormattedHelp();
const helpMessage = "Commands:\n"+searxng.getHelp();
const formattedHelpMessage = "Commands:<br />"+searxng.getFormattedHelp();
const content = {
"format": "org.matrix.custom.html",
@@ -91,9 +91,9 @@ matrixClient.on("Room.timeline", function(event, room, toStartOfTimeline) {
return;
}
searx.handleMessage(event, room);
searxng.handleMessage(event, room);
}
});
searx.startUploadMatrixClient();
searxng.startUploadMatrixClient();
matrixClient.startClient();