mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-27 09:35:35 -05:00
music play autocomplete (quite broken)
This commit is contained in:
parent
912ef5e05f
commit
c33b1d8479
1 changed files with 9 additions and 1 deletions
|
@ -20,8 +20,16 @@ let song
|
|||
|
||||
async function play (bot, values, discord, channeldc, selector, config) {
|
||||
try {
|
||||
const songs = await fileList(SONGS_PATH)
|
||||
const filepath = values.join(' ')
|
||||
const absolutePath = await resolve(filepath)
|
||||
|
||||
const file = songs.filter((song) => song.toLowerCase().includes(filepath))[0]
|
||||
|
||||
let absolutePath
|
||||
if (!path.isAbsolute(filepath) &&
|
||||
filepath !== '') absolutePath = await resolve(file)
|
||||
else absolutePath = await resolve(filepath)
|
||||
|
||||
song = bot.music.load(await fs.readFile(absolutePath), path.basename(absolutePath))
|
||||
bot.music.queue.push(song)
|
||||
bot.music.play(song)
|
||||
|
|
Loading…
Reference in a new issue