Valhalla Legends Forums Archive | Battle.net Bot Development References | Creating a Sweep Ban Function

AuthorMessageTime
TriCk
Language: VB6

Hey ppl i need to know what to do to get sweepban working. Is it a packet i have to send to get ./who channel or something?
September 4, 2003, 2:29 AM
Spht
[quote author=TriCk link=board=17;threadid=2571;start=0#msg20054 date=1062642571]
Language: VB6

Hey ppl i need to know what to do to get sweepban working. Is it a packet i have to send to get ./who channel or something?

[/quote]

I have no idea what you mean by "sweepban." Some details would be helpful instead of a title.
September 4, 2003, 2:32 AM
DrivE
[quote author=Spht link=board=17;threadid=2571;start=0#msg20057 date=1062642746]
[quote author=TriCk link=board=17;threadid=2571;start=0#msg20054 date=1062642571]
Language: VB6

Hey ppl i need to know what to do to get sweepban working. Is it a packet i have to send to get ./who channel or something?

[/quote]

I have no idea what you mean by "sweepban." Some details would be helpful instead of a title.
[/quote]

I believe he is referring to a feature that I know Camel has implemented into his bot. When directed, the bot will check the users in a given channel, and ban them all. For instance if you gave the bot the command .sweepban Clan Recruitment, the bot would check the users in the channel and ban whomever was in the channel at the time. I am fairly certain this is what Trick was getting at.
September 4, 2003, 2:40 AM
TriCk
Sorry, Sweepban means
ban everyone in a specified channel, like
?sweepban Clan Recruitment
would recieve all the ppl in that channel and ban them 1 by 1 ...

-1 to myself :P for not saying what it was
September 4, 2003, 2:40 AM
Spht
[quote author=TriCk link=board=17;threadid=2571;start=0#msg20062 date=1062643250]
Sorry, Sweepban means
ban everyone in a specified channel, like
?sweepban Clan Recruitment
would recieve all the ppl in that channel and ban them 1 by 1 ...

-1 to myself :P for not saying what it was
[/quote]

OK, then /who the channel and ban everyone that's in it.
September 4, 2003, 2:43 AM
TriCk
hmmm, yeah i got that much ... im thinking something like this ...

Send "/who " & Channel

If InStr(Form1.Talk, ", ") Then
Form1.Talk = Replace(Form1.Talk, ", ", vbCrLf)


But, i still need some help on banning the ppl, because this would just list them ...
Unless when a user does it, it adds to a listbox and goes through?
September 4, 2003, 2:49 AM
TriCk
Also that may take out other pieces of text people have sent ...
September 4, 2003, 2:50 AM
DrivE
[quote author=TriCk link=board=17;threadid=2571;start=0#msg20067 date=1062643797]
hmmm, yeah i got that much ... im thinking something like this ...

Send "/who " & Channel

If InStr(Form1.Talk, ", ") Then
Form1.Talk = Replace(Form1.Talk, ", ", vbCrLf)


But, i still need some help on banning the ppl, because this would just list them ...
Unless when a user does it, it adds to a listbox and goes through?
[/quote]

You need to use the code tool... for the love of GOD
September 4, 2003, 2:50 AM
TriCk
Whats the packets id need to send and recv the battle.net information?
September 4, 2003, 2:51 AM
Stealth
It's actually very easy to do. Just store server info messages for, say, two seconds after the /who command is sent. Once caching is complete, parse the commas and extraneous information out of your stored information and ban, shitlist, squelch, whisper, poke or otherwise harrass the targeted users accordingly.

This can be accomplished using Static or (more messy) global-scope declarations.
September 4, 2003, 2:51 AM
TriCk
Hmmmm -.-
Ok stealth keep in mind i'm not as good of a programmer as you

So english would help :(

Also maybe some code...
September 4, 2003, 2:54 AM
DrivE
[quote author=TriCk link=board=17;threadid=2571;start=0#msg20073 date=1062644042]
Also maybe some code...
[/quote]

How did I know he'd end up asking for code?
September 4, 2003, 2:54 AM
Stealth
Here's the code you're getting:

[code]
Public Function Cache(ByVal Inpt As String, ByVal Mode As Byte, Optional ByRef Typ As String) As String
Static s() As String
Static sTyp As String[/code]

The Cache function performs many things for me. During caching, it stores (in that static array) the server info responses. At the start of caching, it stores the output purpose in the sTyp string (this can be ban, squelch, or whatever else I need.) The actions it performs are completely controlled by the value of the Mode byte: One will tell the function that it will be recieving data, a different byte will resize and add to the cache array, another will clear the cache and return the stored information.

Writing an independent function such as this allows me to avoid using messy global declarations, and I can do absolutely anything I want with the returned data -- ban the users, shitlist them, squelch them, or whatever I please.
September 4, 2003, 3:07 AM
TriCk
So sTyp is like what
ID_* would be?
and s() stores the received info?
September 4, 2003, 3:10 AM
Soul Taker
Or you could have a second bot join the channel and send (via BotNet for no flooding) the list of names it sees in the channel, and have the other bot automagically ban them.
September 4, 2003, 3:12 AM
TriCk
Soul Taker, id prefer not to have another bot loading.... I think i got how to do it my own way ....

Code:
If InStr(Message, ", ") Then
Splt() = Split(Message, ", ")
AddC Form1.CHAT, vbGreen, Splt(0)
AddC Form1.CHAT, vbGreen, Splt(1)
Form1.List1.AddItem Splt(0)
Form1.List1.AddItem Splt(1)
End If
September 4, 2003, 3:15 AM
TriCk
That goes under ur Identifier for &H12
Then u simply do
For i = 0 to List1.ListCount
Send List1(i).Text
Next i
September 4, 2003, 3:17 AM
Stealth
I love your variable and object names.. they're so descriptive ;)
September 4, 2003, 3:27 AM
TriCk
Hehe thx stealth :P

Aite...
Dim Splt() As String
AddC = Sub to add chat
Form1.CHAT = RichTextBox
List1 = ListBox ... Duh :P

For i = 0 to List1.ListCount
Send List1(i).Text
Next i
That is a little bit wrong, my bad...

I've decided to do ...
If Form1.List1.ListCount > -1 Then
Send "/ban " & Form1.List1.List(0)
Form1.List1.RemoveItem (0)
End If
September 4, 2003, 3:41 AM
TriCk
Ok Heres another problem, I need to make the bot ban Operators too ... which have "[" name "]" and i was wondering how would i remove this from a message...

I've already got down that UCase(Message) is needed mostlikely... but i don't know how to remove "[" "]" from the start and end of names ...
September 4, 2003, 5:13 AM
Camel
I wasn't patient enough to read all of the replies to see if the answer was given, but here's what I use:

[code]      'WARNING: The following code is used for sweepban,
      ' a method to ban every user in a channel by using
      ' /who. If you cannot figgure out how to use it on
      ' your own, do not expect me to explain it.
      '
      'If Left(Info, 17) = "Users in channel " Then
      '   bot.SendText "Sweepbanning #" & Mid(Info, 18, len(Info) - 18)
      'End If
      '
      'For Each User In Split(Info, ", ")
      '   If InStr(User, " ") = 0 Then
      '      If ( (Left(User, 1) = "[") And (Right(User, 1) = "]") ) Then User = Mid(User, 2, Len(User) - 2)
      '      'bot.ShowText "ÿC9ÿci/ban " & User & " sweepban"
      '      bot.SendText "/ban " & User & " sweepban"
      '   End If
      'Next[/code]

BTW, that's in an external script file, which is why everything is a variant.
September 4, 2003, 6:08 AM
TriCk
Is bot a Public Type?
September 4, 2003, 7:01 AM
Camel
Not that it's relevant to the topic, but 'bot' is a class module passed to the script control which contains functions used to control the bot. It's not glorious, but it was the most effective method I came across at the time.
September 4, 2003, 8:18 PM
TriCk
Oh Ok
September 5, 2003, 10:31 PM
St0rm.iD
/who the channel and send just /. Parse every info message following the command. Ignore the error message, which means you should stop parsing the info messages.

Yeah yeah, it does take two packets, but imo it's the cleanest way you can do it.
September 7, 2003, 12:25 AM
Skywing
[quote author=St0rm.iD link=board=17;threadid=2571;start=15#msg20392 date=1062894353]
/who the channel and send just /. Parse every info message following the command. Ignore the error message, which means you should stop parsing the info messages.

Yeah yeah, it does take two packets, but imo it's the cleanest way you can do it.
[/quote]
Not necessarily foolproof either. Battle.net events have been proven completely asynchronous, so there's not really a sure-fire way to know.

For instance, I've logged receiving a notification of a user talking in the middle of receiving the initial channel userlist, before I received a notification that said user was actually in the channel.
September 7, 2003, 12:58 AM
St0rm.iD
Oh, thought they were always in-order.
September 7, 2003, 1:28 AM
Soul Taker
I've recieved a ban message and a user leave message on someone, then they spammed two lines of text AFTER I saw them banned/leave. Happens once in a while.
September 7, 2003, 2:45 AM
UserLoser
Two bots in same channel. Bot A, and Bot B. Bot B gets banned. Bot A recieves the "bot b has been banned by the operator" message. Bot A recieves the leave event for Bot B. Bot B doesn't recieve the message that it has been banned by the channel operator, until about 7 seconds later.
September 7, 2003, 2:55 AM
DrivE
[quote author=UserLoser link=board=17;threadid=2571;start=15#msg20425 date=1062903337]
One time I had two bots in the same channel, someone banned one of the bots, and right away on the bot that didn't get banned, it displayed the ban message. But on the bot that did get banned, I believe it was 7 seconds later it said blah was banned by blah!, blah has kicked you out of the channel!
[/quote]

I've read that like 8 times and I still don't get it. It is less than coherent.
September 7, 2003, 3:00 AM
UserLoser
Should make much more sense now
September 7, 2003, 3:22 AM
Camel
I understood it just fine: The bot that was banned didn't get the message right away. Try cutting out everything that's not vital to the meaning. :)
September 7, 2003, 7:15 AM

Search