• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

EN Error in script: TypeError: Cannot access member 'title' of undefined

Status
Not open for further replies.

Alw3ys

Member
just basically trying to log the title, artist and track duration but getting the following log in console
 
Last edited:

irgendwr

no longer active, "retired" staff member
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
just basically trying to log the title, artist and track duration but getting the following log in console:
Error in script: TypeError: Cannot access member 'title' of undefined
And here is the code:
Code:
registerPlugin({
    name: 'Testing',
    version: '1.0',
    description: 'Testing',
    author: 'Alw3ys <[email protected]>',
    vars: {},
    autorun: true
}, function(sinusbot, config) {
    var event = require('event');
    event.on('track', function(trackEvent) {
        var engine = require('engine');
        var track = trackEvent.track;
        engine.log(track.title() + '\n' + track.artist() + '\n' + String.valueOf(track.duration()));
    });
});
I'm pretty sure artist and trackduration will use return me the following error but is unreachable at the moment.

I just wanna know what do I should istead of trackEvent.track.title() to get the track title.
flyth already responded in the chat:
trackEvent is already the track.

Edit: so try just using: trackEvent.title() instead of trackEvent.track.title()
 
Status
Not open for further replies.
Top