samuri51 / chillybot

a turntable bot created by a moderator of straight_chillin11
12 stars 12 forks source link

Ignoring "Autodj" when stage empty #63

Closed blueyshark closed 6 months ago

blueyshark commented 6 months ago

When the stage is empty, chillybot does not autodj. I waited 30 minutes to see if there was a delay before starting, but nothing happens.

Outputs of botstatus and getonstage show that chillybot should start playing music.

chillybot.js is configured so that var whenToGetOnStage = 2; and var whenToGetOffStage = 4;

Yet when chillybot enters a room with an empty stage, unless a moderator commands chillybot autodj it does not.

It will get on stage after a while if another user is playing music. Just not if the stage is empty.

Thanks for any help.

samuri51 commented 6 months ago

it only hops on an empty stage when a song ends, not when it first comes to the room

blueyshark commented 6 months ago

I see - then the script's comments need updating, line 36 says: //this is for the bot's autodjing(triggers on new song, bot also gets on when no song is playing, unless autodjing is turned off) specifically "bot also gets on when no song is playing". So if I restart my server as I do every night, and systemd runs chillybot.js - there's no way to have the bot play music? In that case, the golang bot had the advantage.

samuri51 commented 6 months ago

not on startup, its mainly to play with a person then keep playing once everyone leaves. u can certainly modify the code to make it do that tho

samuri51 commented 6 months ago

add this function call to the roomchanged event

autoDjing()

samuri51 commented 6 months ago

actually nvm that wont work. its the same code as nosong

if (getonstage === true && vipList.length === 0 && queueList.length === 0 && refreshList.length === 0) { bot.addDj(); }

samuri51 commented 6 months ago

sry im coopy pasting code on my phone haha

blueyshark commented 6 months ago

So I added the following code under the bot.on('roomChanged', function (data) section and it seems to have worked. Thanks for the pointers @samuri51

        // Auto DJ if noone is on stage when entering room
        if (getonstage === true && vipList.length === 0 && queueList.length === 0 && refreshList.length === 0) 
        {
            bot.addDj();
        }
samuri51 commented 6 months ago

i wanna add an addendum to this looking at it again, a check that the number of djs on the stage is zero. I just realized that's an assumed condition in the nosong event. if u don't check for that it'll try to hop up no matter what just as long as people aren't in those other queues. U still have to check for those other queues because they placehold peoples spot on the stage

        if (getonstage === true && vipList.length === 0 && queueList.length === 0 && refreshList.length === 0 && data.room.metadata.djs.length === 0) 
        {
            bot.addDj();
        }
blueyshark commented 6 months ago

I was thinking about what happens regarding DJ spaces - nice addition. Thanks again!

blueyshark commented 5 months ago

@samuri51 sorry to post here on a closed issue, but I added a few of these to add a little variety for reactions - seems to work well. Do with it what you will!

    else if (text.match(/^\/(what|wut|huh|wot)$/)) {
        // Array of what GIF URLs
        var whatGifs = [
            'https://c.tenor.com/XHyzk7O2ndIAAAAM/what-meme.gif',
            'https://c.tenor.com/r8tcf2YZ5TIAAAAd/tenor.gif',
            'https://c.tenor.com/SyJNiTVc-ogAAAAC/tenor.gif',
            'https://c.tenor.com/Ab2qHb-U0I0AAAAC/wut-tvperu.gif',
            'https://c.tenor.com/vmSP8owuOYYAAAAd/tenor.gif',
            // Add more URLs here
        ];
        // Get a random index
        var randomIndex = Math.floor(Math.random() * whatGifs.length);
        // Select a random what GIF URL
        var randomWhatGif = whatGifs[randomIndex];
        // Bot speaks a random what GIF URL
        bot.speak(randomWhatGif);
    }