alaingilbert / Turntable-API

Allows you to create bots for turntable.fm
http://alaingilbert.github.com/Turntable-API/
MIT License
317 stars 98 forks source link

Issue with song counts when room enforcement is active #158

Closed soupnrc closed 11 years ago

soupnrc commented 11 years ago

Hello, I have a (minor) issue with a command that tells how many songs each DJ has left to play. It is supposed to change the output dependent on whether or not the room is being enforced. When the song limit is turned on, it is supposed to say how many songs are left,

Example: "username" (0 song(s) left)

And when the limit is turned off, it is just supposed to say how many plays each DJ is sitting at.

Example: "username" (played 0)

I have attached the code for the command, and am curious if anyone can help. Thank you :)

exports.name = 'djinfo';
exports.hidden = false;
exports.enabled = true;
exports.matchStart = false;
exports.matchRegex = false;
exports.aliases = Array('counts');
exports.categories = Array('moderators');
exports.help = 'Information about how many songs each DJ has left to play for room enforcement rules.';
exports.handler = function(data) {
        if (config.enforcement.enforceroom) {
                var response = '';
                for (i in djs) {
                        response += usersList[djs[i].id].name + ' (' + djs[i].remaining + ' song(s) left), ';
                }
                output({text: response.substring(0, response.length - 2), destination: data.source, userid: data.userid});
        } else {
                var response = '';
                for (i in djs) {
                        response += usersList[djs[i].id].name + ' (played ' + djs[i].remaining + '), ';
                }
                output({text: response.substring(0, response.length - 2), destination: data.source, userid: data.userid});
        }

        return true;
}
alaingilbert commented 11 years ago

This issue is not related to ttapi. It is related to the bot/script you are using...

soupnrc commented 11 years ago

@alaingilbert My mistake, thank you :)