mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2026-11-03 06:05:00 +00:00
Making search better
This commit is contained in:
1 parent
035173b6cc
commit
9f20f3f405
3 files changed
+5
-2
No files matched your search
@@ -2,6 +2,8 @@ module.exports = function (key, client) {
|
||||
if (client.stations === null) return false;
|
||||
let foundStations = [];
|
||||
if (!key) return false;
|
||||
if (key == 'radio') return false;
|
||||
if (key.startsWith("radio ")) key = key.slice(6);
|
||||
const probabilityIncrement = 100 / key.split(' ').length / 2;
|
||||
for (let i = 0; i < key.split(' ').length; i++) {
|
||||
client.stations.filter(x => x.name.toUpperCase().includes(key.split(' ')[i].toUpperCase()) || x === key).forEach(x => foundStations.push({ station: x, name: x.name, probability: probabilityIncrement }));
|
||||
|
||||
Reference in new issue
Block a user