StealthBot.net: squelch script - StealthBot.net

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

squelch script

#1 User is offline   A292A Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: April-29 12

Posted May 04, 2012 - 01:53 PM

My bot only runs trivia in public channels and there are about 5 abusers that need to be ignored(squelched). However ever time the bot disconnects or is restarted, all of the manually squelched names are lost. Ipban or exile flags them as /b and can't ban(public channel), but never seems to remember to just squelch that user name. So after rejoining, I have to type all the names in again one by one. /squelch user1 /squelch user2 ect ect. This would also be my first script so details please and thanks a million!

#2 User is offline   HarryGSn Icon

  • Scripting B*tch
  • PipPip
  • Group: Members
  • Posts: 81
  • Joined: August-07 10

Posted May 04, 2012 - 02:55 PM

View PostA292A, on May 04, 2012 - 04:53 PM, said:

My bot only runs trivia in public channels and there are about 5 abusers that need to be ignored(squelched). However ever time the bot disconnects or is restarted, all of the manually squelched names are lost. Ipban or exile flags them as /b and can't ban(public channel), but never seems to remember to just squelch that user name. So after rejoining, I have to type all the names in again one by one. /squelch user1 /squelch user2 ect ect. This would also be my first script so details please and thanks a million!

Well, i suppose that's what you need...
if you'll need any command in order to re-ignore again if the bot couldn't ignore the user because he was offline ect, just tell me.
Anyway, get that:

Attached File  AutoIgnore.txt (1.61K)
Number of downloads: 161
Posted Image

#3 User is offline   A292A Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: April-29 12

Posted May 04, 2012 - 10:09 PM

View PostHarryGSn, on May 04, 2012 - 09:55 AM, said:

Well, i suppose that's what you need...
if you'll need any command in order to re-ignore again if the bot couldn't ignore the user because he was offline ect, just tell me.
Anyway, get that:

Attachment AutoIgnore.txt


Thanks for the response. Its very likely that some users in the ignore list will be offline. But even if using the "/ignore user1" for an active online user, it works fine. But if you disconnect/reconnect, the user is un-squelched. Perhaps there is a setting to save squelches/ignores, but cant find it. If it comes down to a script, like the one you replied with my skill lvl sits at downloading this bot and adding the trivia plugin. What would you do with that txt file and how would you use it to auto-squelch upon re-connect a custom user name list. Thanks in advance!

#4 User is offline   HarryGSn Icon

  • Scripting B*tch
  • PipPip
  • Group: Members
  • Posts: 81
  • Joined: August-07 10

Posted May 05, 2012 - 12:53 PM

View PostA292A, on May 05, 2012 - 01:09 AM, said:

Thanks for the response. Its very likely that some users in the ignore list will be offline. But even if using the "/ignore user1" for an active online user, it works fine. But if you disconnect/reconnect, the user is un-squelched. Perhaps there is a setting to save squelches/ignores, but cant find it. If it comes down to a script, like the one you replied with my skill lvl sits at downloading this bot and adding the trivia plugin. What would you do with that txt file and how would you use it to auto-squelch upon re-connect a custom user name list. Thanks in advance!

As far as i know it's "quite" impossible to store the squelch/ignore from a user when you reconnect on b.net
By the way, when you reload the scripts, the bot will re-attempt to squelch those users.
If you need the command too, just tell me
Posted Image

#5 User is offline   A292A Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: April-29 12

Posted May 06, 2012 - 02:57 PM

View PostHarryGSn, on May 05, 2012 - 07:53 AM, said:

As far as i know it's "quite" impossible to store the squelch/ignore from a user when you reconnect on b.net
By the way, when you reload the scripts, the bot will re-attempt to squelch those users.
If you need the command too, just tell me


Ah yes, the bot never saves squelches, unfortunately. However, if you squelch a user that is currently offline, the bot say that user is squelched but 'offline.' This is fine because the squelch list is only lost with my offline/online cycle. This means that the script can be quite simple:
1.) Detect connect/reconnect
2.) Squelch users from a .txt list(or other location)

What is needed to do this? You have mentioned a command. Is this a one-liner type thing, or will a script file be needed, in which case much help would be needed. This would be my first script. Getting there!

Thx

#6 User is offline   RosieSuckedMe Icon

  • Full Member
  • PipPipPip
  • Group: Members
  • Posts: 251
  • Joined: March-17 11

Posted May 06, 2012 - 04:09 PM

What HarryGSn has made is probably the easiest and perhaps even the only way you'd do this. His script should successfully squelch all online users in the document when the bot logs on (connects/reconnects) - if you want the bot to squelch all users in the document despite some of them being offline/not being in the channel where the bot's located, just change this:

Sub Event_LoggedOn(Username, Product)
	Dim User, Users
	Users = Setting("IgnoreUsers")
	Users = Split(Users,",")
	For Each User in Users
		If Not Channel.GetUser(User).IsSquelched Then
			Call Command(BotVars.Username, "/ignore " & User, True)
		End If
	Next
End Sub


into this:

Sub Event_LoggedOn(Username, Product)
	Dim User, Users
	Users = Setting("IgnoreUsers")
	Users = Split(Users,",")
	For Each User in Users
		Call Command(BotVars.Username, "/ignore " & User, True)
	Next
End Sub


Except from that, I don't see what your problem is here :blink:

This post has been edited by RosieSuckedMe: May 06, 2012 - 04:21 PM


#7 User is offline   HarryGSn Icon

  • Scripting B*tch
  • PipPip
  • Group: Members
  • Posts: 81
  • Joined: August-07 10

Posted May 06, 2012 - 05:48 PM

Added 4 Commands:
  • squelchadd:
    You can add more people in the squelchlist without editing the config

  • squelchlist
    Shows the current users in the list

  • autosquelch
    bot is attempting to re-squelch the users in the squelchlist

  • clearsquelch
    Clears the bot's autosquelch list


I Suppose that is completed now!
But if you still need something more, don't hesitate to ask!


Option Explicit

Script("Name")           = "AutoIgnore"
Script("Author")         = "HarryGSn"
Script("Major")          = "1"
Script("Minor")          = "1"
Script("Revision")       = "0"
Script("Description")    = "Auto-Ignore Specific users on reconnect"
Script("Last Modified")  = "5/6/12"

Private IgnorePath, ScriptVersion

Sub Event_Load()
	IgnorePath = BotPath & "IgnSettings.ini"	
	
    ScriptVersion = "v" & Script("Major") & "." & Script("Minor") & "." & Script("Revision")	
	AddChat RGB(255, 100, 0), "[AutoIgnore] ? ["& Script("Author") &"]'s [" & Script("Name") & "] Loaded with success!"
	
	 If Not Setting("Version") = ScriptVersion Then
          WriteConfigEntry "Settings", "version", ScriptVersion, IgnorePath
          AddChat color.Magenta, Script("Name") & ": Updated to " & ScriptVersion & " with success!"
     End If
	 Call WriteSettings()
	 Call SquelchCommands()
	 
End Sub

Sub Event_Command(Command)
    With Command	
	
	If NoT .isValid Then Exit Sub
	
	Select Case LCase(.Name)
		Case "autosquelch"
			.Respond StringFormat("{0}", autosquelch_cmd())
		Case "squelchlist"
			.Respond StringFormat("{0}", squelchlist_cmd())
		Case "squelchadd"
			.Respond StringFormat("{0}", squelchadd_cmd(.Argument("User")))
		Case "clearsquelch"
			.Respond StringFormat("{0}", clearsquelch_cmd())
		End Select			
	End With
End Sub

Private Function clearsquelch_cmd()
	WriteConfigEntry "Settings", "IgnoreUsers", vbNullString , ignorePath
	clearsquelch_cmd = StringFormat("SquelchList was Cleared!")
End Function

Private Function squelchlist_cmd()
	Dim Users
	Users = Setting("IgnoreUsers")
	If Users = vbNullString Then
		Users = "N/A"
	End If
	squelchlist_cmd = StringFormat("Users on Auto-SquelchList: [{0}]", Users)
End Function

Private Function autosquelch_cmd()
	autosquelch_cmd = StringFormat("Attempting to Squelch users: [{0}]", Setting("IgnoreUsers"))
	Call Squelch()	
End Function

Private Function squelchadd_cmd(user)
	Dim CurrentList, NewList, Users
	CurrentList = Setting("IgnoreUsers")
	Users = Split(User,",")
	For Each User in Users
		NewList = CurrentList & "," & User
	Next
	For Each User in Users
		Call Command(BotVars.Username, "/ignore " & User, True)
	Next
	
	WriteConfigEntry "Settings", "IgnoreUsers", NewList , ignorePath
	squelchadd_cmd = StringFormat("List was updated to: [{0}]", Setting("IgnoreUsers"))
End Function

Private Function Setting(Entry)
     Setting = GetConfigEntry("Settings", Entry, IgnorePath)
End Function

Sub Event_LoggedOn(Username, Product)
	Call Squelch()
End Sub

Private Sub Squelch()
	Dim User, Users
	Users = Setting("IgnoreUsers")
	Users = Split(Users,",")
	For Each User in Users
		Call Command(BotVars.Username, "/ignore " & User, True)
	Next
End Sub

Private Sub WriteSettings()
	If Setting("IgnoreUsers") = vbNullString Then	 
		  WriteConfigEntry "Settings", "IgnoreUsers", InputBox("Please enter the usernames that you want to be ignored/squelched on reconnect. [Use a comma (,) to seperate each user!]", Script("Name") & " by " & Script("Author"), "Insert Usernames"), IgnorePath
	End If
End Sub

Private Sub SquelchCommands()
     Dim Command, Parameter
    
    If OpenCommand("squelchlist") Is Nothing Then
          With CreateCommand("squelchlist")
               .Description = "0" 
               .RequiredRank = 100
			   .Aliases.Add "slist"
               .Save
          End With
    End If
	
	If OpenCommand("autosquelch") Is Nothing Then
          With CreateCommand("autosquelch")
               .Description = "0" 
               .RequiredRank = 100
			   .Aliases.Add "as"
               .Save
          End With
    End If
	
	If OpenCommand("squelchadd") Is Nothing Then
		With CreateCommand("squelchadd")
		   .Description = "0" 
		   .RequiredRank = 100
		   Set Parameter = .NewParameter("User", False, "String")
				Parameter.Description = "0"
		   .Parameters.Add Parameter   
		   .Aliases.Add "sa"
		   .Save
		End With
	End If
	
	If OpenCommand("clearsquelch") Is Nothing Then
          With CreateCommand("clearsquelch")
               .Description = "0" 
               .RequiredRank = 200
			   .Aliases.Add "cs"
               .Save
          End With
    End If
	
	
	Set Command   = Nothing
	Set Parameter = Nothing	  	 
	
End Sub		

This post has been edited by HarryGSn: May 06, 2012 - 05:50 PM

Posted Image

#8 User is offline   Dekar Icon

  • Beaten Up Warrior
  • PipPip
  • Group: Members
  • Posts: 29
  • Joined: October-10 09

Posted May 06, 2012 - 06:26 PM

Maybe adding a UserJoins Event in there to when users join the channel that are on the ignore list be squelched if they aren't squelched already. Check for bnet flags on that too.
And UserInChannel Event for users that already are in the channel as that event has flags argument in it as well.

Flags can be used to check if a user is squelched. I think the hexadecimal representation of user flag squelched is this:
0x00000020

You can pass the user flag to the squelch sub and check it if need to. Just a suggestion.

This post has been edited by Dekar: May 06, 2012 - 06:41 PM

Posted Image

#9 User is offline   RosieSuckedMe Icon

  • Full Member
  • PipPipPip
  • Group: Members
  • Posts: 251
  • Joined: March-17 11

Posted May 06, 2012 - 06:46 PM

Quote

Battle.net User Flags (ones common/possible today):

' &H01 = Blizzard Representative
' &H02 = Channel Operator (Hammer or Moderator)
' &H08 = Battle.net Administrator
' &H10 = No UDP Support (UDP Plug)
' &H20 = Squelched


#10 User is offline   A292A Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: April-29 12

Posted May 06, 2012 - 11:17 PM

The full script version posted works great. Had to figure out where to put the .txt and mod it accordingly. Thx for all responses!

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users