Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Yegg on September 07, 2004, 06:57 PM

Title: Ban Next User
Post by: Yegg on September 07, 2004, 06:57 PM
Im working on adding some useful commands to my bot which runs through CSB, Im trying to get my bot to be able to allow a user to check a checkbox that determines whether the command will be started or not. I want it to ban every user who joins the channel, after the command has been checked.
If anyone needs the code for my userjoins sequence, tell me.
Title: Re:Ban Next User
Post by: Warrior on September 07, 2004, 09:10 PM

'You need to have your checkbox name chkBanOnJoin
'This should go in your On Join Sub.
If chkBanOnJoin.Value = True Then
CleanSlatebot1.Send "/ban "+ Username + " On-Join Ban"
ElseIf chkBanOnJoin.Value = False Then
'
End If
Title: Re:Ban Next User
Post by: Grok on September 07, 2004, 10:11 PM
Warrior:  Wrong.  As has been discussed in the BotDev forum many times over the years, you should not let user-generated events cause your bot to respond with flood-penalized sequences.  A user joining the channel would then cause your bot to attempt to ban it instantly.  A few of those at once and your bot will flood-disconnect.

Instead, send everything to one or more queues, by priority.  Let your bot manage what gets sent and when, in the queue logic and timing.  This way you can implement a flood-prevention algorithm.
Title: Re:Ban Next User
Post by: l2k-Shadow on September 09, 2004, 02:34 PM
Grok is right of course, however, since Yegg is making a bot with CSB, it means that he must not be a very experienced programmer and probably would not know how to make a queue and an anti-flood function.

(Sorry if this offended anyone or if I misjudged you, Yegg, I was just stating what I thought on the matter)
Title: Re:Ban Next User
Post by: Warrior on September 09, 2004, 07:41 PM
Hmm alright thanks for the info.
Title: Re:Ban Next User
Post by: LivedKrad on September 10, 2004, 08:09 PM
It's just a matter of determining what usernames you feel should be banned first upon joining the channel. First you may want to have a listbox, along with a timer control. When of course you receive the "UserJoin" event, add the name (by given priority or what have you), to this listbox. The timer can be randomly fire or a set time, (queue). When this timer event is fired, simply activate code to "/ban " the top most user of the listbox, and then remove it.


(OnUser)
List1.AddItem CleanSlateBot1.Usernamer '(I think that's the property used?)

'----
Private Sub Form1_Timer1()
CleanSlateBot1.Send "/ban " & List1.List(0)
List1.RemoveItem 0
End Sub


Possibly something to that effect. I hope that helped. Remember though, timers are done in milliseconds. Meaning 1000ms = 1 second.
Title: Re:Ban Next User
Post by: Dyndrilliac on September 13, 2004, 10:10 PM
Using a collection or array would be better.

Public BanQueue(100) As String

And I believe for the built in CSB OnJoin Event handler there is a locally declared username variable, that is filled in automatically.
Title: Re:Ban Next User
Post by: Yegg on September 22, 2004, 11:58 AM
Ok, i got it to work with a timer, and it adds usernames to a listbox, and it every 5 seconds, bans the item at the top, but i cant seem 2 correctly remove the item, im doing lstBan.RemoveItem 0 and i tried a few other ways, but it never seems to work, i get either a runtime error or it keeps on banning the item thats in the listbox, can ne1 help me with this?
Title: Re:Ban Next User
Post by: Yegg on September 22, 2004, 04:20 PM
Ok, nvm i figured it out.
Title: Re:Ban Next User
Post by: CrAz3D on September 22, 2004, 06:39 PM
I do believe that collections were shown to pwn arrays

Quote from: Adron on March 23, 2004, 04:33 PM
There is the link to Adron's test/message