Valhalla Legends Forums Archive | Battle.net Bot Development | Automoderation - Idleban/kick

AuthorMessageTime
Mephisto
Logically I am having trouble implementing the automoderation modes idleban and idlekick.  I have the general idea, but I can't really put it together to where it works logically.  Can anyone share their implementations of it?  Perhaps Skywing/Kp from ZeroBot or iago/Trust from JavaOp or anyone else who would know how to do this...?
October 22, 2004, 6:59 PM
Minux
[quote author=Mephisto link=topic=9281.msg85670#msg85670 date=1098471569]
Logically I am having trouble implementing the automoderation modes idleban and idlekick.  I have the general idea, but I can't really put it together to where it works logically.  Can anyone share their implementations of it?  Perhaps Skywing/Kp from ZeroBot or iago/Trust from JavaOp or anyone else who would know how to do this...?
[/quote]

Unfortunately I've only done this in VB, so I don't know if that is what you're looking for.
October 22, 2004, 7:43 PM
LivedKrad
I don't think he's looking for code, like he said, logic. I'm sure Mephisto can do the code as long as he has the right idea about doing it. Mephisto, maybe it could add each user that joined in a specific time frame to be added to an array or another sorting method. That way, you can reduce the amount of timers needed to ban/kick the certain people. (In the specified order of the arrays). I doubt this is a very accurate way though ;\
October 22, 2004, 9:32 PM
Mephisto
Minus, if you could share your implementation (explain how you do it) I'd appreciate it.  LivedKrad, not entirely sure what you mean, but I'm in a hurry to get out of the house so I'll analyze it better when I get back.  Thanks for sharing :)
October 22, 2004, 9:42 PM
iago
The idea behind vL's is that each event that occurs takes them one step closer to the limit.  You need to keep track of how many events have occurred since the last time they've been active (I'd imagine you'd have a list or vector or whatever of users in the channel who are vulnerable to it, and each of them would have a count associated with them).  When the key event occurs to put them over the threshold, they're kicked or banned.

The other option is to use timing, just store the last time they talked, and every time they talk the time is reset, and when an event occurs it checks if they're over the threshold.
October 22, 2004, 10:52 PM
Minux
[quote author=iago link=topic=9281.msg85712#msg85712 date=1098485549]
The other option is to use timing, just store the last time they talked, and every time they talk the time is reset, and when an event occurs it checks if they're over the threshold.
[/quote]

Yeah that's pretty much what I did, I record the time they joined, or if they joined before me, the time I joined is set as their join time. And that time is their last talk time. Whenever they talk, their last talk time is to set the current time, I just use GetTickCount();. When IdleBan or IdleKick is set to on. I enable a timer with an interval of 10 seconds. And every 10 seconds it checks each user in the channel by doing

[code]
Result = GetTickCount(); - LastTalkTime[i];

if (Result >= 60000)
{
Send '/ban ' + Username
}
[/code]

I hope that helps :|

If that doesn't make sense, I'll try again!
October 22, 2004, 10:58 PM
Networks
It's really simple:
- ID_USER (Store their idle time)
- ID_TALK, ID_EMOTE (Store their idle time)
- ID_JOIN (Store their idle time)
(Arrays are nice for this but I don't know enough C++ yet)

From that you can simply use a timer to check how long a user has been idle or as iago said you check on each event but I prefer timers because it's more accurate in my opinion.

NOTE: It's not a good idea to store idle time during the time idleban is off because when turned on the bot will begin banning users instantaneously if it's on a timer.

Gettickcount() is nifty for this and you can simply subtract the current gettickcount return from a person's stored idletime and ban/kick them.

The interval for your timing is what ever you should feel it should be. 1 second or 10 seconds, whatever.
October 22, 2004, 11:29 PM
iago
I wouldn't use a timer for it, since you'd need a timer for each user, and that's quite a bit of overhead.  But that's just me.
October 22, 2004, 11:44 PM
Minux
Obviously people aren't understanding what I said.

Use a For loop and go through each user in the array for the user's last talk time and then compare it to the current time.....And ban each user that has been idle for the amount of time you think is good. I don't know where ANYBODY got the idea that I suggested to use a timer for each user...
October 23, 2004, 12:24 AM
Kp
The method used in ZeroBot records time of last activity.  Each time an event occurs, a counter is decremented.  When it hits zero, the person who was idle the longest is kicked/banned.  This has the rather nice side effect that the bot doesn't spam up an otherwise quiet channel by kicking out idle people.  Once activity picks up, the counter starts moving again and the idlers don't have long to stay.
October 23, 2004, 3:21 AM
LivedKrad
[quote author=Mephisto link=topic=9281.msg85711#msg85711 date=1098481324]
Minus, if you could share your implementation (explain how you do it) I'd appreciate it.  LivedKrad, not entirely sure what you mean, but I'm in a hurry to get out of the house so I'll analyze it better when I get back.  Thanks for sharing :)
[/quote]

The idea I was trying to convey was this:

Let's say you have a time span of 10 seconds, if 5 users joined during these 10 seconds you could create an array and add all 5 of these users into the array. The array would have the unique value of these users joining at different intervals. And then, every 10 or 20 seconds, just check the specific array for unique join/idle time. While this poses a problem for second to second accuracy, it reduces overhead with minimal timers.
October 23, 2004, 3:36 AM
iago
Actually, I like Kp's idea -- using a shared counter sounds a lot more slick.
October 23, 2004, 3:40 AM
Mephisto
[quote author=iago link=topic=9281.msg85712#msg85712 date=1098485549]
The idea behind vL's is that each event that occurs takes them one step closer to the limit.  You need to keep track of how many events have occurred since the last time they've been active (I'd imagine you'd have a list or vector or whatever of users in the channel who are vulnerable to it, and each of them would have a count associated with them).  When the key event occurs to put them over the threshold, they're kicked or banned.

The other option is to use timing, just store the last time they talked, and every time they talk the time is reset, and when an event occurs it checks if they're over the threshold.
[/quote]

The timing was what I was thinking, but that's not accurate in all honesty.  Because you're banning them once they go over the timer limit when an event occurs.  An event may not occur for hours after they go over the time limit.  And also, what happens if they're the ones who issue the event after the timer expires?  Reset their time like you would by default or ban them?  It would seem odd to ban someone for being idle the second they send a message... :-\

The only way I see to implement idleban/kick with timers is to create a timer for each user that increments second by second either asynchronously or in another thread.  If a user issues an event, restart the timer.  If the timer expires (idealy we use SetTimer()) it sends a message to the main thread that the timer for that user has expired and to ban himf or being idle if he is not safelisted/friendslisted and idleban/kick is on.
October 23, 2004, 5:51 AM
iago
If no events are occuring, then who cares?
October 23, 2004, 7:42 AM
Stealth
[quote]The idea behind vL's is that each event that occurs takes them one step closer to the limit.  You need to keep track of how many events have occurred since the last time they've been active (I'd imagine you'd have a list or vector or whatever of users in the channel who are vulnerable to it, and each of them would have a count associated with them).  When the key event occurs to put them over the threshold, they're kicked or banned.[/quote]

iago and Kp make a lot of sense. Here's one way you could do it.

1. Assign each event that occurs an ID, sequentially. Store the current event ID globally.
2. When a user produces an event, record that event's ID in connection with their username.

[code]globalLastEventID++
thisUser.lastEventID = globalLastEventID[/code]

3. Check after each event, or every few events, for people who have been idle for quite some time. To find out how many events have passed since the user last contributed to the channel, you can simply take

[code]globalLastEventID - thisUser.lastEventID[/code]

for each user to determine which is most idle, or you can simply queue up bans for all users above a certain threshhold.
October 23, 2004, 7:52 AM
Eternal
I think this might be quite a useful threat to put in the Bot Dev References board. <go Mod go!>
October 23, 2004, 12:07 PM
Spht
[quote author=Eternal link=topic=9281.msg85775#msg85775 date=1098533250]
I think this might be quite a useful threat to put in the Bot Dev References board. <go Mod go!>
[/quote]

https://davnit.net/bnet/vL/phpbbs/index.php?topic=7220.0
October 23, 2004, 1:34 PM
Networks
oh god..
You create a timer and loop through the array of users checking each and every idle time..
October 23, 2004, 5:02 PM
LivedKrad
You create a single timer to ban users in an array? Not only is that inaccurate, it could cause problems when trying to ban (I would assume) the upperbound element of the array (the latest users). How would you ban someone in the middle if they were idle longer than the person on the end? Especially with a single timer.
October 24, 2004, 1:59 AM
shadypalm88
[quote author=LivedKrad link=topic=9281.msg85844#msg85844 date=1098583159]
You create a single timer to ban users in an array? Not only is that inaccurate, it could cause problems when trying to ban (I would assume) the upperbound element of the array (the latest users). How would you ban someone in the middle if they were idle longer than the person on the end? Especially with a single timer.
[/quote]Huh?  If I simply store a last action timestamp along with my array of channel users, and check through it for people that haven't done anything in the last X seconds, how is that inaccurate?  This would be trivial using clock() or GetTickCount() to create the timestamps, comparing them every so often to the current value, and if the difference is over the threshold, banning or kicking the user.  The accuracy would be as good as the timer delay.
October 24, 2004, 2:19 AM
KkBlazekK
I'd go with the event idea rather then all the other ones..

Edit:

I would count every 4 chats as one ID
October 24, 2004, 2:50 AM
Networks
My idleban bans any user who has exceeded the idle limit not just one user.
October 24, 2004, 8:30 AM
LivedKrad
[quote author=shadypalm88 link=topic=9281.msg85848#msg85848 date=1098584341]
[quote author=LivedKrad link=topic=9281.msg85844#msg85844 date=1098583159]
You create a single timer to ban users in an array? Not only is that inaccurate, it could cause problems when trying to ban (I would assume) the upperbound element of the array (the latest users). How would you ban someone in the middle if they were idle longer than the person on the end? Especially with a single timer.
[/quote]Huh?  If I simply store a last action timestamp along with my array of channel users, and check through it for people that haven't done anything in the last X seconds, how is that inaccurate?  This would be trivial using clock() or GetTickCount() to create the timestamps, comparing them every so often to the current value, and if the difference is over the threshold, banning or kicking the user.  The accuracy would be as good as the timer delay.
[/quote]

I wasn't aware he mentioned anything so deep as to reveal anything to the nature of what you said.
October 26, 2004, 10:02 PM

Search