Costum Adventure Cooldown message


I have found this guide ( Adventure Cooldown display ) and followed it carefully. Unfortunately, it does not work for me. I want my own cooldown message for my adventure. I have changed the command already in! Noob and this works too. But if I follow the above instructions, I do not get a cooldown message and the cooldown does not work at Adventures at all. So it’s a cooldown of 900 sec set, but you can do it again before.

Cooldown messages are enabled and work on other commands.

Changes I make:


function isSpecial(command) {
        return command == 'bet' || command == 'tickets' || command == 'bid' || command == 'noob' || command == $.raffleCommand;

     * @function get 
     * @export $.coolDown
     * @param  {String}  command
     * @param  {String}  username
     * @param  {Boolean} isMod
     * @return {Number}
    function get(command, username, isMod) {
        var cooldown = cooldowns[command];

        if (isSpecial(command)) {
            if (command == 'noob' && defaultCooldowns[command] !== undefined && defaultCooldowns[command] > $.systemTime()) {
                $.say($.whisperPrefix(username) + $.lang.get('adventuresystem.adventure.cooldown', parseInt(parseInt(defaultCooldowns[command] - $.systemTime())/1000)));
				return defaultCooldowns[command];
            } else {
                return 0;


$.lang.register(‘adventuresystem.adventure.cooldown’, ‘The adventure is still cooling down! $1 seconds to go.’);


    if (command.equalsIgnoreCase('noob')) {
        if (!action) {
            $.say($.whisperPrefix(sender) + $.lang.get('adventuresystem.adventure.usage', $.pointNameMultiple));


$.bind('initReady', function() {
    $.registerChatCommand('./games/adventureSystem.js', 'noob', 7);
    $.registerChatSubcommand('noob', 'set', 1);
    $.registerChatSubcommand('noob', 'top5', 3);

Is that all right and did I forget something? The bot was always turned off in between and then restarted. Without success. Is it even possible?

My 2nd problem: The again available message for Adventure is not displayed with me. Do I have to activate this somewhere?

PhantomBot Version: 2.4.0 (Revision: 1cce451e)
Control Panel Version 1.1
Java Version: 1.8.0_161-b12
OS Version: Linux



Did you check for errors when the bot boots up? If I copy/paste out the code directly, the single quotes are not translated properly and files do not load (such as language). Did you double check that the single quotes did not become transformed by pasting? Did you manually type in the items?

Why did you rename the command?

Anyway, I made the two changes as outlined:

adventure set cooldown 60
[05-06-2018 @ 10:15:56.097 MDT] [MUTED] @IllusionaryBot, Set cooldown to 60.
adventure 10
[05-06-2018 @ 10:15:59.470 MDT] [MUTED] My new Rank IllusionaryBot is trying get a team together for some serious adventure business! Use "!adventure [points]" to join in!
[05-06-2018 @ 10:16:06.863 MDT] >> Enabling follower announcements
[05-06-2018 @ 10:16:06.960 MDT] >> Enabling StreamLabs donation announcements
[05-06-2018 @ 10:16:07.423 MDT] [MUTED] [Twitter Feed From @IllusionaryOne] []
[05-06-2018 @ 10:16:09.470 MDT] [MUTED] Starting adventure "Time Heist" with 1 player(s).
[05-06-2018 @ 10:16:16.473 MDT] [MUTED] Your memory is vague, on the table a small laptop is playing a video: "My name is The Architect. The bank of Karabraxos is the most secure bank in the universe. You will rob the bank of Karabraxos!"
adventure[05-06-2018 @ 10:16:30.473 MDT] [MUTED] We find ourselves back in the room we started in as consciousness of IllusionaryBot slowly fades again, only to wake up in our beds like nothing at all has happened.

[05-06-2018 @ 10:16:43.059 MDT] [MUTED] @IllusionaryBot, The adventure is still cooling down! 54 seconds to go.

Two changes:

            if (command == 'adventure' && defaultCooldowns[command] !== undefined && defaultCooldowns[command] > $.systemTime()) {
                $.say($.whisperPrefix(username) + $.lang.get('adventuresystem.adventure.cooldown', parseInt(parseInt(defaultCooldowns[command] - $.systemTime())/1000)));  // new line
                return defaultCooldowns[command];
$.lang.register('adventuresystem.adventure.cooldown', 'The adventure is still cooling down! $1 seconds to go.');  // new line
$.lang.register('adventuresystem.adventure.usage', 'Usage: !adventure [$1].');


I changed the command because I thought it would be the only way to do it. Could that be the mistake?

No I didn’t check for errors…
The Quotes should be ok. I copy/paste the Code but changed the Quotes after that, so it match with the Rest of the Code…

I am now in the work and can test it with the new line until tomorrow, but in theory this should also fit … Would it be possible to simply send me the files you changed and I invite them to the folder?



I am not sure if the renaming of the command is the mistake or not. See below for the files! Cheers!

adventureSystem.js (17.8 KB)
games-adventureSystem.js (5.9 KB)


Thank you.

I try it tomorrow.

If it doesn’t work, i reset the adventure script and try it again, without my custom Command name.

Can i also have the commandcooldown.js ?


Oh right, I didn’t change adventureSystem.js.

commandCoolDown.js (11.0 KB)


ok thank you so much!!!

But now the next problem has surfaced. I now get 2 Cooldown messages. How can I change this so that only the specific message (First of the 2) for the adventure is displayed?

7:21ModeratorSeatRichiBot: @thewatcher1g The adventure is still cooling down! 883 seconds to go.
7:21ModeratorSeatRichiBot: @thewatcher1g command !adventure is still on cooldown. (883 seconds)


Sounds like you have 2 modules activated - try to remove the old file or deactivate the old module in the settings. Or do both Strings contained in that custom module? Try to search for “is still on cooldown” and “is still cooling down” - should be 2 files in your explorer - if not - my suggestion is wrong :smiley:


Yes, one module should be for all other cooldown messages and the other only for adventure. So both should be active but at adventure only the specific message will be displayed. Is that possible?


What he means is, do you have two cooldown scripts perhaps and the bot loads both. When I run this, it seems to only produce one message in my bot.

adventure 100
[05-07-2018 @ 13:00:10.979 MDT] [MUTED] My new Rank IllusionaryBot is trying get a team together for some serious adventure business! Use "!adventure [points]" to join in!
[05-07-2018 @ 13:00:20.978 MDT] [MUTED] Starting adventure "Beartraps" with 1 player(s).
[05-07-2018 @ 13:00:27.982 MDT] [MUTED] Friends! I've got coordinates for a secret stash of bolts, hidden away within the bowels of the elven forest. We should shoe up and give this a go!
[05-07-2018 @ 13:00:41.982 MDT] [MUTED] Dayum, that was a close call for losing a leg. But you've deserved this IllusionaryBot!
[05-07-2018 @ 13:00:48.984 MDT] [MUTED] The adventure ended! Survivors are: IllusionaryBot (+30 points).
[05-07-2018 @ 13:00:54.714 MDT] [MUTED] @IllusionaryBot, The adventure is still cooling down! 54 seconds to go.
[05-07-2018 @ 13:00:57.454 MDT] [MUTED] @IllusionaryBot, The adventure is still cooling down! 51 seconds to go.
[05-07-2018 @ 13:00:58.913 MDT] [MUTED] @IllusionaryBot, The adventure is still cooling down! 50 seconds to go.

Otherwise, there may be some issue. Since this was provided by another person in the forums and is not official PhantomBot, I can only say “this is what they did.”


Okay … I’m just doing this because I want to change the command. But if I make an alias, the bot unfortunately writes from time to time (eg at the cooldown) !adventure instead of my alias …

But I have to deal with that or find a way myself :wink:

thanks to you anyway


From time to time reminded me, I did make an additional change my my bot that I didn’t think about and didn’t include, probably why I didn’t see it. I thought of it, but was thinking of the primary change.

scripts/init.js (line 473 with my version of PhantomBot)

            // Check the command cooldown.
            if ($.coolDown.get(command, sender, isMod) !== 0) {
                if (!command.equalsIgnoreCase('adventure')) {  // new
                    $.sayWithTimeout($.whisperPrefix(sender) + $.lang.get('init.cooldown.msg', command, $.coolDown.getSecs(sender, command)), $.getIniDbBoolean('settings', 'coolDownMsgEnabled', false));
                } // new
                consoleDebug('Command !' + command + ' was not sent due to it being on cooldown.');
            } else


Remember, the downside to these updates are, when you upgrade you either have to roll the dice and keep old versions of the files or remember to make changes to the next versioned files.


Thank you.

Now it works.

it would be great to fix this update immediately in the next version.


I think this was mentioned before but, this is not something that we will support by default (unless another developer believes we should). The bot is limited in how many replies it is allowed within 30 seconds and the logic for cooldowns is coded to be as efficient and fast as possible. Adding additional logic slows down each command as it is processed. Cooldown is meant to be generic and on a timeout for replies. You have the ability, with the source code, to make modifications as you see fit outside of the release.