• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

EN [Solved] Auto Poke if Servergroup isn't given

Vxrious

Helping Hand
Hello!

I search for a Script that Pokes a group of client after x minutes that haven't got the group
Exp.: User X hasn't got the verify group, the bot pokes the client after x minutes with something like
"Hey User X! You aren't verified yet! Please join channel x to get verified!" and that all x minutes :D

(Basicly its just like the script "Verify" from Tunakill but that script is little bugy :/)

// Script Released by @DrWarpMan
// https://forum.sinusbot.com/resources/group-checker.390/

Thanks for reading :)
 
Last edited:

DrWarpMan

Well-Known Member
Contributor
Insider
I'll try to do that, tomorrow
Today, I am a bit tired of scripting.. :D
 
Last edited:

DrWarpMan

Well-Known Member
Contributor
Insider
F*** it, I made it today.. :D Here you are:

JavaScript:
registerPlugin({
    name: 'Poke clients, without specified group',
    version: '0.1',
    backends: ['ts3'],
    description: 'Script pokes clients (with specified message), that doesn\'t have the specified group, every X seconds',
    author: 'DrWarpMan',
    vars: [
        {
            name: 'pokeWithoutGroup_status',
            title: 'Enabled?',
            type: 'select',
            options: [
                "Yes",
                "No"
            ]
        },
        {
            name: 'pokeWithoutGroup_time',
            title: 'Time (in seconds), how often will the bot poke / message the user (every X seconds)',
            type: 'number',
            conditions: [
                { field: 'pokeWithoutGroup_status', value: 0 }
            ],
            placeholder: 120
        },
        {
            name: 'pokeWithoutGroup_message',
            title: 'Poke message',
            type: 'string',
            conditions: [
                { field: 'pokeWithoutGroup_status', value: 0 }
            ]
        },
        {
            name: 'pokeWithoutGroup_group',
            title: 'Group ID, that if user is not in, he will get poked',
            type: 'number',
            conditions: [
                { field: 'pokeWithoutGroup_status', value: 0 }
            ]
        }
    ]
}, function (sinusbot, config) {

    var engine = require('engine');
    var backend = require('backend');
    
    if(config.pokeWithoutGroup_status == 1) {
        engine.log("Not in Group Poker is disabled. Script won\'t start!");
        return;
    }

    if(config.pokeWithoutGroup_group == undefined) {
        engine.log("Group is not defined! Script won\'t start!");
        return;
    }

    var pokerTime;
    var pokeMessage;
    var withoutGroup = config.pokeWithoutGroup_group.toString();

    if(config.pokeWithoutGroup_time == undefined) {
        engine.log("[Not in Group Poker] Time is undefined, changing to default - 120.");
        pokerTime = 120;
    } else if(config.pokeWithoutGroup_time < 1)
    {
        engine.log("[Not in Group Poker] Time is lower than number one, changing to default - 120.");
        pokerTime = 120;
    } else if(config.pokeWithoutGroup_time > 0)
    {
        pokerTime = config.pokeWithoutGroup_time * 1000;
    }

    if(config.pokeWithoutGroup_message)
        pokeMessage = config.pokeWithoutGroup_message;
    else pokeMessage = "";


    setInterval(function(){

        if(backend.isConnected()) {
        
            backend.getClients().forEach(
            
                function(client)
                {
                    if(!hasServerGroupWithId(client, withoutGroup))
                        client.poke(pokeMessage);
                }
    
            )
        
        };
    }, pokerTime);

    function hasServerGroupWithId(client, id){
        return client.getServerGroups().some(function (group) {
            return group.id() == id
        })
    }
    
});

I tested it, but, it can still not work :D But it should.
 

Attachments

  • pokeWithoutGroup.js
    3 KB · Views: 13

Vxrious

Helping Hand
F*** it, I made it today.. :D Here you are:

JavaScript:
registerPlugin({
    name: 'Poke clients, without specified group',
    version: '0.1',
    backends: ['ts3'],
    description: 'Script pokes clients (with specified message), that doesn\'t have the specified group, every X seconds',
    author: 'DrWarpMan',
    vars: [
        {
            name: 'pokeWithoutGroup_status',
            title: 'Enabled?',
            type: 'select',
            options: [
                "Yes",
                "No"
            ]
        },
        {
            name: 'pokeWithoutGroup_time',
            title: 'Time (in seconds), how often will the bot poke / message the user (every X seconds)',
            type: 'number',
            conditions: [
                { field: 'pokeWithoutGroup_status', value: 0 }
            ],
            placeholder: 120
        },
        {
            name: 'pokeWithoutGroup_message',
            title: 'Poke message',
            type: 'string',
            conditions: [
                { field: 'pokeWithoutGroup_status', value: 0 }
            ]
        },
        {
            name: 'pokeWithoutGroup_group',
            title: 'Group ID, that if user is not in, he will get poked',
            type: 'number',
            conditions: [
                { field: 'pokeWithoutGroup_status', value: 0 }
            ]
        }
    ]
}, function (sinusbot, config) {

    var engine = require('engine');
    var backend = require('backend');
   
    if(config.pokeWithoutGroup_status == 1) {
        engine.log("Not in Group Poker is disabled. Script won\'t start!");
        return;
    }

    if(config.pokeWithoutGroup_group == undefined) {
        engine.log("Group is not defined! Script won\'t start!");
        return;
    }

    var pokerTime;
    var pokeMessage;
    var withoutGroup = config.pokeWithoutGroup_group.toString();

    if(config.pokeWithoutGroup_time == undefined) {
        engine.log("[Not in Group Poker] Time is undefined, changing to default - 120.");
        pokerTime = 120;
    } else if(config.pokeWithoutGroup_time < 1)
    {
        engine.log("[Not in Group Poker] Time is lower than number one, changing to default - 120.");
        pokerTime = 120;
    } else if(config.pokeWithoutGroup_time > 0)
    {
        pokerTime = config.pokeWithoutGroup_time * 1000;
    }

    if(config.pokeWithoutGroup_message)
        pokeMessage = config.pokeWithoutGroup_message;
    else pokeMessage = "";


    setInterval(function(){

        if(backend.isConnected()) {
       
            backend.getClients().forEach(
           
                function(client)
                {
                    if(!hasServerGroupWithId(client, withoutGroup))
                        client.poke(pokeMessage);
                }
   
            )
       
        };
    }, pokerTime);

    function hasServerGroupWithId(client, id){
        return client.getServerGroups().some(function (group) {
            return group.id() == id
        })
    }
   
});

I tested it, but, it can still not work :D But it should.
Wow... You're awesome :D
Fu**cking big thanks to you Bro :D
Maybe if you have too much time, can you maybe add a option to switch poke to message? Would be aaaawesome :)
Thank you very much for you're work! Its Great :)
Very appricate!
 

DrWarpMan

Well-Known Member
Contributor
Insider
Here:
JavaScript:
registerPlugin({
    name: 'Poke clients, without specified group',
    version: '0.1',
    backends: ['ts3'],
    description: 'Script pokes clients (with specified message), that doesn\'t have the specified group, every X seconds',
    author: 'DrWarpMan',
    vars: [
        {
            name: 'pokeWithoutGroup_status',
            title: 'Enabled?',
            type: 'select',
            options: [
                "Yes",
                "No"
            ]
        },
        {   name: 'pokeWithoutGroup_type',
            title: 'Message Type',
            type: 'select',
            options: [
                "Poke",
                "Chat",
                "Both (Chat & Poke)"
            ],
            conditions: [
                { field: 'pokeWithoutGroup_status', value: 0 }
            ]
        },
        {
            name: 'pokeWithoutGroup_time',
            title: 'Time (in seconds), how often will the bot poke / message the user (every X seconds)',
            type: 'number',
            conditions: [
                { field: 'pokeWithoutGroup_status', value: 0 }
            ],
            placeholder: 120
        },
        {
            name: 'pokeWithoutGroup_message',
            title: 'Poke message',
            type: 'string',
            conditions: [
                { field: 'pokeWithoutGroup_status', value: 0 }
            ]
        },
        {
            name: 'pokeWithoutGroup_group',
            title: 'Group ID, that if user is not in, he will get poked',
            type: 'number',
            conditions: [
                { field: 'pokeWithoutGroup_status', value: 0 }
            ]
        }
    ]
}, function (sinusbot, config) {

    var engine = require('engine');
    var backend = require('backend');
    
    if(config.pokeWithoutGroup_status == 1) {
        engine.log("Not in Group Poker is disabled. Script won\'t start!");
        return;
    }

    if(config.pokeWithoutGroup_type == undefined)
        config.pokeWithoutGroup_type = 0;

    if(config.pokeWithoutGroup_group == undefined) {
        engine.log("Group is not defined! Script won\'t start!");
        return;
    }

    var pokerTime;
    var pokeMessage;
    var withoutGroup = config.pokeWithoutGroup_group.toString();

    if(config.pokeWithoutGroup_time == undefined) {
        engine.log("[Not in Group Poker] Time is undefined, changing to default - 120.");
        pokerTime = 120;
    } else if(config.pokeWithoutGroup_time < 1)
    {
        engine.log("[Not in Group Poker] Time is lower than number one, changing to default - 120.");
        pokerTime = 120;
    } else if(config.pokeWithoutGroup_time > 0)
    {
        pokerTime = config.pokeWithoutGroup_time * 1000;
    }

    if(config.pokeWithoutGroup_message)
        pokeMessage = config.pokeWithoutGroup_message;
    else pokeMessage = "";


    setInterval(function(){

        if(backend.isConnected()) {
        
            backend.getClients().forEach(
            
                function(client)
                {
                    if(!client.isSelf())
                    {
                        if(!hasServerGroupWithId(client, withoutGroup))
                        {
                            if(config.pokeWithoutGroup_type == 0)
                            {
                                client.poke(pokeMessage);
                            } else if(config.pokeWithoutGroup_type == 1)
                            {
                                client.chat(pokeMessage);
                            } else if(config.pokeWithoutGroup_type == 2)
                            {
                                client.chat(pokeMessage);
                                client.poke(pokeMessage);
                            }
                        }
                    }   
                }
    
            )
        
        };
    }, pokerTime);

    function hasServerGroupWithId(client, id){
        return client.getServerGroups().some(function (group) {
            return group.id() == id
        })
    }
    
});
 

Attachments

  • pokeWithoutGroup.js
    4.1 KB · Views: 10

Vxrious

Helping Hand
Dude you're insane... :D
Wow don't you post this in the Script Forum?
I think some people need this!
If you want i can post it and give you full credits?

Thank you! :)
 
Top