How can I edit the !points function to prevent users from checking the Points of other users?

Hi everyone,

i need a little help, i want to change the !points command a little. I would like to prevent normal users from using the !points (username) command to get the info how may points someone else has. I would like to restrict that detail of the function to only mods or to disable that featurepart in general.

anyone knows how?

Hi,
if you want to change this behaviour, you have to edit the points script. Path to the script: “YourPhantomBotFolder/scripts/systems/pointSystem.js”

Then have a look into lines 416 to 423:

[...]
if (!action) {
    $.say(getPointsMessage(sender, username));
} else {
    // Replace everything that is not \w
    action = $.user.sanitize(action);
    if ($.user.isKnown(action)) {
        $.say($.whisperPrefix(sender) + $.lang.get('pointsystem.user.success', $.username.resolve(action), getPointsString(getUserPoints(action))));
    }
[...]

If you want to remove the feature, you can delete the else-block. If you want to restrict this feature to mods, you can add “&& $.isMod(sender)” to the second if-statement:

if ($.user.isKnown(action) && $.isMod(sender)) {

I did not test this, but it should work.

1 Like

Worked like a charm! Thank you!