Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
Dougley committed Aug 18, 2018
1 parent 81ed7f4 commit 3bcd740
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 28 deletions.
28 changes: 15 additions & 13 deletions src/commands/join-voice.js
Expand Up @@ -38,33 +38,35 @@ module.exports = {
})
}
} else {
resolveTracks(suffix).then(tracks => {
if (tracks.tracks.length === 0) {
resolveTracks(suffix).then(result => {
global.logger.trace(result)
if (result.tracks.length === 0) {
global.i18n.send('LINK_NO_TRACK', msg.channel, {user: msg.author.username, url: suffix})
} else if (tracks.tracks.length === 1) {
hhMMss(tracks.tracks[0].info.length / 1000).then(time => {
createPlayer(msg, tracks.tracks)
} else if (result.tracks.length === 1) {
hhMMss(result.tracks[0].info.length / 1000).then(time => {
createPlayer(msg, result.tracks)
global.i18n.send('TRACK_ADDED', msg.channel, {
title: tracks.tracks[0].info.title,
title: result.tracks[0].info.title,
duration: time,
user: msg.author.username
})
})
} else {
createPlayer(msg, tracks.tracks)
global.i18n.send('TRACKS_ADDED', msg.channel, {count: tracks.tracks.length, user: msg.author.username})
createPlayer(msg, result.tracks)
global.i18n.send('TRACKS_ADDED', msg.channel, {count: result.tracks.length, user: msg.author.username})
}
}).catch(global.logger.error)
}
} else {
resolveTracks(`ytsearch:${encodeURI(suffix)}`).then(tracks => {
if (tracks.tracks.length === 0) {
resolveTracks(`ytsearch:${encodeURI(suffix)}`).then(result => {
global.logger.trace(result)
if (result.tracks.length === 0) {
global.i18n.send('SEARCH_NO_TRACKS', msg.channel, {user: msg.author.mention})
} else {
hhMMss(tracks.tracks[0].info.length / 1000).then(time => {
createPlayer(msg, [tracks.tracks[0]])
hhMMss(result.tracks[0].info.length / 1000).then(time => {
createPlayer(msg, [result.tracks[0]])
global.i18n.send('TRACK_ADDED', msg.channel, {
title: tracks.tracks[0].info.title,
title: result.tracks[0].info.title,
duration: time,
user: msg.author.username
})
Expand Down
28 changes: 15 additions & 13 deletions src/commands/request.js
Expand Up @@ -35,33 +35,35 @@ module.exports = {
})
}
} else {
resolveTracks(suffix).then(tracks => {
if (tracks.tracks.length === 0) {
resolveTracks(suffix).then(result => {
global.logger.trace(result)
if (result.tracks.length === 0) {
global.i18n.send('LINK_NO_TRACK', msg.channel, {user: msg.author.username, url: suffix})
} else if (tracks.tracks.length === 1) {
hhMMss(tracks.tracks[0].info.length / 1000).then(time => {
addTracks(msg, tracks.tracks)
} else if (result.tracks.length === 1) {
hhMMss(result.tracks[0].info.length / 1000).then(time => {
addTracks(msg, result.tracks)
global.i18n.send('TRACK_ADDED', msg.channel, {
title: tracks.tracks[0].info.title,
title: result.tracks[0].info.title,
duration: time,
user: msg.author.username
})
})
} else {
addTracks(msg, tracks.tracks)
global.i18n.send('TRACKS_ADDED', msg.channel, {count: tracks.tracks.length, user: msg.author.username})
addTracks(msg, result.tracks)
global.i18n.send('TRACKS_ADDED', msg.channel, {count: result.tracks.length, user: msg.author.username})
}
}).catch(global.logger.error)
}
} else {
resolveTracks(`ytsearch:${encodeURI(suffix)}`).then(tracks => {
if (tracks.tracks.length === 0) {
resolveTracks(`ytsearch:${encodeURI(suffix)}`).then(result => {
global.logger.trace(result)
if (result.tracks.length === 0) {
global.i18n.send('SEARCH_NO_TRACKS', msg.channel, {user: msg.author.mention})
} else {
hhMMss(tracks.tracks[0].info.length / 1000).then(time => {
addTracks(msg, [tracks.tracks[0]])
hhMMss(result.tracks[0].info.length / 1000).then(time => {
addTracks(msg, [result.tracks[0]])
global.i18n.send('TRACK_ADDED', msg.channel, {
title: tracks.tracks[0].info.title,
title: result.tracks[0].info.title,
duration: time,
user: msg.author.username
})
Expand Down
2 changes: 1 addition & 1 deletion src/commands/urbandictionary.js
Expand Up @@ -35,7 +35,7 @@ module.exports = {
}
})
} else {
msg.channel.createMessage(`<@${msg.author.id}>, ${suffix}: This word is so screwed up, even UrbanDictionary doesn't have it in its database`)
msg.channel.createMessage(`<@${msg.author.id}>, ${suffix}: This word is so screwed up, even Urban Dictionary doesn't have it in its database`)
}
} else {
global.i18n.send('API_ERROR', msg.channel)
Expand Down
1 change: 0 additions & 1 deletion src/internal/logger.js
Expand Up @@ -64,7 +64,6 @@ module.exports = {
sendToES({
type: 'command',
cmd: opts.cmd,
// full: opts.cmd + ' ' + opts.opts,
args: opts.opts.split(' '),
author: opts.m.author,
channel: opts.m.channel,
Expand Down

0 comments on commit 3bcd740

Please sign in to comment.