Default commands

#1

The default commands should be removable like the custom commands. Also should they be listed and editable like them. I need to edit some of them and its just laborious to edit them over the localization files.

Hopefully this will change in a future update. That’s the only thing to complain about imo.

Sincerely

CornFlakes

#2

We once had the commands removable. That caused many challenges for folks. You can turn them off as needed.

Custom commands work nothing like built-in commands, a JavaScript editor is needed for handling several thousand lines of code for some commands. Some things are also built into Java and you would need to recompile the bot.

1 Like
#3

Okay, but they should listet like the custom commands and that would make them easier to disable or to edit the response.

#4

You go to the Localization Tab to edit the responses in the lang files.

There is not just a “response” in a script. Here is an example command:

       /**
         * @commandpath rank - Display current rank.
         * @commandpath rank set [rankname] - Set rank for self if enough hours and points, if applicable, available in chat.
         * @commandpath rank del - Deletes customized rank.
         */
        if (command.equalsIgnoreCase('rank')) {
            if (args[0]) {
                if (args[0].equalsIgnoreCase('del')) {
                    if (inidb.exists('viewerRanks', sender.toLowerCase())) {
                        $.say($.whisperPrefix(sender) + $.lang.get('ranks.delself.success'));
                        $.inidb.del('viewerRanks', sender.toLowerCase());
                    } else {
                        $.say($.whisperPrefix(sender) + $.lang.get('ranks.delself.404'));
                    }
                    return;
                }

                if (args[0].equalsIgnoreCase('set')) {
                    if (!args[1]) {
                        if ($.bot.isModuleEnabled('./systems/pointSystem.js')) {
                            $.say($.whisperPrefix(sender) + $.lang.get('ranks.set.usage', rankEligableTime, rankEligableCost, $.pointNameMultiple));
                        } else {
                            $.say($.whisperPrefix(sender) + $.lang.get('ranks.set.usage.nopoints', rankEligableTime));
                        }
                        return;
                    }

                    customRank = args.splice(1).join(' ');

                    if (userTime >= rankEligableTime &&
                        ($.bot.isModuleEnabled('./systems/pointSystem.js') && $.getUserPoints(sender) > rankEligableCost) || !$.bot.isModuleEnabled('./systems/pointSystem.js')) {
                        $.say($.whisperPrefix(sender) + $.lang.get('ranks.set.success', customRank));
                        $.inidb.set('viewerRanks', sender.toLowerCase(), customRank);
                        if ($.bot.isModuleEnabled('./systems/pointSystem.js')) {
                            $.inidb.decr('points', sender.toLowerCase(), rankEligableCost);
                        }
                        return;
                    }

                    if ($.bot.isModuleEnabled('./systems/pointSystem.js')) {
                        $.say($.whisperPrefix(sender) + $.lang.get('ranks.set.failure', rankEligableTime, $.pointNameMultiple, rankEligableCost));
                    } else {
                        $.say($.whisperPrefix(sender) + $.lang.get('ranks.set.failure.nopoints', rankEligableTime));
                    }
                    return;
                }
            }

            if ($.inidb.exists('viewerRanks', username.toLowerCase())) {
                $.say($.lang.get('ranks.rank.customsuccess', username, $.inidb.get('viewerRanks', username.toLowerCase())));
                return;
            }

            if (ranksTimeTable === undefined) {
                loadRanksTimeTable();
            }

            if (ranksTimeTable.length == 0) {
                $.say($.whisperPrefix(sender) + $.lang.get('ranks.rank.404'));
                return;
            }

            userLevel = -1;
            for (var i = 0; i < ranksTimeTable.length; i++) {
                if (parseInt(userTime) >= parseInt(ranksTimeTable[i])) {
                    userLevel = i;
                } else {
                    i = ranksTimeTable.length;
                }
            }

            if (userLevel <= ranksTimeTable.length - 2) {
                nextLevel = parseInt(userLevel) + 1;
                timeUntilNextRank = parseInt(ranksTimeTable[nextLevel]) - userTime;
                if (userLevel == -1) {
                    $.say($.lang.get('ranks.rank.norank.success', username, timeUntilNextRank, $.inidb.get('ranksMapping', ranksTimeTable[nextLevel].toString())));
                } else {
                    $.say($.lang.get('ranks.rank.success', username, $.inidb.get('ranksMapping', ranksTimeTable[userLevel].toString()), timeUntilNextRank, $.inidb.get('ranksMapping', ranksTimeTable[nextLevel].toString())));
                }
            } else {
                $.say($.lang.get('ranks.rank.maxsuccess', username, $.inidb.get('ranksMapping', ranksTimeTable[userLevel].toString())));
            }
            return;
        }

PhantomBot commands are not just one-liners like the custom commands. They are complex JavaScript programs.

1 Like
#5

You can modify responses in the Panel:

1 Like
#6

Yeah I know :slight_smile: Thanks for your time. To be honest you guys did a great job with it. It’s just amazing

#7

One last thing, you can disable the modules to disable the commands. The trouble is, a lot of commands are related to other commands, so turning off one might send others into a tailspin, so modules are the primary driver. The trick for us is balancing ease of use with usability. It is a hard balancing act at times.

In the Panel:

1 Like
#8

One thing that comes into my mind right now is, is it possible to have mutliple users for the panel? Or is this a planed feature? With different access levels. This would be awesome.

Maybe the false thread to ask for this

#9

It is not planned. PhantomBot started as a local hosted only bot, and a majority of users still use PhantomBot that way. The complexity to make the current Panel multi-user would not be sustainable or meet the needs of a chunk of the user population. Also, PhantomBot includes a very lightweight web server, it isn’t meant to handle a lot of traffic.

At one point I started to design out a multi-user Panel that would use an entirely different architecture and would be a standalone program but it fell away. It would have also required MySQL instead of the built-in SQLite3 database to reduce the load on the bot and to make data more easily accessible through the architecture that I was going to use (Spring Boot).

As we are open source, we welcome people to contribute, perhaps someone will put together a multi-user Panel.

1 Like
#10

Could it be possible, just to add an extra user option? (With same privileges of course).

Something like, manual adding two lines in the botlogin.txt file:

paneluser2=xxx
and panelpassword2=xxx

I would find this useful.

/Michael

#11

This post is not relevant to the request this thread is about. If you search the forums multi user access for the panel has been discussed many times.

#12

Yes, I’m aware of that. My suggestion just seemed more simple than what I could read in the forum.

/Michael.

#13

As I said above, the Panel is designed for one user, as is the underlying lightweight web server built into PhantomBot. As is the socket server. This is why at one point I started considering a multi-user panel using a different stand-alone architecture.

Now, you could modify PhantomBot to support it of course, it is open source. The core would need to be modified to support multiple user authentication.