• 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 Provide a server group to a user with a command

Status
Not open for further replies.

DeathWolf

Member
Hello, I am trying to create a script so that when a user written a (predefined) command in the actually chat channel, the bot gives a group server (server group ID = 7 in my case) and he poke the user to say that it was changed group.

Problem: I'm trying to learn to script slowly but I am lost.
I know I have to use "servergroupaddclient" in the script and probably one of "clientfind, clientgetdbidfromuid, clientgetids, clientgetnamefromdbid, clientgetnamefromuid, clientgetuidfromclid" but I'm completely lost ...

if a charitable soul could create such a script as simple as possible, I will use it and above all to look at how it was created to better understand how it works.

To explain how it will help me, I have a TS with over 400 registered, I receive 10-20 new per day, they must read of the rules before passing "community members" I give their myself.
But be solicited 10-20 times a day is annoying so I would like at the end of the rules it is written: "write "/agree" in chat for accept the rules" and that in this way the bot gives the group to the user and poke saying he accepted the rules and that he passed "community member".

Forgive me if you do not understand too much, I'm French, I do not completely mastered English :D

Sincerely: a French men who needs help :rolleyes:
 
Last edited:

DeathWolf

Member
Thank you it works perfectly!
I now understand that I was trying to use "servergroupaddclient" instead of "addClientToServerGroup".
it's clean, it's beautiful! Nothing to do with what I'm doing!

by against final question, is it possible to make use "sinusbot.on ('timer' ...)" so that the "client group" given by the bot is removed automatically after a while ?
 

mxschmitt

Moderator
Staff member
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
You mean, that maybe every 10 Minutes all clients in a group will be cleaned?
 

DeathWolf

Member
Yes but more particularly to the user who received the "server group" by the bot, it would serve me for other actions.
After if it is not possible for one user but for an entire group that would be good too !

So I have to use "sinusbot.on ('timer' ...)" ?

Anyway, thanks to you I better understand the mistakes I made ;)
 
Last edited:

DeathWolf

Member
vars: {
a_group: {
title: 'Group, which should be assigned.',
type: 'number'
},
b_message: {
title: 'The message, which should be send, after the bot assigned the group. %n is the nickname of the Client.',
type: 'multiline'
},
c_command: {
title: 'The command, which should be used to assign the group.',
type: 'string'
},
d_time_remove: {
title: 'Time after the "server group" be revoked.',
type: 'number'
},
e_group_revoke: {
title: 'the group that is removed after "d_time_remove".',
type: 'number'
}
}, function(sinusbot, config) {
sinusbot.on('chat', function(ev) {
if(ev.msg == config.c_command && ev.mode == 2) {
sinusbot.addClientToServerGroup(ev.client.dbid, config.a_group);
sinusbot.poke(ev.clientId, config.b_message.replace(/%n/g, ev.clientNick));
sinusbot.removeClientFromServerGroup(ev.client.dbid, $time.d_time_remove && config.e_group_revoke)
}
});
});

OR

vars: {
a_group: {
title: 'Group, which should be assigned.',
type: 'number'
},
b_message: {
title: 'The message, which should be send, after the bot assigned the group. %n is the nickname of the Client.',
type: 'multiline'
},
c_command: {
title: 'The command, which should be used to assign the group.',
type: 'string'
},
d_time_remove: {
title: 'Time after the "server group" be revoked.',
type: 'number'
}
}, function(sinusbot, config) {
sinusbot.on('chat', function(ev) {
if(ev.msg == config.c_command && ev.mode == 2) {
sinusbot.addClientToServerGroup(ev.client.dbid, config.a_group);
sinusbot.poke(ev.clientId, config.b_message.replace(/%n/g, ev.clientNick));
sinusbot.removeClientFromServerGroup(ev.client.dbid, $time.d_time_remove && config.a_group)
}
});
});

that's nearly it ? o_O
 
Last edited:

mxschmitt

Moderator
Staff member
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
Here you have an good example of setInterval:
After that change the interval into your config variable multiple 1000 for miliseconds. But atm i don't know what you want to do. Your last post with code is completly non-sense sorry. o_O
 
Status
Not open for further replies.
Top