You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I can add files from Google Drive as Track, I think there will be no problems with other functions. However, an attempt to forcefully substitute a data type suitable for Track failed miserably.
How do I convert the shape to 'Track' that can be added to a file playlist via addTrack?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Using this api, I want to work on playing files in Google Drive in a Discord bot. However, the following code does not work with the following error:
//code
const {google} = require('googleapis');
const {QueryType} = require('discord-player');
const {Track} = require('discord-player')
async function playFiles(obj, player) {
console.log(obj.files[0].id);
const {data} = await obj.drive.files.get(
{
fileId: obj.files[0].id,
alt: "media"
},
{ responseType: "stream" },
);
const file = fs.createWriteStream(obj.files[0].name)
Track.title = data.title
Track.description = "a"
Track.author = "b"
Track.url = data.webContentLink
Track.thumbnail = data.picture
Track.duration = data.fileSize
Track.views = data.version
Track.requestedBy = "kim"
Track.Playlist = false
Track.raw = file
obj.queue.addTrack(Track)
}
//error
If I can add files from Google Drive as Track, I think there will be no problems with other functions. However, an attempt to forcefully substitute a data type suitable for Track failed miserably.
How do I convert the shape to 'Track' that can be added to a file playlist via addTrack?
Beta Was this translation helpful? Give feedback.
All reactions