mirror of
https://github.com/informaticker/discord-jellyfin-bot.git
synced 2024-11-23 18:21:55 +01:00
fix lint
This commit is contained in:
parent
db6638724c
commit
a719ccecd9
@ -44,7 +44,7 @@ function getRandomDiscordColor () {
|
||||
return ("#" + ("00" + (randomNumber(rS, rE)).toString(16)).substr(-2) + ("00" + (randomNumber(gS, gE)).toString(16)).substr(-2) + ("00" + (randomNumber(bS, bE)).toString(16)).substr(-2));
|
||||
}
|
||||
|
||||
function getDiscordEmbedError(e){
|
||||
function getDiscordEmbedError (e) {
|
||||
return new Discord.MessageEmbed()
|
||||
.setColor(0xff0000)
|
||||
.setTitle("Error!")
|
||||
@ -52,7 +52,6 @@ function getDiscordEmbedError(e){
|
||||
.setDescription("<:x:757935515445231651> " + e);
|
||||
}
|
||||
|
||||
|
||||
// Song Search, return the song itemID
|
||||
async function searchForItemID (searchString) {
|
||||
const response = await jellyfinClientManager.getJellyfinClient().getSearchHints({
|
||||
@ -114,7 +113,7 @@ async function playThis (message) {
|
||||
} catch (e) {
|
||||
const noSong = getDiscordEmbedError(e);
|
||||
message.channel.send(noSong);
|
||||
playbackmanager.stop(isSummendByPlay?discordClient.user.client.voice.connections.first():undefined);
|
||||
playbackmanager.stop(isSummendByPlay ? discordClient.user.client.voice.connections.first() : undefined);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -182,7 +181,7 @@ function handleChannelMessage (message) {
|
||||
const indexOfArgument = message.content.indexOf(CONFIG["discord-prefix"] + "seek") + (CONFIG["discord-prefix"] + "seek").length + 1;
|
||||
const argument = message.content.slice(indexOfArgument);
|
||||
try {
|
||||
playbackmanager.seek(hmsToSeconds(argument)*10000000);
|
||||
playbackmanager.seek(hmsToSeconds(argument) * 10000000);
|
||||
} catch (error) {
|
||||
const errorMessage = getDiscordEmbedError(error);
|
||||
message.channel.send(errorMessage);
|
||||
|
@ -52,7 +52,7 @@ function seek (toSeek = 0) {
|
||||
if (getAudioDispatcher()) {
|
||||
startPlaying(undefined, undefined, ticksToSeconds(toSeek), _disconnectOnFinish);
|
||||
jellyfinClientManager.getJellyfinClient().reportPlaybackProgress(getProgressPayload());
|
||||
}else{
|
||||
} else {
|
||||
throw Error("No Song Playing");
|
||||
}
|
||||
}
|
||||
|
16
src/util.js
16
src/util.js
@ -7,16 +7,16 @@ function ticksToSeconds (ticks) {
|
||||
return ticks / 10000000;
|
||||
}
|
||||
|
||||
function hmsToSeconds(str) {
|
||||
var p = str.split(':'),
|
||||
s = 0, m = 1;
|
||||
function hmsToSeconds (str) {
|
||||
var p = str.split(":");
|
||||
var s = 0; var m = 1;
|
||||
|
||||
while (p.length > 0) {
|
||||
s += m * parseInt(p.pop(), 10);
|
||||
m *= 60;
|
||||
}
|
||||
while (p.length > 0) {
|
||||
s += m * parseInt(p.pop(), 10);
|
||||
m *= 60;
|
||||
}
|
||||
|
||||
return s;
|
||||
return s;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
Loading…
Reference in New Issue
Block a user