mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-09 23:40:18 +00:00
Making search better
This commit is contained in:
parent
035173b6cc
commit
9f20f3f405
@ -34,6 +34,7 @@ module.exports = {
|
|||||||
station = client.stations[number];
|
station = client.stations[number];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if(args[1].length < 4) return msg.channel.send('<:redx:674263474704220182> station must be over 3 characters!');
|
||||||
const sstation = await client.funcs.searchStation(args.slice(1).join(' '), client);
|
const sstation = await client.funcs.searchStation(args.slice(1).join(' '), client);
|
||||||
if (!sstation) return msg.channel.send('No stations found!');
|
if (!sstation) return msg.channel.send('No stations found!');
|
||||||
url = sstation.stream[sstation.stream.default];
|
url = sstation.stream[sstation.stream.default];
|
||||||
|
@ -17,7 +17,7 @@ module.exports = {
|
|||||||
invite: "https://discordapp.com/api/oauth2/authorize?client_id=684109535312609409&permissions=3427328&scope=bot",
|
invite: "https://discordapp.com/api/oauth2/authorize?client_id=684109535312609409&permissions=3427328&scope=bot",
|
||||||
|
|
||||||
//Settings
|
//Settings
|
||||||
prefix: "rx>",
|
prefix: "rx-",
|
||||||
volume: 5
|
volume: 5
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ module.exports = function (key, client) {
|
|||||||
if (client.stations === null) return false;
|
if (client.stations === null) return false;
|
||||||
let foundStations = [];
|
let foundStations = [];
|
||||||
if (!key) return false;
|
if (!key) return false;
|
||||||
|
if (key == 'radio') return false;
|
||||||
|
if (key.startsWith("radio ")) key = key.slice(6);
|
||||||
const probabilityIncrement = 100 / key.split(' ').length / 2;
|
const probabilityIncrement = 100 / key.split(' ').length / 2;
|
||||||
for (let i = 0; i < key.split(' ').length; i++) {
|
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 }));
|
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 }));
|
||||||
|
Loading…
Reference in New Issue
Block a user