StealthBot.net: Stealthbot Clan Management Script (UPDATE) - StealthBot.net

Jump to content

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

Stealthbot Clan Management Script (UPDATE) Stealthbot Clan Management Script (UPDATE)

#1 User is offline   Fpa Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: August-23 19

Posted December 10, 2020 - 08:37 AM

Hello everyone,

I guess im a bit of a slow-poke but ive revamped my Stealthbot Clan Management Script!
Its ready to go online with capidaptor. Its a text-ranked clan moderator script. All clan members use access of 1 and u can safeadd friends too.

It includes 3 files, the clan management script, the capidaptor script and a slightly edited commands.xml
For a bit of info to get you started, edit capidaptor script to contain path to capidaptor.exe and be sure to include your apikey, and place it in scripts folder.

As for clan management script, place both files, clan.txt and commands.xml in your scripts folder.
Edit clan.txt to contain your battle.net "clantag" the asterisk "*" is where your username would be when your using battle.net, and if you wish feel free to edit the clan ranks to your choosing, they are listed in the script file too...

If you have any problems try deleting users.txt, members.txt and commands.xml (outside of scripts folder) the script will make new ones.
I hope you enjoy using it it took alot of time and work. If you happen to find me online you can always game with me if you have time.

' https://pastebin.com/8swA4uw3 - CAPIDAPTOR (Place in scripts folder - edit as needed)
' https://pastebin.com/b7izE3Tp - Clan Management Script (Place in scripts folder - edit as needed)
' https://pastebin.com/ejdvDwFU - Commands.xml (Place in scripts folder - do not edit)

#2 User is offline   Fpa Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: August-23 19

Posted December 10, 2020 - 09:55 PM

**FIXED A BUG USE THIS ONE NOT ONE ABOVE**

' https://pastebin.com/8swA4uw3 - capidaptor.txt (Place in scripts folder - edit as needed)
' https://pastebin.com/iCwUJesJ - clan.txt (Place in scripts folder - edit as needed)
' https://pastebin.com/m9W07ktc - Commands.xml (Place in scripts folder - do not edit)

clan.txt
Script("Name") 			= "Clan Moderation"
Script("Abbreviation")	= "clan moderation"
Script("Author") 		= "Fpa-rF- and PsYChiC-rF-"
Script("Category")		= "Clan Management Script"
Script("Major")			= 1
Script("Minor")			= 0
Script("Revision")		= 1
Script("Description")	= "Clan Channel Moderation"


' https://pastebin.com/8swA4uw3 - capidaptor.txt	(Place in scripts folder - edit as needed)
' https://pastebin.com/iCwUJesJ - clan.txt		(Place in scripts folder - edit as needed)
' https://pastebin.com/m9W07ktc - Commands.xml		(Place in scripts folder - do not edit)
'
' SCRIPT COMMANDS
' ===============
' about		-	Bot version information
' list		-	Lists all bot commands
' add		-	Add clan member
' rem		-	Remove clan member
' promote	-	Promote clan member
' demote	-	Demote clan member
' whois		-	User information
' whoami	-	User information
' safeadd	-	Sadeadd a username
' safedel	-	Safedel a username
' members	-	List all clan members
' info		-	Display clan information
' ranks		-	Lists all clan ranks -> clanranks (see below)
' open		-	Open clan recruiting position
' close		-	Close clan recruiting position
' dice		-	Rolls x dice
'
' Not Implmented (Removed)
' shitlist shitadd shitdel shitcheck
' tagadd tagbans tagcheck tagdel
' motd mmail
'
'

' AUXILIARY SCRIPT COMMANDS
' =========================
' kick		-	Kicks a user from channel
' ban		-	Bans a user from channel
' unban		-	Unbans a user from channel

' SCRIPT SETTINGS
' ===============
'ENTER YOUR REQUIRED ACCESS LEVEL FOR COMMANDS (USE AT OWN RISK, MAY BREAK SCRIPT, USE 1)
Public reqaccess : reqaccess = 1

'RANKS/ROSTER FILE (KEEP OUT OF SCRIPTS FOLDER SCRIPTS ARE .TXT)
Public cmds_list : cmds_list = BotPath() & "scripts\commands.xml"
Public users_list : users_list = BotPath() & "scripts\..\users.txt"
Public members_list : members_list = BotPath() & "scripts\..\members.txt"

'ENTER YOUR CLAN TAG BELOW (ONE WILDCARD * ALLOWED, * IS MEMBER NAME)
'EXAMPLE RIGHT SIDED: clantag = "*-TaG-" 
'EXAMPLE LEFT SIDED:  clantag = "~TaG~*"
'EXAMPLE DUAL SIDED:  clantag = "TaG]*[TaG"
Public clantag : clantag = "*-rF-"

'ENTER YOUR RANKS BELOW - ADD AS MANY AS YOU NEED (TOP TO BOTTOM KEEPING VBS SYNTAX)
Public clanranks : clanranks = Array( _
"Founder", _
"Leader", _
"Chief", _
"General", _ 
"Colonel" , _
"Major" , _
"Captain" , _
"Lieutenant" , _
"Officer" , _
"Commander" , _
"Sergeant" , _
"Corporal" , _
"Specialist" , _
"Private" , _
"Recruit")

Public lenAPIKEY : lenAPIKEY = 56
Public intOpenPos : intOpenPos = 0
Public strOpenPos : strOpenPos = ""
Public oldCRC
Public newCRC
Public blnAfterJoin : blnAfterJoin = False
Public strChannelBotName

Sub dbTimer_Timer()

	'dbTimer.Enabled = False
	newCRC = GetFileCRC32(users_list)
	'AddChat &H99CC00, crc
	If oldCRC <> newCRC Then updateMembersList()
	
End Sub

Public Sub Event_Load()

	oldCRC = GetFileCRC32(users_list)
	newCRC = oldCRC
	
	CreateObj "LongTimer", "dbTimer"
	dbTimer.Interval = 10
	dbTimer.Enabled = True
	
	ResetCommands()

	FormatTag()

	Dim objWriteFile
	Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
	If objFSO.FileExists(members_list) Then
	
	Else
	
		dbTimer.Enabled = False
	
		strTempFounder = Replace(clantag, "*", "Username") 'Adds Temporary 1st Clan Member
		
		AddChat &H99CC00, "[ERROR] No clan members found!"
		
		Set objWriteFile= objFSO.OpenTextFile(members_list, 8, True, 0)
		objWriteFile.WriteLine(clanranks(0) & ": " & strTempFounder)
		objWriteFile.Close
		
		AddChat &H99CC00, "[INFO] Welcome to .: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."

		AddChat &H99CC00, "[INFO] If you encounter any problems, delete these files:"
		AddChat &H99CC00, "[INFO] ", vbYellow, BotPath & "users.txt"
		AddChat &H99CC00, "[INFO] ", vbYellow, BotPath & "members.txt"
		AddChat &H99CC00, "[INFO] ", vbYellow, BotPath & "commands.xml"
		AddChat &H99CC00, "[INFO] And then reload the bot or script to continue."
		
		AddChat &H99CC00, "[INFO] ", vbYellow, BotPath & "members.txt file created."
		AddChat &H99CC00, "[INFO] Please edit this file to contain the clan founder name with a valid clan tag! Clan tag currently set to: ", vbYellow, clantag
		AddChat &H99CC00, "[INFO] ", vbYellow, "DO NOT ADD OTHER RANKS/MEMBERS DIRECTLY TO THIS FILE! PLEASE USE THE BOT COMMANDS."
		AddChat &H99CC00, "[INFO] Please save and close this members.txt file before you continue."
		
		Set wShell = CreateObject("WScript.Shell")
		statusCode = wShell.Run(members_list, 1, True)
			
		If objFSO.FileExists(users_list) Then
			objFSO.DeleteFile users_list
			Set objWriteFile= objFSO.OpenTextFile(users_list, 8, True, 0)
			objWriteFile.WriteLine("")
			objWriteFile.Close
		Else
			Set objWriteFile= objFSO.OpenTextFile(users_list, 8, True, 0)
			objWriteFile.WriteLine("")
			objWriteFile.Close
		End If
		
		AddChat &H99CC00, "[INFO] ", vbYellow, BotPath & "users.txt file created."
		
		strTopRankUser = GetTopRankUser()
		Call SafeAddUser(strTopRankUser,"1","S",False)	
		strInfo = InfoUser(strTopRankUser, True)
		
		oldCRC = GetFileCRC32(users_list)
		newCRC = oldCRC
		
		dbTimer.Enabled = True
		
		AddChat &H99CC00, "[INFO] Your bot is now setup, enjoy using ", vbYellow ,"StealthBot Beta v2.7 - Build 493 - Clan Management Script"
		
	End If

	If OpenCommand("about") Is Nothing Then
 		With CreateCommand("about")
  			.Description = "States the bot's version information."
  			.RequiredRank = reqaccess
			.Save
		End With
	End If

	If OpenCommand("add") Is Nothing Then
 		With CreateCommand("add")
  			.Description = "Add a clan member by rank."
  			.RequiredRank = reqaccess
			.Save
		End With
	End If

	If OpenCommand("rem") Is Nothing Then
 		With CreateCommand("rem")
  			.Description = "Remove users and clan members."
  			.RequiredRank = reqaccess
			.Save
		End With
	End If

	If OpenCommand("whois") Is Nothing Then
 		With CreateCommand("whois")
  			.Description = "Returns the specified user's rank and flags."
  			.RequiredRank = reqaccess
			.Save
		End With
	End If
	
	If OpenCommand("whoami") Is Nothing Then
 		With CreateCommand("whoami")
  			.Description = "Returns the requesting user's rank and flags."
  			.RequiredRank = reqaccess
			.Save
		End With
	End If
	
	If OpenCommand("safeadd") Is Nothing Then
 		With CreateCommand("safeadd")
  			.Description = "Adds a safelist entry for a specifed user."
  			.RequiredRank = reqaccess
			.Save
		End With
	End If
	
	If OpenCommand("safedel") Is Nothing Then
 		With CreateCommand("safedel")
  			.Description = "Removes a safelist entry for a specifed user."
  			.RequiredRank = reqaccess
			.Save
		End With
	End If

	If OpenCommand("dice") Is Nothing Then
 		With CreateCommand("dice")
  			.Description = "Rolls the dice x times."
  			.RequiredRank = reqaccess
			.Save
		End With
	End If

	If OpenCommand("members") Is Nothing Then
 		With CreateCommand("members")
  			.Description = "List all clan members by rank."
  			.RequiredRank = reqaccess
			.Save
		End With
	End If

	If OpenCommand("info") Is Nothing Then
 		With CreateCommand("info")
  			.Description = "Lists the number of clan members and clan info."  
  			.RequiredRank = reqaccess
			.Save
		End With
	End If
	
    If OpenCommand("ranks") Is Nothing Then
        With CreateCommand("ranks")
            .Description = "List all clan ranks."
            .RequiredRank = reqaccess
            .Save
        End With
    End If

	If OpenCommand("promote") Is Nothing Then
 		With CreateCommand("promote")
  			.Description = "Promote a clan member by one rank."
  			.RequiredRank = reqaccess
			.Save
		End With
	End If
	
	If OpenCommand("demote") Is Nothing Then
 		With CreateCommand("demote")
  			.Description = "Demote a clan member by one rank."
  			.RequiredRank = reqaccess
			.Save
		End With
	End If

	If OpenCommand("open") Is Nothing Then
 		With CreateCommand("open")
  			.Description = "Open a clan rank recruting position."
  			.RequiredRank = reqaccess
			.Save
		End With
	End If

	If OpenCommand("close") Is Nothing Then
 		With CreateCommand("close")
  			.Description = "Close a clan rank recruting position."
  			.RequiredRank = reqaccess
			.Save
		End With
	End If
	
End Sub

Public Sub Event_ChannelJoin(ChannelName, Flags)

	If Len(BotVars.Username) = lenAPIKEY And blnAfterJoin = False Then
		strChannelBotName = LCase(ChannelName)
		strChannelBotName = Replace(strChannelBotName,"op ","")
		strChannelBotName = Replace(strChannelBotName,"clan ","")
		blnAfterJoin = True
	End If
	
End Sub


Public Sub Event_UserTalk(Username, Flags, Message, Ping)

	strUser = Username
	strCommand = Right(Message, Len(Message)-1)
	
	If LCase(Username) = LCase("[b]" & strChannelBotName) Then strCommandUsername = Username
		
	If InStr(1, strCommand, " ", vbTextCompare) = 0 Then '0 or 1 arg
		strKick = strCommand
		strInfo = InfoUser(strUser, True)
		strAccess = GetCmdAccess(LCase(strCommand))
	Else
		strSplit = Split(strCommand, " ") '2 or more args
		strCommand = strSplit(0)
		strKick = strSplit(1)
		strArg = strSplit(1)
		strInfo = InfoUser(strUser, True)
		strAccess = GetCmdAccess(LCase(strCommand))
	End If

	If LCase(strCommand) = "list" Then

		If strUser <> "" And strInfo <> "" Then
			strSplit = Split(strInfo, " ") '2 or more args
			strUserAccess = strSplit(1)
			strReqAccess = strAccess
			
			If Int(strUserAccess) >= Int(strAccess) And strArg = "" Then
				'AddChat &H99CC00, "[ERROR] You must supply a numerical bot access level to view all of the available commands."
				AddQ "[ERROR] You must supply a numerical bot access level to view all of the available commands."
				Exit Sub
			End If
			
		End If
	
	End If
	
	If LCase(strCommand) = "kick" Then
	
		isMember = GetRank(Username) : If isMember = "" Then Exit Sub
	
		If strUser <> "" And strInfo <> "" Then
		
			strSplit = Split(strInfo, " ") '2 or more args
			strUserAccess = strSplit(1)
			
			strInfo = InfoUser(strKick, True)
			If strInfo <> "" Then
			
				strSplit = Split(strInfo, " ") '2 or more args
				strKickUser = strSplit(0)
				strKickSafe = strSplit(2)
				
				intRank = GetRankIndex(strUser)
				intSupRank = GetRankIndex(strKickUser)
				
				If Int(strUserAccess) >= Int(strAccess) And intRank < intSupRank And strKickSafe <> "S" Then
					KickUser(strKickUser)
					Exit Sub
				ElseIf Int(strUserAccess) > 0 And strKickSafe = "S" Then
					'AddChat &H99CC00,"[ERROR] That user is safelisted."
					AddQ "[ERROR] That user is safelisted."
					Exit Sub
				ElseIf Int(strUserAccess) < Int(strAccess) Then
					'AddChat &H99CC00,"[ERROR] You do not have sufficient access to do that."
					AddQ "[ERROR] You do not have sufficient access to do that."
					Exit Sub
				ElseIf intRank >= intSupRank Then
					'AddChat &H99CC00,"[ERROR] Cannot kick " & strKickUser & " from Clan " & clantag & " channel. " & strKickUser & " has a higher rank."
					AddQ "[ERROR] Cannot kick " & strKickUser & " from Clan " & clantag & " channel. " & strKickUser & " has a higher rank."
					Exit Sub
				End If
			
			ElseIf Int(strUserAccess) >= Int(strAccess) And strInfo = "" Then
				KickUser(strKick)
				Exit Sub
			End If
			
		End If
		
	End If

	If LCase(strCommand) = "ban" Then
	
		isMember = GetRank(Username) : If isMember = "" Then Exit Sub
	
		If strUser <> "" And strInfo <> "" Then
		
			strSplit = Split(strInfo, " ") '2 or more args
			strUserAccess = strSplit(1)
			
			strInfo = InfoUser(strKick, True)
			If strInfo <> "" Then
			
				strSplit = Split(strInfo, " ") '2 or more args
				strBanUser = strSplit(0)
				strBanSafe = strSplit(2)
				
				intRank = GetRankIndex(strUser)
				intSupRank = GetRankIndex(strBanUser)
				
				If Int(strUserAccess) >= Int(strAccess) And intRank < intSupRank And strBanSafe <> "S" Then
					BanUser(strBanUser)
					Exit Sub
				ElseIf Int(strUserAccess) > 0 And strBanSafe = "S" Then
					'AddChat &H99CC00,"[ERROR] That user is safelisted."
					AddQ "[ERROR] That user is safelisted."
					Exit Sub
				ElseIf Int(strUserAccess) < Int(strAccess) Then
					'AddChat &H99CC00,"[ERROR] You do not have sufficient access to do that."
					AddQ "[ERROR] You do not have sufficient access to do that."
					Exit Sub
				ElseIf intRank >= intSupRank Then
					'AddChat &H99CC00,"[ERROR] Cannot ban " & strBanUser & " from Clan " & clantag & " channel. " & strKickUser & " has a higher rank."
					AddQ "[ERROR] Cannot ban " & strBanUser & " from Clan " & clantag & " channel. " & strKickUser & " has a higher rank."
					Exit Sub
				End If
			
			ElseIf Int(strUserAccess) >= Int(strAccess) And strInfo = "" Then
			
				BanUser(strKick)
				Exit Sub
			
			End If
			
		End If
		
	End If
		
	If LCase(strCommand) = "unban" Then
		
		isMember = GetRank(Username) : If isMember = "" Then Exit Sub
		
		strInfo = InfoUser(strUser, True)
		If strUser <> "" And strInfo <> "" Then
		
			strSplit = Split(strInfo, " ") '2 or more args
			strUserAccess = strSplit(1)

			If Int(strUserAccess) >= Int(strAccess) Then
				UnBanUser(strKick)
				Exit Sub
			ElseIf Int(strUserAccess) < Int(strAccess) Then
				'AddChat &H99CC00,"[ERROR] You do not have sufficient access to do that."
				AddQ "[ERROR] You do not have sufficient access to do that."
				Exit Sub
			End If	
			
		End If
		
	End If	
	
End Sub

Public Sub Event_Command(Command)

	FormatTag()
	
	If LCase(Command.Username) = LCase("[b]" & strChannelBotName) Then strCommandUsername = Command.Username
	
	If LCase(Command.Name) = "about" Then
	
		If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
			'AddChat &H99CC00,".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
			Command.Respond ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
			'AddQ ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
			Exit Sub
		Else
			'AddChat &H99CC00,".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
			Command.Respond ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
			'AddQ ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
			Exit Sub
		End If

	End If
	
	If LCase(Command.Name) = "whoami" Then

		strInfo = InfoUser(Command.Username, True)
		
		If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
			'AddChat &H99CC00, ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
			Command.Respond ".: StealthBot Beta v2.7 - Build 493 - Clan Management Script :."
			Exit Sub
		ElseIf strInfo = "" Then
			'AddChat &H99CC00, "[ERROR] No such user(s) found."
			Command.Respond "[ERROR] No such user(s) found."
			Exit Sub
		Else
			strSplit = Split(strInfo, " ") '2 or more args
			If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
			If strSplit(2) = "S" Then : strSafe = "safelisted" : Else : strSafe = "not safelisted" : End If
			'AddChat &H99CC00, "[INFO] " & strRank & " "" " & strSplit(0) & " "" is " & strSafe & " and has access of """ & strSplit(1) & """"
			Command.Respond "[INFO] " & strRank & " "" " & strSplit(0) & " "" is " & strSafe & " and has access of """ & strSplit(1) & """"
			Exit Sub
		End If
		
	End If

	If LCase(Command.Name) = "whois" Then
	
		If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
			strUser = Command.Args
		Else
			strSplit = Split(Command.Args, " ") '2 or more args
			strUser = strSplit(0)
		End If
		
		If strUser <> "" Then
		
			strInfo = InfoUser(strUser, True)
			If strInfo = "" Then
				'AddChat &H99CC00, "[ERROR] No such user(s) found."
				Command.Respond "[ERROR] No such user(s) found."
				Exit Sub
			Else
				strSplit = Split(strInfo, " ") '2 or more args
				If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
				If strSplit(2) = "S" Then : strSafe = "safelisted" : Else : strSafe = "not safelisted" : End If
				'AddChat &H99CC00, "[INFO] " & strRank & " "" " & strSplit(0) & " "" is " & strSafe & " and has access of """ & strSplit(1) & """"
				Command.Respond "[INFO] " & strRank & " "" " & strSplit(0) & " "" is " & strSafe & " and has access of """ & strSplit(1) & """"
				Exit Sub
			End If
			
		End If
		
	End If

	If LCase(Command.Name) = "safeadd" Then

		dbTimer.Enabled = False
		
		If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
			strUser = Command.Username
			strUsername = Command.Args
			strInfo = InfoUser(strUsername, True)
		Else
			strUser = Command.Username
			strSplit = Split(Command.Args, " ") '2 or more args
			strUsername = strSplit(0)
			strInfo = InfoUser(strUsername, True)
		End If

		strSplit = Split(strInfo, " ") '2 or more args
		If UBound(strSplit) > 2 Then
			If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
		Else
			strRank = "Username"
		End If
		
		If strInfo <> "" And strUsername <> "" Then
			If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
				Call SafeAddUser(strUsername,strSplit(1),"S",False)
				'AddChat &H99CC00, "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
				Command.Respond "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
				oldCRC = GetFileCRC32(users_list)
				newCRC = oldCRC
				dbTimer.Enabled = True
				ReloadSettings 1
				Exit Sub
			End If
		ElseIf strInfo = "" And strUsername <> "" Then
			If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
				Call SafeAddUser(strUsername,"0","S",False)
				'AddChat &H99CC00, "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
				Command.Respond "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
				oldCRC = GetFileCRC32(users_list)
				newCRC = oldCRC
				dbTimer.Enabled = True
				ReloadSettings 1
				Exit Sub
			End If
		End If
		
		isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
	
		If strInfo <> "" And strUsername <> "" Then
			Call SafeAddUser(strUsername,strSplit(1),"S",False)
			'AddChat &H99CC00, "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
			Command.Respond "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
			oldCRC = GetFileCRC32(users_list)
			newCRC = oldCRC
			dbTimer.Enabled = True
			ReloadSettings 1
			Exit Sub
		ElseIf strInfo = "" And strUsername <> "" Then
			Call SafeAddUser(strUsername,"0","S",False)
			'AddChat &H99CC00, "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
			Command.Respond "[ADDED] " & strRank & " "" " & strUsername & " "" to Clan " & clantag & " safelist."
			oldCRC = GetFileCRC32(users_list)
			newCRC = oldCRC
			dbTimer.Enabled = True
			ReloadSettings 1
			Exit Sub
		End If
		
	End If

	If LCase(Command.Name) = "safedel" Then
	
		dbTimer.Enabled = False

		If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
			strUser = Command.Username
			strUsername = Command.Args
			strInfo = InfoUser(strUsername, True)
		Else
			strUser = Command.Username
			strSplit = Split(Command.Args, " ") '2 or more args
			strUsername = strSplit(0)
			strInfo = InfoUser(strUsername, True)
		End If

		strSplit = Split(strInfo, " ") '2 or more args
		If UBound(strSplit) > 2 Then
			If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
		Else
			strRank = "Username"
		End If
		
		If strInfo <> "" And strUsername <> "" Then
			If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY			
				Call SafeAddUser(strUsername,strSplit(1),"%",False)
				'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
				Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
				oldCRC = GetFileCRC32(users_list)
				newCRC = oldCRC
				dbTimer.Enabled = True
				ReloadSettings 1
				Exit Sub
			End If
		ElseIf strInfo = "" And strUsername <> "" Then
			If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
				Call SafeAddUser(strUsername,"0","%",False)
				'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
				Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
				oldCRC = GetFileCRC32(users_list)
				newCRC = oldCRC
				dbTimer.Enabled = True
				ReloadSettings 1
				Exit Sub
			End If
		End If

		isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
		
		intRank = GetRankIndex(Command.Username)
		intSupRank = GetRankIndex(strUsername)
		
		If intSupRank = "" Then intSupRank = intRank + 1
		
		If intRank < intSupRank And strInfo = "" And strUsername <> "" Then
			Call SafeAddUser(strUsername,"0","%",False)	
			'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
			Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
			oldCRC = GetFileCRC32(users_list)
			newCRC = oldCRC
			dbTimer.Enabled = True
			ReloadSettings 1
			Exit Sub
		ElseIf intRank < intSupRank And strInfo <> "" And strUsername <> "" Then		
			Call SafeAddUser(strUsername,strSplit(1),"%",False)
			'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
			Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist."
			oldCRC = GetFileCRC32(users_list)
			newCRC = oldCRC
			dbTimer.Enabled = True
			ReloadSettings 1
			Exit Sub
		ElseIf intRank >= intSupRank Then
			'AddChat &H99CC00, "[ERROR] Cannot safedel " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist. " & strUser & " has a higher rank."
			Command.Respond "[ERROR] Cannot safedel " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " safelist. " & strUser & " has a higher rank."
			Exit Sub
		End If
		
	End If

	
	If LCase(Command.Name) = "members" Then
	
		If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
			
			intNumMembers = NumLines(members_list)
			strMembers = Split(ListMembers(), vbcrlf)

			For x = 0 To intNumMembers - 1
				'AddChat &H99CC00, strMembers(x)
				Command.Respond strMembers(x)
			Next
			
			Exit Sub
			
		End If
		
		isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
	
		intNumMembers = NumLines(members_list)
		strMembers = Split(ListMembers(), vbcrlf)

		For x = 0 To intNumMembers - 1
			'AddQ &H99CC00, strMembers(x)
			Command.Respond strMembers(x)
		Next
		
	End If
	
	If LCase(Command.Name) = "info" Then
	
		If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
		
			intNumMembers = NumMembers()
			If intOpenPos > 0 Then
				strOpenPos = Left(strOpenPos,Len(strOpenPos)-2) & "."
				'AddChat &H99CC00, "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members, and " & intOpenPos & " open recruiting positions: " & strOpenPos
				Command.Respond "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members, and " & intOpenPos & " open recruiting positions: " & strOpenPos
				Exit Sub
			Else
				'AddChat &H99CC00, "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members. Recruting currently closed."
				Command.Respond "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members. Recruting currently closed."
				Exit Sub
			End If
		
		End If
		
		isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
	
		intNumMembers = NumMembers()
		If intOpenPos > 0 Then
			strOpenPos = Left(strOpenPos,Len(strOpenPos)-2) & "."
			'AddChat &H99CC00, "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members, and " & intOpenPos & " recruiting positions: " & strOpenPos
			Command.Respond "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members, and " & intOpenPos & " recruiting positions: " & strOpenPos
			Exit Sub
		Else
			'AddChat &H99CC00, "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members. Recruting currently closed."
			Command.Respond "[INFO] Clan " & clantag & " currently has " & intNumMembers & " members. Recruting currently closed."
			Exit Sub
		End If
		
	End If
	
	If LCase(Command.Name) = "ranks" Then
	
		If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
		
			For x = LBound(clanranks) To UBound(clanranks)
				strMessage = strMessage & clanranks(x) & ", "
			Next
			strMessage = Left(strMessage,Len(strMessage)-2) & "."
			'AddChat &H99CC00, "[" & UBound(clanranks) + 1 &"] " & strMessage
			Command.Respond "[" & UBound(clanranks) + 1 &"] " & strMessage
			Exit Sub
		
		End If

		isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
	
		For x = LBound(clanranks) To UBound(clanranks)
			strMessage = strMessage & clanranks(x) & ", "
		Next
		strMessage = Left(strMessage,Len(strMessage)-2) & "."
		'AddChat &H99CC00, "[" & UBound(clanranks) + 1 &"] " & strMessage
		Command.Respond "[" & UBound(clanranks) + 1 &"] " & strMessage
		
	End If
	
	If LCase(Command.Name) = "add" Then

		dbTimer.Enabled = False
	
		If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
	
			If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
				'AddChat &H99CC00, "[ERROR] You must specify a username and clanrank."
				Command.Respond "[ERROR] You must specify a username and clanrank."
			Else
			
				strSplit = Split(Command.Args, " ") '2 or more args
				strUsername = strSplit(0)
				strSetRank = strSplit(1)
		
				If CheckTag(strUsername) = 1 And FindRank(strSetRank) <> "" Then
					If DelCMember(strUsername) = True Then
						Call AddCMember(strUsername, strSetRank)
						'AddChat &H99CC00, "[ADDED] "" " & strUsername & " "" as rank " & strSetRank & " to Clan " & clantag & " members list and safelist."
						Command.Respond "[ADDED] "" " & strUsername & " "" as rank " & strSetRank & " to Clan " & clantag & " members list and safelist."
						Call SafeAddUser(strUsername,"1","S",False)
						oldCRC = GetFileCRC32(users_list)
						newCRC = oldCRC
						dbTimer.Enabled = True
						ReloadSettings 1
					End If
				ElseIf FindRank(strSetRank) = "" Then
					'AddChat &H99CC00, "[ERROR] The clanrank you specified is not valid."	
					Command.Respond "[ERROR] The clanrank you specified is not valid."	
				ElseIf CheckTag(strUsername) = 0 Then
					'AddChat &H99CC00, "[ERROR] Cannot add member to Clan " & clantag & " members list. "" " & strUsername & " "" is not wearing our clan tag."
					Command.Respond "[ERROR] Cannot add member to Clan " & clantag & " members list. "" " & strUsername & " "" is not wearing our clan tag."
				End If
				
			End If
			
			Exit Sub
		
		End If

		isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
	
		If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
				'AddChat &H99CC00, "[ERROR] You must specify a username and clanrank."
				Command.Respond "[ERROR] You must specify a username and clanrank."
		Else
			
			strUser = Command.Username
			strSplit = Split(Command.Args, " ") '2 or more args
			strUsername = strSplit(0)
			strSetRank = strSplit(1)
			
			If CheckTag(strUser) = 1 And FindRank(strSetRank) <> "" Then
			
				strRankIndex = GetIndexOfRank(strSetRank)				
				strSupRank = GetRankIndex(strUser)
				
				If strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Then
					
					If strUserAccess >= strAccess And DelCMember(strUsername) = True Then
						Call AddCMember(strUsername, strSetRank)
						'AddChat &H99CC00, "[ADDED] "" " & strUsername & " "" as rank " & strSetRank & " to Clan " & clantag & " members list and safelist."
						Command.Respond "[ADDED] "" " & strUsername & " "" as rank " & strSetRank & " to Clan " & clantag & " members list and safelist."
						Call SafeAddUser(strUsername,"1","S",False)
						ReloadSettings 1
					End If
					
				ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
					'AddChat &H99CC00, "[ERROR] You cannot add a clan member to your same rank or higher."
					Command.Respond "[ERROR] You cannot add a clan member to your same rank or higher."
				End If

			ElseIf CheckTag(strUser) = 2 Then
				'AddChat &H99CC00, "[ERROR] Cannot add member to Clan " & clantag & " members list. The username "" " & strUsername & " "" is restricted. i.e Invalid special characters."
				Command.Respond "[ERROR] Cannot add member to Clan " & clantag & " members list. The username "" " & strUsername & " "" is restricted. i.e Invalid special characters."
			ElseIf FindRank(strSetRank) = "" Then
				'AddChat &H99CC00, "[ERROR] The clanrank you specified is not valid."	
				Command.Respond "[ERROR] The clanrank you specified is not valid."	
			ElseIf CheckTag(strUsername) = 0 Then
				'AddChat &H99CC00, "[ERROR] Cannot add member to Clan " & clantag & " members list. "" " & strUsername & " "" is not wearing our clan tag."
				Command.Respond "[ERROR] Cannot add member to Clan " & clantag & " members list. "" " & strUsername & " "" is not wearing our clan tag."
			End If
						
		End If
		
	End If
	
	If LCase(Command.Name) = "rem" Then
	
		dbTimer.Enabled = False
	
		If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
			strUser = Command.Username
			strUsername = Command.Args
			strInfo = InfoUser(strUsername, True)
		Else
			strUser = Command.Username
			strSplit = Split(Command.Args, " ") '2 or more args
			strUsername = strSplit(0)
			strInfo = InfoUser(strUsername, True)
		End If
		
		If strInfo <> "" Then
			strSplit = Split(strInfo, " ") '2 or more args
			strSafe = strSplit(2)
		Else
			'AddChat &H99CC00, "[ERROR] That user does not exist."
			Command.Respond "[ERROR] That user does not exist."
			Exit Sub
		End If

		If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
			If strSafe <> "S" Then
				strRank = GetRank(strUsername)		
				If DelCMember(strUsername) = True Then				
						strSplit = Split(strInfo, " ") '2 or more args
						If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
						Call RemUser(strUsername)			
						'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " members list and safelist."
						Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " members list and safelist."
						oldCRC = GetFileCRC32(users_list)
						newCRC = oldCRC
						dbTimer.Enabled = True
						ReloadSettings 1				
						Exit Sub	
					End If
				ElseIf strSafe = "S" Then
					'AddChat &H99CC00, "[ERROR] That user is safelisted."
					Command.Respond "[ERROR] That user is safelisted."
					Exit Sub
				End If
		End If

		isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
		
		strRank = GetRankIndex(strUser)
		strGetRank = GetRankIndex(strUsername)
		If strGetRank = "" Then strGetRank = strRank + 1
					
		If CheckTag(strUser) = 1 And strRank < strGetRank And strSafe <> "S" Then
			strRank = GetRank(strUsername)	
			If DelCMember(strUsername) = True Then		
				strSplit = Split(strInfo, " ") '2 or more args
				If strSplit(3) = "" Then : strRank = "Username" : Else : strRank = strSplit(3) & ":" : End If
				Call RemUser(strUsername)			
				'AddChat &H99CC00, "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " members list and safelist."
				Command.Respond "[REMOVED] " & strRank & " "" " & strUsername & " "" from Clan " & clantag & " members list and safelist."
				oldCRC = GetFileCRC32(users_list)
				newCRC = oldCRC
				dbTimer.Enabled = True
				ReloadSettings 1				
				Exit Sub	
			End If
		ElseIf CheckTag(strUser) = 1 And strRank < strGetRank And strSafe = "S" Then
			'AddChat &H99CC00, "[ERROR] That user is safelisted."
			Command.Respond "[ERROR] That user is safelisted."
			Exit Sub
		ElseIf CheckTag(strUser) = 2 Or strRank > strGetRank Then
			'AddChat &H99CC00, "[ERROR] You do not have sufficient access to do that."
			Command.Respond "[ERROR] You do not have sufficient access to do that."	
			Exit Sub
		End If
		
	End If
		
	If LCase(Command.Name) = "promote" Then

		If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
			strUsername = Command.Args
			strRankIndex = GetRankIndex(strUsername)
			strSupRank = GetRankIndex(Command.Username)		
		Else
			strSplit = Split(Command.Args, " ") '2 or more args
			strUsername = strSplit(0)
			strRankIndex = GetRankIndex(strUsername)
			strSupRank = GetRankIndex(Command.Username)
		End If
	
		If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
			strRank = GetRank(strUsername)
			PromoteCMember(strUsername)
			strNewRank = GetRank(strUsername)
			'AddChat &H99CC00, "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
			Command.Respond "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
			Exit Sub	
		End If
	
		isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
	
		If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
			strRank = GetRank(strUsername)
			PromoteCMember(strUsername)
			strNewRank = GetRank(strUsername)
			'AddChat &H99CC00, "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
			Command.Respond "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
			Exit Sub
		ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < (strRankIndex - 1) Then
			strRank = GetRank(strUsername)
			PromoteCMember(strUsername)
			strNewRank = GetRank(strUsername)
			'AddChat &H99CC00, "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
			Command.Respond "[PROMOTE] " & strRank & ": "" " & strUsername & " "" has been promoted to rank " & strNewRank
			Exit Sub
		ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
			'AddChat &H99CC00, "[ERROR] You cannot promote a clan member of same rank or higher."
			Command.Respond "[ERROR] You cannot promote a clan member of same rank or higher."
			Exit Sub
		ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= (strRankIndex - 1) Then
			'AddChat &H99CC00, "[ERROR] You cannot promote a clan member to the same rank or higher."
			Command.Respond "[ERROR] You cannot promote a clan member to the same rank or higher."
			Exit Sub
		ElseIf Command.Args = "" Then
			'AddChat &H99CC00, "[ERROR] You must specify a clan member to promote."
			Command.Respond "[ERROR] You must specify a clan member to promote."
			Exit Sub
		Else
			'AddChat &H99CC00, "[ERROR] The member you are trying to promote is not in Clan " & clantag & " members list."
			Command.Respond "[ERROR] The member you are trying to promote is not in Clan " & clantag & " members list."
		End If	
		
	End If	
	
	If LCase(Command.Name) = "demote" Then
	
		If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
			strUsername = Command.Args
			strRankIndex = GetRankIndex(strUsername)
			strSupRank = GetRankIndex(Command.Username)
		Else
			strSplit = Split(strArgs, " ") '2 or more args
			strUsername = strSplit(0)
			strRankIndex = GetRankIndex(strUsername)
			strSupRank = GetRankIndex(Username)
		End If
				
		If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
			strRank = GetRank(strUsername)
			DemoteCMember(strUsername)
			strNewRank = GetRank(strUsername)
			'AddChat &H99CC00, "[DEMOTE] " & strRank & ": "" " & strUsername & " "" has been demoted to rank " & strNewRank
			Command.Respond "[DEMOTE] " & strRank & ": "" " & strUsername & " "" has been demoted to rank " & strNewRank
			Exit Sub	
		End If
			
		isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
			
		If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
			strRank = GetRank(strUsername)
			DemoteCMember(strUsername)
			strNewRank = GetRank(strUsername)
			'AddChat &H99CC00, "[DEMOTE] " & strRank & ": "" " & strUsername & " "" has been demoted to rank " & strNewRank
			Command.Respond "[DEMOTE] " & strRank & ": "" " & strUsername & " "" has been demoted to rank " & strNewRank
			Exit Sub
		ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Then
			strRank = GetRank(strUsername)
			DemoteCMember(strUsername)
			strNewRank = GetRank(strUsername)
			'AddChat &H99CC00, "[DEMOTE] " & strRank & ": "" " & strUsername & " "" has been demoted to rank " & strNewRank
			Command.Respond "[DEMOTE] " & strRank & ": " & strUsername & " has been demoted to rank " & strNewRank
			Exit Sub
		ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Or LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
			'AddChat &H99CC00, "[ERROR] You cannot demote a clan member of same rank or higher."
			Command.Respond "[ERROR] You cannot demote a clan member of same rank or higher."
			Exit Sub
		ElseIf Command.Args = "" Then
			'AddChat &H99CC00, "[ERROR] You must specify a clan member to demote."
			Command.Respond "[ERROR] You must specify a clan member to demote."
			Exit Sub
		Else
			'AddChat &H99CC00, "[ERROR] The member you are trying to demote is not in Clan " & clantag & " members list."
			Command.Respond "[ERROR] The member you are trying to demote is not in Clan " & clantag & " members list."
		End If
		
	End If

	If LCase(Command.Name) = "open" Then

		If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
			strUser = Command.Username
			strSetRank = FindRank(Command.Args)
			strRankIndex = GetIndexOfRank(strSetRank)
			strSupRank = GetRankIndex(Command.Username)
		Else
			strUser = Command.Username
			strSplit = Split(strArgs, " ") '2 or more args
			strSetRank = FindRank(strSplit(0))
			strRankIndex = GetIndexOfRank(strSetRank)
			strSupRank = GetRankIndex(Username)
		End If
		
		If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
			Call AddCMember("(OPEN)", strSetRank)
			'AddChat &H99CC00, "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
			Command.Respond "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
			Exit Sub
		End If
	
		isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
					
		If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
			Call AddCMember("(OPEN)", strSetRank)
			'AddChat &H99CC00, "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
			Command.Respond "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
			Exit Sub
		ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Then
			Call AddCMember("(OPEN)", strSetRank)
			'AddChat &H99CC00, "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
			Command.Respond "[OPEN] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
			Exit Sub
		ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
			'AddChat &H99CC00, "[ERROR] You cannot open this recruiting position for Clan " & clantag & " you are not of a high enough rank."
			Command.Respond "[ERROR] You cannot open this recruiting position for Clan " & clantag & " you are not of a high enough rank."
			Exit Sub
		ElseIf Command.Args = "" Then
			'AddChat &H99CC00, "[ERROR] You must specify a clanrank recruiting position to open."
			Command.Respond "[ERROR] You must specify a clanrank recruiting position to open."
			Exit Sub
		Else
			'AddChat &H99CC00, "[ERROR] You specified an invalid clanrank recruiting position to open."
			Command.Respond "[ERROR] You specified an invalid clanrank recruiting position to open."
		End If	
		
	End If

	If LCase(Command.Name) = "close" Then
	
		If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
			strUser = Command.Username
			strSetRank = FindRank(Command.Args)
			strRankIndex = GetIndexOfRank(strSetRank)
			strSupRank = GetRankIndex(Command.Username)
		Else
			strUser = Command.Username
			strSplit = Split(strArgs, " ") '2 or more args
			strSetRank = FindRank(strSplit(0))
			strRankIndex = GetIndexOfRank(strSetRank)
			strSupRank = GetRankIndex(Username)
		End If
		
		If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
			If RemRankPos(strSetRank) = True Then
				'AddChat &H99CC00, "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
				Command.Respond "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
				Exit Sub
			End If
		End If

		isMember = GetRank(Command.Username) : If isMember = "" Then Exit Sub
		
		If strRankIndex <> "" And LCase(GetRank(Command.Username)) = LCase(clanranks(0)) Then
			If RemRankPos(strSetRank) = True Then
				'AddChat &H99CC00, "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
				Command.Respond "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
				Exit Sub
			End If
		ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank < strRankIndex Then
			If RemRankPos(strSetRank) = True Then
				'AddChat &H99CC00, "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
				Command.Respond "[CLOSED] "" " & strSetRank & " "" recruiting position to Clan " & clantag & " members list."
				Exit Sub
			End If
		ElseIf strRankIndex <> "" And strSupRank <> "" And strSupRank >= strRankIndex Then
			'AddChat &H99CC00, "[ERROR] You cannot close this recruiting position for Clan " & clantag & " you are not of a high enough rank."
			Command.Respond "[ERROR] You cannot close this recruiting position for Clan " & clantag & " you are not of a high enough rank."
			Exit Sub
		ElseIf Command.Args = "" Then
			'AddChat &H99CC00, "[ERROR] You must specify a clanrank recruiting position to close."
			Command.Respond "[ERROR] You must specify a clanrank recruiting position to close."
			Exit Sub
		Else
			'AddChat &H99CC00, "[ERROR] You specified an invalid clanrank recruiting position to close."
			Command.Respond "[ERROR] You specified an invalid clanrank recruiting position to close."
		End If	
		
	End If
	
	If LCase(Command.Name) = "dice" Then
	
		If InStr(1, Command.Args, " ", vbTextCompare) = 0 Then '0 or 1 arg
			intDice = Command.Args
		Else
			strSplit = Split(Command.Args, " ") '2 or more args
			intDice = Int(strSplit(0))
		End If

		If Command.Username = BotVars.Username Or (Command.Username = strCommandUsername  And Len(BotVars.Username) = lenAPIKEY) Then 'SC Remastered DOES NOT USE BotVars.Username i.e [B]Username , aka, APIKEY
			If intDice <> "" Then
				If IsNumeric(intDice) = True And Int(intDice) > 0 And Int(intDice) < 6 Then
					Randomize()
					strRolled = "Rolls dice: "
					For x = 1 To intDice
						theDice = Int((6 * Rnd) + 1)
						strRolled = strRolled & theDice & " "
					Next
					'AddChat &H99CC00, strRolled
					Command.Respond strRolled
					Exit Sub
				Else
					'AddChat &H99CC00, "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P "
					Command.Respond "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P "
					Exit Sub
				End If
			Else
				'AddChat &H99CC00, "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P "
				Command.Respond "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P "
				Exit Sub
			End If
		End If
		
		If intDice <> "" Then
			If IsNumeric(intDice) = True And Int(intDice) > 0 And Int(intDice) < 6 Then
				Randomize()
				strRolled = "Rolls dice: "
				For x = 1 To intDice
					theDice = Int((6 * Rnd) + 1)
					strRolled = strRolled & theDice & " "
				Next
				'AddChat &H99CC00, strRolled
				Command.Respond strRolled
				Exit Sub
			Else
				'AddChat &H99CC00, "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P "
				Command.Respond "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P "
				Exit Sub
			End If
		Else
			'AddChat &H99CC00, "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P "
			Command.Respond "You must roll 1-5 dice. LoL! Are you playing RISK? or YAHTZEE? :P "
		End If
				
	End If
	
End Sub

Function NumLines(strFile) 'Count words in a specific dictionary

	Dim objFile, strLine
	Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objFile= objFSO.OpenTextFile(strFile, 1)
	
	Do While Not objFile.AtEndOfStream
		strLine = objFile.readline 'Read line
		If strLine <> "" Then
			intNumLines = intNumLines + 1 'Count lines
		End If
	Loop
	
	objFile.Close 'Close file
	NumLines = intNumLines 'Exit function with number of lines in file

End Function

Public Sub SafeAddUser(strUsername, strAccess, strSafe, blnSendChat)

	dbTimer.Enabled = False

	Dim objReadFile, objWriteFile, strLine
	Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objReadFile= objFSO.OpenTextFile(users_list, 1)

	Do While Not objReadFile.AtEndOfStream
	
		intFilePos = Int(intFilePos) + 1
		intNumLines = NumLines(users_list)
		strLine = objReadFile.readline 'Read line
		
		If strLine <> "" Then
			strFile = strFile & strLine
			If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
		End If
			
		If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
			strSplit = Split(strLine, " ")
			strUser = strSplit(0)
			
			If LCase(strUser) = LCase(strUsername) Then
				intSetFilePos = Int(intFilePos)
				Exit Do
			End If
			
		End If
		
	Loop

	If intSetFilePos = "" Then
		intSetFilePos = NumLines(users_list) + 1
	End If
		
	objReadFile.Close 'Close file

	Set objWriteFile= objFSO.OpenTextFile(users_list, 2)
	strSplit = Split(strFile, vbcrlf)

	blnFound = False
	
	For x = LBound(strSplit) To UBound(strSplit)
		intCount = x + 1
		If intCount = intSetFilePos Then
			
			blnFound = True
			strNow = Now
			strDay = Day(strNow) : If Len(strDay) = 1 Then : strDay = "0" & strDay : End If
			strMonth = Month(strNow) : If Len(strMonth) = 1 Then : strMonth = "0" & strMonth : End If
			strYear = Year(strNow)
			strHour = Hour(strNow) : If Len(strHour) = 1 Then : strHour = "0" & strHour : End If
			strMinute = Minute(strNow) : If Len(strMinute) = 1 Then : strMinute = "0" & strMinute : End If
			strSecond = Second(strNow) : If Len(strSecond) = 1 Then : strSecond = "0" & strSecond : End If
			
			strTimeStamp = strMonth & "-" & strDay & "-" & strYear & "_" & strHour & ":" & strMinute & ":" & strSecond
					
			strWrite = strUsername & " " & strAccess & " " & strSafe & " <console> " & strTimeStamp & " <console> "  & strTimeStamp & " USER % %"
			objWriteFile.WriteLine(strWrite)

			'Username 1 S <console> mm-dd-yyyy_hh:mm:ss <console> mm-dd-yyyy_hh:mm:ss USER % %
			
		Else
			objWriteFile.WriteLine(strSplit(x))
		End If
	Next
	
	If blnFound = False Then

		strNow = Now
		strDay = Day(strNow) : If Len(strDay) = 1 Then : strDay = "0" & strDay : End If
		strMonth = Month(strNow) : If Len(strMonth) = 1 Then : strMonth = "0" & strMonth : End If
		strYear = Year(strNow)
		strHour = Hour(strNow) : If Len(strHour) = 1 Then : strHour = "0" & strHour : End If
		strMinute = Minute(strNow) : If Len(strMinute) = 1 Then : strMinute = "0" & strMinute : End If
		strSecond = Second(strNow) : If Len(strSecond) = 1 Then : strSecond = "0" & strSecond : End If
		
		strTimeStamp = strMonth & "-" & strDay & "-" & strYear & "_" & strHour & ":" & strMinute & ":" & strSecond
				
		strWrite = strUsername & " " & strAccess & " " & strSafe & " <console> " & strTimeStamp & " <console> "  & strTimeStamp & " USER % %"
		objWriteFile.WriteLine(strWrite)
	End If

	objWriteFile.Close 'Close file
	oldCRC = GetFileCRC32(users_list)
	newCRC = oldCRC
	ReloadSettings 1
	dbTimer.Enabled = True
	
End Sub

Public Sub RemUser(strUsername)

	dbTimer.Enabled = False

	Dim objReadFile, objWriteFile, strLine
	Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objReadFile= objFSO.OpenTextFile(users_list, 1)

	Do While Not objReadFile.AtEndOfStream
	
		intFilePos = intFilePos + 1
		intNumLines = NumLines(users_list)
		strLine = objReadFile.readline 'Read line
				
		If strLine <> "" Then
			strFile = strFile & strLine
			If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
		End If
		
		If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
			strSplit = Split(strLine, " ")
			strUser = strSplit(0)

			If LCase(strUser) = LCase(strUsername) Then
				blnNextRank = True
			ElseIf LCase(strUser) <> LCase(strUsername) And blnNextRank = True Then
				intSetFilePos = intFilePos - 1
				blnNextRank = False
			End If
			
		End If
		
	Loop

	objReadFile.Close 'Close file
	
	If intSetFilePos = "" Then
		intSetFilePos = NumLines(users_list)
	End If
		
	Set objWriteFile= objFSO.OpenTextFile(users_list, 2)
	strSplit = Split(strFile, vbcrlf)

	blnFound = False
	
	For x = LBound(strSplit) To UBound(strSplit)
		intCount = x + 1

		If intCount = intSetFilePos Then	
	
		Else
			objWriteFile.WriteLine(strSplit(x))
		End If
	Next

	objWriteFile.Close 'Close file
	
End Sub

Public Function InfoUser(strUsername, blnReturnVal)

	Dim objReadFile, objWriteFile, strLine
	Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objReadFile= objFSO.OpenTextFile(users_list, 1)

	intNumLines = NumLines(users_list)
	blnFoundUser = False
	
	Do While Not objReadFile.AtEndOfStream
	
		intFilePos = intFilePos + 1
		strLine = objReadFile.readline 'Read line
				
		If strLine <> "" Then
			strFile = strFile & strLine
			If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
		End If
			
		If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
		
			strSplit = Split(strLine, " ")
			strUser = strSplit(0)
			strAccess = strSplit(1)
			strSafe = strSplit(2)

			If LCase(strUser) = LCase(strUsername) Then
							
				blnFoundUser = True
				
				strRank = GetRank(strUser)
							
				If blnReturnVal = True Then
					InfoUser = strUser & " " & strAccess & " " & strSafe & " " & strRank
					Exit Do
				End If	
			
			End If
			
		End If
		
	Loop
				
	objReadFile.Close 'Close file
				
End Function

Public Function GetCmdAccess(strCommand)

	Dim objReadFile, strLine
	Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objReadFile= objFSO.OpenTextFile(BotPath() & "commands.xml", 1)

	Do While Not objReadFile.AtEndOfStream
	
		strLine = objReadFile.readline 'Read line
				
		If strLine <> "" Then
			strLine = Replace(strLine, " ", "")
			
			blnNotGot = True
			
			If(Left(strLine,14+Len(strCommand)) = "<commandname=""" & strCommand) Then
					
				Do Until Left(strLine,6) = "<rank>" And blnNotGot = True
					strLine = objReadFile.readline 'Read line
					strLine = Replace(strLine, " ", "")
				Loop
						
				strLine = Replace(strLine, "</rank>", "")
				strLine = Replace(strLine, "<rank>", "")
				strRank = strLine
				
				Do Until Left(strLine,6) = "<rank>" Or Left(strLine,10) = "</command>"
					strLine = objReadFile.readline 'Read line
					strLine = Replace(strLine, " ", "")
				Loop
				
				If Left(strLine,10) = "</command>" Then blnNotGot = False : Exit Do
				If Left(strLine,6) = "<rank>" Then

					strLine = Replace(strLine, "</rank>", "")
					strLine = Replace(strLine, "<rank>", "")
					strRank = strLine
				
				End If
				
			End If
			
		End If
	
	Loop
	
	objReadFile.Close 'Close file
	GetCmdAccess = strRank
	
End Function

Public Sub ResetCommands()

	Dim objReadFile, objWriteFile, strLine
	Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
	
	If objFSO.FileExists(cmds_list) Then 
	
		Set objReadFile= objFSO.OpenTextFile(cmds_list, 1)

		Do While Not objReadFile.AtEndOfStream

			intFilePos = intFilePos + 1
			intNumLines = NumLines(cmds_list)
			strLine = objReadFile.readline 'Read line
					
			If strLine <> "" Then
				strFile = strFile & strLine
				If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
			End If
			
		Loop
		
		objReadFile.Close
		
		Set objWriteFile= objFSO.OpenTextFile(BotPath & "commands.xml", 2)
		strSplit = Split(strFile, vbcrlf)
		
		For x = LBound(strSplit) To UBound(strSplit)
			objWriteFile.WriteLine(strSplit(x))
		Next
		
		objWriteFile.Close
		
		ReloadSettings 1
		AddChat &H99CC00, "[INFO] All bot commands reset - Clan Management Script"
		AddChat &H99CC00, "[INFO] ", vbYellow, BotPath & "commands.xml file created."
		AddChat vbRed, "[INFO] If you are using CAPIDAPTOR and an APIKEY, you MUST reconnect this bot to Battle.net or local commands WILL NOT WORK! Try using my other StealthBot script called CAPIDAPTOR.", vbWhite, " Usage( /autobot ) if installed."

	End If

End Sub

Public Sub KickUser(strUsername)
	Call Command(BotVars.Username,"/kick " & strUsername,True)
End Sub

Public Sub BanUser(strUsername)
	Call Command(BotVars.Username,"/ban " & strUsername,True)
End Sub

Public Sub UnBanUser(strUsername)
	Call Command(BotVars.Username,"/unban " & strUsername,True)
End Sub

Function PromoteCMember(strMember)
	
	strRankIndex = GetRankIndex(strMember)
	For x = LBound(clanranks) To UBound(clanranks)
		If x = strRankIndex - 1 Then
			If x <> LBound(clanranks) Then
				DelCMember(strMember)
				Call AddCMember(strMember, clanranks(x-1))
				Exit For
			End If
		End If
	Next
	
End Function

Function DemoteCMember(strMember)

	strRankIndex = GetRankIndex(strMember)
	For x = LBound(clanranks) To UBound(clanranks)
		If x = strRankIndex - 1 Then
			If x <> UBound(clanranks) Then
				DelCMember(strMember)
				Call AddCMember(strMember, clanranks(x+1))
				Exit For
			End If
		End If
	Next

End Function

Function AddCMember(strUser, strSetRank)

	Dim objReadFile, objWriteFile, strLine
	Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")

	For x = LBound(clanranks) To UBound(clanranks)
		If LCase(strSetRank) = LCase(clanranks(x)) Then
			strSetRank = clanranks(x)
			Exit For
		End If
	Next

	blnFoundPos = False
	
	Set objReadFile= objFSO.OpenTextFile(members_list, 1)
	Do While Not objReadFile.AtEndOfStream
		
		intFilePos = intFilePos + 1
		intNumLines = NumLines(members_list)
		strLine = objReadFile.readline 'Read line
				
		If strLine <> "" Then
			strFile = strFile & strLine
			If intNumLines <> intFilePos Then strFile = strFile & vbcrlf
		End If

		If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
			strSplit = Split(strLine, " ")
			strRank = Replace(strSplit(0),":","")
			strMember = strSplit(1) 'infile
			
			intRank = GetRankIndex(strMember) 'infile
			intSetRank = GetIndexOfRank(strSetRank) 'toset
			
			If intSetRank > intRank Then
				intSetFilePos = intFilePos
			End If
			
		End If
		
	Loop
	
	objReadFile.Close 'Close file

	If intSetFilePos = "" Then
		intSetFilePos = NumLines(members_list) + 1
	End If

	strSplit = Split(strFile, vbcrlf)

	blnFound = False
	
	Set objWriteFile= objFSO.OpenTextFile(members_list, 2)
	For x = LBound(strSplit) To UBound(strSplit)
		
		intCount = x + 1
		If intCount = intSetFilePos Then
			blnFound = True 'new 
			objWriteFile.WriteLine(strSplit(x))
			objWriteFile.WriteLine(strSetRank & ": " & strUser)
		Else
			objWriteFile.WriteLine(strSplit(x))
		End If	
	Next

	If blnFound = False Then

		objWriteFile.WriteLine(strSetRank & ": " & strUser)
	
	End If
	
	
	objWriteFile.Close 'Close file		
	
End Function

Function DelCMember(strMember)
	
	Dim objReadFile, objWriteFile, strLine
	Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objReadFile= objFSO.OpenTextFile(members_list, 1)
	
	blnWriteFile = False
	Do While Not objReadFile.AtEndOfStream
		strLine = objReadFile.readline 'Read line
		If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
			strSplit = Split(strLine, " ")
			If LCase(strSplit(1)) <> LCase(strMember) Then
				strFile = strFile & strLine & vbcrlf
			End If
			blnWriteFile = True
		End If
	Loop
	
	If blnWriteFile = True Then
		objReadFile.Close 'Close file
		Set objWriteFile= objFSO.OpenTextFile(members_list, 2)
		strSplit = Split(strFile, vbcrlf)
		For x = LBound(strSplit) To UBound(strSplit)
			If strSplit(x) <> "" Then
				objWriteFile.WriteLine(strSplit(x))
			End If
		Next
		DelCMember = True
	End If
	
End Function

Function RemRankPos(strRank)

	Dim objReadFile, objWriteFile, strLine
	Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objReadFile= objFSO.OpenTextFile(members_list, 1)
	
	blnWriteFile = False
	Do While Not objReadFile.AtEndOfStream
		strLine = objReadFile.readline 'Read line
		If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
			strSplit = Split(strLine, " ")
			strRankFind = Left(strSplit(0),Len(strSplit(0))-1)
			strUser = strSplit(1)
			If LCase(strRankFind) = LCase(strRank) And LCase(strUser) = LCase("(OPEN)") And blnWriteFile = False Then
				'Do Nothing
				blnWriteFile = True
			Else
				strFile = strFile & strLine & vbcrlf
			End If
		End If
	Loop
	
	If blnWriteFile = True Then
		objReadFile.Close 'Close file
		Set objWriteFile= objFSO.OpenTextFile(members_list, 2)
		strSplit = Split(strFile, vbcrlf)
		For x = LBound(strSplit) To UBound(strSplit)
			If strSplit(x) <> "" Then
				objWriteFile.WriteLine(strSplit(x))
			End If
		Next
		RemRankPos = True
	End If

End Function

Function FindRank(strRank)

	For x = LBound(clanranks) To UBound(clanranks)
		If LCase(strRank) = LCase(clanranks(x)) Then
			FindRank = clanranks(x)
			Exit For
		End If
	Next
	
End Function

Function GetTopRankUser()

	Dim objFile, strLine
	Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objFile= objFSO.OpenTextFile(members_list, 1)

	Do While Not objFile.AtEndOfStream
		strLine = objFile.readline 'Read line
		If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
			strSplit = Split(strLine," ")
			strRank = Left(strSplit(0),Len(strSplit(0))-1)
			If Lcase(strRank) = Lcase(clanranks(0)) Then
				GetTopRankUser = strSplit(1)
				Exit Function
			End If
		End If
	Loop
	
End Function

Function GetIndexOfRank(strRank)

	For x = LBound(clanranks) To UBound(clanranks)
		If LCase(strRank) = LCase(clanranks(x)) Then
			GetIndexOfRank = x + 1
			Exit For
		End If
	Next

End Function

Function GetRankIndex(strMember)

	Dim objFile, strLine
	Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objFile= objFSO.OpenTextFile(members_list, 1)

	Do While Not objFile.AtEndOfStream
		strLine = objFile.readline 'Read line
		If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
			strSplit = Split(strLine," ")
			If Lcase(strSplit(1)) = Lcase(strMember) Then
				strRankName = Left(strSplit(0),Len(strSplit(0))-1)
				Exit Do
			End If
		End If
	Loop	
	objFile.Close 'Close file
	
	For x = LBound(clanranks) To UBound(clanranks)
		If LCase(strRankName) = LCase(clanranks(x)) Then
			If strRankName = clanranks(x) Then
				GetRankIndex = x + 1
				Exit For
			End If
		End If
	Next	
	
End Function
	
Function GetRank(strMember)

	Dim objFile, strLine
	Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objFile= objFSO.OpenTextFile(members_list, 1)
	
	Do While Not objFile.AtEndOfStream
		strLine = objFile.readline 'Read line
		If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
			strSplit = Split(strLine," ")
			If Lcase(strSplit(1)) = Lcase(strMember) Then
				GetRank = Left(strSplit(0),Len(strSplit(0))-1)
				Exit Do
			End If
		End If
	Loop
	
	objFile.Close 'Close file
	
End Function

Function GetRankNum()

	For x = LBound(clanranks) To UBound(clanranks)
		strMessage = strMessage & clanranks(x) & ", "
	Next

End Function

Function NumMembers() 'Count words in a specific dictionary

	Dim objFile, strLine
	Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objFile= objFSO.OpenTextFile(members_list, 1)
	
	strOpenPos = ""
	intOpenPos = 0
	intNumLines = 0
	
	Do While Not objFile.AtEndOfStream
		strLine = objFile.readline 'Read line
		If strLine <> "" Then
			If LCase(Right(strLine, 6)) <> LCase("(OPEN)") Then
				intNumLines = intNumLines + 1 'Count lines
			Else
				intOpenPos = intOpenPos + 1
				strSplit = Split(strLine," ")
				strOpenPos = strOpenPos & Left(strSplit(0),Len(strSplit(0))-1) & ", "
			End If
		End If
	Loop
	
	objFile.Close 'Close file
	NumMembers = intNumLines 'Exit function with number of lines in file

End Function

Function ListMembers() 'Fetch a word from a specific dictionary

	Dim objFile, strLine
	Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objFile= objFSO.OpenTextFile(members_list, 1)
	
	intNumLines = 0
	Do While Not objFile.AtEndOfStream
		strLine = objFile.readline 'Read line
		If strLine <> "" Then
			intNumLines = intNumLines + 1
			strMembers = strMembers & "[" & intNumLines & "] " & strLine & vbcrlf
		End If
	Loop
	
	objFile.Close 'Close file
	ListMembers = strMembers 'Exit function with Members
	
End Function

Function FormatTag()
	intWilds = 0
	For x = 1 To Len(clantag)
		If Mid(clantag,x,1) = "*" Then
			intWilds = intWilds + 1
			If intWilds > 1 Then
			Else
				strTag = strTag & Mid(clantag,x,1)
			End If
		Else
			strTag = strTag & Mid(clantag,x,1)
		End If
	Next
	clantag = strTag
End Function

Function CheckTag(strUser)
	
	CheckTag = 0
	If InStr(1, clantag, "*") > 0 Then

		strSplitTag = Split(clantag,"*")
		intLeft = Len(strSplitTag(0))
		intRight = Len(strSplitTag(1))
		blnLeft = False : blnRight = False
		For x = 1 To Len(strUser)
			strFind = Mid(strUser,x,intLeft)
			If LCase(strFind) = LCase(strSplitTag(0)) Then blnLeft = True
			strFind = Mid(strUser,x,intRight)
			If LCase(strFind) = LCase(strSplitTag(1)) Then blnRight = True
		Next
		
		strLeftTag = Left(strUser,Len(strSplitTag(0)))
		lenLeftTag = Len(strLeftTag)
		strRightTag = Right(strUser,Len(strSplitTag(1)))
		lenRightTag = Len(strRightTag)
		strMember = Right(strUser, Len(strUser) - lenLeftTag)
		strMember = Left(strMember, Len(strMember) - lenRightTag)
		
		If Left(clantag,1)  = "*" Then
			strRestricted = Mid(clantag,2,1)
			If Right(strMember,1) = strRestricted Then CheckTag = 2 : Exit Function
		ElseIf Right(clantag,1)  = "*" Then
			strRestricted = Mid(clantag,Len(clantag)-1,1)
			If Left(strMember,1) = strRestricted Then CheckTag = 2 : Exit Function
		Else
			strRestricted1 = Right(strLeftTag,1)
			strRestricted2 = Left(strRightTag,1)
			If Left(strMember,1) = strRestricted1 Then CheckTag = 2 : Exit Function
			If Right(strMember,1) = strRestricted2 Then CheckTag = 2 : Exit Function
		End If
				
		If strMember <> Replace(clantag, "*", "") Then
			strMember = strSplitTag(0) & strMember & strSplitTag(1)
		Else
			CheckTag = 2 : Exit Function
		End If
		
		If LCase(strUser) = LCase(strMember) And blnLeft = True And blnRight = True Then CheckTag = 1

	End If
	
End Function

Public Function GetFileCRC32(FilePath)

	On Error Resume Next

    Dim oFSO: Set oFSO = CreateObject("Scripting.FileSystemObject")
    Dim oFile: Set oFile = oFSO.GetFile(FilePath)
	
    With oFile.OpenAsTextStream()
        Data = .Read(oFile.Size)
        .Close
    End With

	GetFileCRC32 = CRC32(Data)
	
End Function

Public Sub updateMembersList()

	dbTimer.Enabled = False

	Dim objFile, strLine
	Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
	
	Set objFile= objFSO.OpenTextFile(users_list, 1)
	Do While Not objFile.AtEndOfStream
		strLine = objFile.readline 'Read line
		If InStr(1, strLine, " ", vbTextCompare) > 0 Then '1 or more arg
			strSplit = Split(strLine," ")
			strUserFile = strUserFile & " " & strSplit(0)
		End If
	Loop
	objFile.Close 'Close file

	strSplit = Split(strUserFile, " ")
	
	For x = LBound(strSplit) To UBound(strSplit)
		strUser = strSplit(x)
		strRankOfUser = GetRank(strUser)
		If strUser <> "" And strRankOfUser = "" Then
			AddChat &H99CC00, "[INFO] A user appears to be added to bot using - User Database Manager - removing user."
			AddChat &H99CC00, "[INFO] Please use bot commands to add / remove users. i.e add, del, safeadd, safedel"
			AddQ "[INFO] A user appears to be added to bot using - User Database Manager - removing user."
			AddQ "[INFO] Please use bot commands to add / remove users. i.e add, del, safeadd, safedel"
			Call RemUser(strUser)
			Call DelCMember(strUser)
		End If
	Next

	oldCRC = GetFileCRC32(users_list)
	newCRC = oldCRC
	ReloadSettings 1
	dbTimer.Enabled = True
		
End Sub



commands.xml
<commands version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <command name="help" enabled="1">
    <aliases/>
    <documentation>
      <description>Provides additional information on a command such as the format, parameters, and a description of its function.</description>
      <specialnotes/>
    </documentation>
    <arguments>
      <argument name="command" type="word">
        <documentation>
          <description>The command you wish to retrieve information about.</description>
          <specialnotes/>
        </documentation>
      </argument>
      <argument name="scriptowner" optional="1">
        <documentation>
          <description>The script that this command is registered to.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="helprank" enabled="1">
    <aliases>
      <alias>helpr</alias>
      <alias>access</alias>
      <alias>list</alias>
      <alias>commands</alias>
    </aliases>
    <documentation>
      <description>Lists the commands available to users with the specified user access.</description>
      <specialnotes/>
    </documentation>
    <arguments>
      <argument name="access" type="numeric">
        <documentation>
          <description>The maximum rank you wish to find commands for.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="about" owner="Clan Moderation" enabled="1">
    <aliases>
      <alias>version</alias>
      <alias>ver</alias>
    </aliases>
    <documentation>
      <description>States the bot's version information.</description>
      <specialnotes/>
    </documentation>
    <arguments/>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="trigger" enabled="1">
    <aliases/>
    <documentation>
      <description>States the current string used for command identification.</description>
      <specialnotes>This command can be executed with the trigger '?', EXA: ?trigger</specialnotes>
    </documentation>
    <access>
      <rank>1</rank>
    </access>
  </command>   
  <command name="settrigger" enabled="1">
    <aliases/>
    <documentation>
      <description>Sets the bot's command identifier to the specified string.</description>
      <specialnotes/>
    </documentation>
    <arguments>
      <argument name="trigger" type="word">
        <documentation>
          <description>The command indentifier to set to.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="cq" enabled="1">
    <aliases/>
    <documentation>
      <description>Clears the outgoing chat message queue.</description>
      <specialnotes/>
    </documentation>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="time" enabled="1">
    <aliases/>
    <documentation>
      <description>States the current system time.</description>
      <specialnotes/>
    </documentation>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="uptime" enabled="1">
    <aliases/>
    <documentation>
      <description>States the current system and application operational times.</description>
      <specialnotes/>
    </documentation>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="autobot" owner="SC Remastered Bot API Helper" enabled="1">
    <aliases/>
    <documentation>
      <description>Automated SC Remastered Bot API Helper.</description>
      <specialnotes/>
    </documentation>
    <arguments/>
    <access/>
  </command>
  <command name="connect" enabled="1">
    <aliases/>
    <documentation>
      <description>Makes the bot attempt to connect to Battle.net</description>
      <specialnotes/>
    </documentation>
    <access/>
  </command>
  <command name="reconnect" enabled="1">
    <aliases>
      <alias>rc</alias>
    </aliases>
    <documentation>
      <description>Forces the bot to attempt to reconnect to the selected Battle.net server.</description>
      <specialnotes/>
    </documentation>
    <access/>
  </command>
  <command name="disconnect" enabled="1">
    <aliases/>
    <documentation>
      <description>Disconnects the bot from Battle.net.</description>
      <specialnotes/>
    </documentation>
    <access/>
  </command>
  <command name="rejoin" enabled="1">
    <aliases>
      <alias>rj</alias>
    </aliases>
    <documentation>
      <description>Makes the bot rejoin the current channel.</description>
      <specialnotes>This will cause the bot to gracefully join another channel and return. Uses the bot's chat queue, may be slow.</specialnotes>
    </documentation>
    <access/>
  </command>
  <command name="resign" token="operator" enabled="1">
    <aliases/>
    <documentation>
      <description>Forces the bot to resign from its status as a channel moderator.</description>
      <specialnotes/>
    </documentation>
    <access/>
  </command>
  <command name="des" token="operator" enabled="1">
    <aliases>
      <alias>designate</alias>
      <alias>designated</alias>
    </aliases>
    <documentation>
      <description>Designates a user to become an operator when the bot leaves the channel.</description>
      <specialnotes>The bot must have operator status in the channel.</specialnotes>
    </documentation>
    <arguments>
      <argument name="username" optional="1" type="word">
        <documentation>
          <description>The username to designate.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access/>
  </command>
  <command name="kick" enabled="1">
    <aliases/>
    <documentation>
      <description>Temporarily removes a user from the channel.</description>
      <specialnotes/>
    </documentation>
    <arguments>
      <argument name="username" type="word">
        <documentation>
          <description>The user to remove from the channel.</description>
          <specialnotes>The username may include wildcards.</specialnotes>
        </documentation>
        <restrictions>
          <shared-error/>
          <restriction name="SAFELIST_BYPASS" nonfatal="0">
            <documentation>
              <description/>
              <specialnotes/>
            </documentation>
            <match message="(,|&quot;)" case-sensitive="0"/>
            <error>You may not use " or , to override the safelist.</error>
            <access>
              <rank>1</rank>
            </access>
          </restriction>
        </restrictions>
      </argument>
      <argument name="Message" optional="1">
        <documentation>
          <description>The reason why this user was removed from the channel.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access/>
  </command>
  <command name="ban" enabled="1">
    <aliases/>
    <documentation>
      <description>Removes a user from the channel for the duration of the bot's role as a channel moderator.</description>
      <specialnotes/>
    </documentation>
    <arguments>
      <argument name="username" type="word">
        <documentation>
          <description>The name of the user to be banned.</description>
          <specialnotes>The username may include wildcards.</specialnotes>
        </documentation>
        <restrictions>
          <shared-error/>
          <restriction name="SAFELIST_BYPASS" nonfatal="0">
            <documentation>
              <description/>
              <specialnotes/>
            </documentation>
            <match message="(,|&quot;)" case-sensitive="0"/>
            <error>You may not use " or , to override the safelist.</error>
            <access>
              <rank>1</rank>
            </access>
          </restriction>
        </restrictions>
      </argument>
      <argument name="message" optional="1">
        <documentation>
          <description>The reason why this user was removed from the channel.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access/>
  </command>
  <command name="unban" token="operator" enabled="1">
    <aliases/>
    <documentation>
      <description>Unbans a user from the channel.</description>
      <specialnotes/>
    </documentation>
    <arguments>
      <argument name="username" optional="1" type="word">
        <documentation>
          <description>The name of the user to be unbanned.</description>
          <specialnotes>The username may include wildcards. If no user is specified, the most recently banned user will be assumed.</specialnotes>
        </documentation>
      </argument>
    </arguments>
    <access/>
  </command>
  <command name="banned" enabled="1">
    <aliases/>
    <documentation>
      <description>States all users that the bot has banned during the duration of its role as channel moderator.</description>
      <specialnotes/>
    </documentation>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="bancount">
    <aliases/>
    <documentation>
      <description>
        States the current number of users that have been banned from the channel.
      </description>
    </documentation>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="clearbanlist">
    <aliases>
      <alias>cbl</alias>
    </aliases>
    <documentation>
      <description>
        Clears the internal banlist. Used for ban evasion and unbanning wildcards.
      </description>
    </documentation>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="quit" enabled="1">
    <aliases/>
    <documentation>
      <description>Terminates the bot's execution.</description>
      <specialnotes/>
    </documentation>
    <access/>
  </command>
  <command name="enable">
    <aliases/>
    <documentation>
      <description>
        Enables the specified script.
      </description>
    </documentation>
    <arguments>
      <argument name="script" type="string">
        <documentation>
          <description>
            The name of the script you want to enable.
          </description>
        </documentation>
      </argument>
    </arguments>
    <access/>
  </command>
  <command name="disable">
    <aliases/>
    <documentation>
      <description>
        Disables the specified script.
      </description>
    </documentation>
    <arguments>
      <argument name="script" type="string">
        <documentation>
          <description>
            The name of the script you want to disable.
          </description>
        </documentation>
      </argument>
    </arguments>
    <access/>
  </command>
  <command name="clear" enabled="1">
    <aliases>
      <alias>cls</alias>
    </aliases>
    <documentation>
      <description>Clears all of the text in the bot's chat window.</description>
      <specialnotes/>
    </documentation>
    <access/>
  </command>
  <command name="vote">
    <aliases/>
    <documentation>
      <description>
        Initiates a tally of "yes" and "no" responses.
      </description>
    </documentation>
    <arguments>
      <argument name="duration" type="numeric">
        <documentation>
          <description>
            The duration of the voting session, in seconds.
          </description>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="cancel">
    <aliases/>
    <documentation>
      <description>
        Stops all votes that are currently in progress.
      </description>
    </documentation>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="tally">
    <aliases/>
    <documentation>
      <description>
        States the results for the most recent or currently active vote.
      </description>
    </documentation>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="addquote">
    <aliases/>
    <documentation>
      <description>
        Adds a quote to the quote database.
      </description>
    </documentation>
    <arguments>
      <argument name="quote" type="string">
        <documentation>
          <description>
            The quote to add.
          </description>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="quote">
    <aliases/>
    <documentation>
      <description>
        Returns a random quote from the quote database.
      </description>
    </documentation>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="setname" enabled="1">
    <aliases/>
    <documentation>
      <description>Sets a new username for the bot to use.</description>
      <specialnotes/>
    </documentation>
    <arguments>
      <argument name="username" type="word">
        <documentation>
          <description>The username to use next time you login.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access/>
  </command>
  <command name="setpass" enabled="1">
    <aliases/>
    <documentation>
      <description>Sets a new password for the bot to use.</description>
      <specialnotes/>
    </documentation>
    <arguments>
      <argument name="password">
        <documentation>
          <description>The password to use next time you login.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access/>
  </command>
  <command name="setserver" enabled="1">
    <aliases/>
    <documentation>
      <description>Sets a new Battle.net server for the bot to connect to.</description>
      <specialnotes/>
    </documentation>
    <arguments>
      <argument name="server" type="word">
        <documentation>
          <description>The server to use next time you login.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access/>
  </command>
  <command name="inbox" enabled="1">
    <aliases>
      <alias>getmail</alias>
      <alias>readmail</alias>
      <alias>mailread</alias>
    </aliases>
    <documentation>
      <description>Retrieves stored mail for the requesting user.</description>
      <specialnotes>The 'inbox' version can be used with the bot's trigger or, '!'. EXA: !inbox</specialnotes>
    </documentation>
    <access>
      <rank>0</rank>
    </access>
  </command>
  <command name="bmail" enabled="1">
    <aliases>
      <alias>mail</alias>
    </aliases>
    <documentation>
      <description>Stores a message for the specified user.</description>
      <specialnotes/>
    </documentation>
    <arguments>
      <argument name="recipient" type="word">
        <documentation>
          <description>The recipient of the message.</description>
          <specialnotes/>
        </documentation>
      </argument>
      <argument name="message">
        <documentation>
          <description>The message to be sent.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="checkmail" enabled="1">
    <aliases/>
    <documentation>
      <description>Returns the number of pending messages the user has.</description>
      <specialnotes/>
    </documentation>
    <access>
      <rank>0</rank>
    </access>
  </command>
  <command name="roll" enabled="1">
    <aliases/>
    <documentation>
      <description>Returns a random number between 0 and the specified value. (Defaults to 100)</description>
      <specialnotes/>
    </documentation>
    <arguments>
      <argument name="value" optional="1" type="numeric">
        <documentation>
          <description>The maximum value to roll.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="dice" owner="Clan Moderation" enabled="1">
    <aliases/>
    <documentation>
      <description>Rolls the dice x times.</description>
      <specialnotes/>
    </documentation>
    <arguments>
      <argument name="number_of_dice" type="number">
        <documentation>
          <description>Number of dice to roll.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="flip" enabled="1">
    <aliases/>
    <documentation>
      <description>Initiates a coin toss and states the results.</description>
      <specialnotes/>
    </documentation>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="owner">
    <aliases>
      <alias>master</alias>
    </aliases>
    <documentation>
      <description>
        States the owner of the bot.
      </description>
    </documentation>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="whois" owner="Clan Moderation" enabled="1">
    <aliases>
      <alias>find</alias>
    </aliases>
    <documentation>
      <description>Returns the specified user's rank and bot access.</description>
      <specialnotes/>
    </documentation>
    <arguments>
      <argument name="username" type="word">
        <documentation>
          <description>The username you would like to search.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="whoami" owner="Clan Moderation" enabled="1">
    <aliases/>
    <documentation>
      <description>Returns the requesting user's rank and bot access.</description>
      <specialnotes/>
    </documentation>
    <arguments/>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="safeadd" owner="Clan Moderation" enabled="1">
    <aliases/>
    <documentation>
      <description>Adds a safelist entry for a specifed user.</description>
      <specialnotes/>
    </documentation>
    <arguments>
      <argument name="username" type="word">
        <documentation>
          <description>The username you would like to safeadd.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="safedel" owner="Clan Moderation">
    <aliases/>
    <documentation>
      <description>Removes a safelist entry for a specifed user.</description>
    </documentation>
    <arguments>
      <argument name="username" type="word">
        <documentation>
          <description>The username you would like to safedel.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="add" owner="Clan Moderation" enabled="1">
    <aliases/>
    <documentation>
      <description>Add a clan member by rank.</description>
      <specialnotes/>
    </documentation>
    <arguments>
      <argument name="username" type="word">
        <documentation>
          <description>The username you would like to add.</description>
          <specialnotes/>
        </documentation>
      </argument>
      <argument name="rank" type="word">
        <documentation>
          <description>The rank to give to the user.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="rem" owner="Clan Moderation" enabled="1">
    <aliases>
      <alias>del</alias>
      <alias>remove</alias>
      <alias>delete</alias>
    </aliases>
    <documentation>
      <description>Remove users and clan members.</description>
      <specialnotes/>
    </documentation>
    <arguments>
      <argument name="username" type="word">
        <documentation>
          <description>The username you would like to remove.</description>
          <specialnotes/>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="members" owner="Clan Moderation" enabled="1">
    <aliases/>
    <documentation>
      <description>List all clan members by rank.</description>
      <specialnotes/>
    </documentation>
    <arguments/>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="info" owner="Clan Moderation" enabled="1">
    <aliases/>
    <documentation>
      <description>Lists the number of clan members and clan info.</description>
      <specialnotes/>
    </documentation>
    <arguments/>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="ranks" owner="Clan Moderation" enabled="1">
    <aliases/>
    <documentation>
      <description>List all clan ranks.</description>
      <specialnotes/>
    </documentation>
    <arguments/>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="promote" owner="Clan Moderation" enabled="1">
    <aliases/>
    <documentation>
      <description>Promote a clan member by one rank.</description>
      <specialnotes/>
    </documentation>
    <arguments/>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="demote" owner="Clan Moderation" enabled="1">
    <aliases/>
    <documentation>
      <description>Demote a clan member by one rank.</description>
      <specialnotes/>
    </documentation>
    <arguments/>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="open" owner="Clan Moderation" enabled="1">
    <aliases/>
    <documentation>
      <description>Open a clan rank recruting position.</description>
      <specialnotes/>
    </documentation>
    <arguments/>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="close" owner="Clan Moderation" enabled="1">
    <aliases/>
    <documentation>
      <description>Close a clan rank recruting position.</description>
      <specialnotes/>
    </documentation>
    <arguments/>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="greet">
    <aliases/>
    <documentation>
      <description>
        Enables, disables, or changes the settings of a welcome message.
      </description>
    </documentation>
    <arguments>
      <argument name="subcommand" type="word" optional="1">
        <documentation>
          <description>
            The subcommand to use, must be: 'on', 'off', 'whisper', 'status', or 'set'
          </description>
        </documentation>
      </argument>
      <argument name="value" type="string" optional="1">
        <documentation>
          <description>
            The whisper subcommand to use: 'on' or 'off'
          </description>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank></rank>
    </access>
  </command>
  <command name="idle">
    <aliases/>
    <documentation>
      <description>
        Enables or disables the use of idle messages.
      </description>
    </documentation>
    <arguments>
      <argument name="Enable" type="word" optional="1">
        <documentation>
          <description>
            'on', 'off', or 'toggle' to enable or disable the idle.
          </description>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank></rank>
    </access>
  </command>
  <command name="setidle">
    <aliases/>
    <documentation>
      <description>
        Sets a message to be sent to the channel at regular intervals.
      </description>
    </documentation>
    <arguments>
      <argument name="message" type="string">
        <documentation>
          <description>
            The message to be used.
          </description>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank></rank>
    </access>
  </command>
  <command name="idletime">
    <aliases>
      <alias>idlewait</alias>
    </aliases>
    <documentation>
      <description>
        Sets the time between idle messages, in minutes.
      </description>
    </documentation>
    <arguments>
      <argument name="delay" type="numeric">
        <documentation>
          <description>
            The number of minuets between each idle message.
          </description>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank></rank>
    </access>
  </command>
  <command name="lastseen">
    <aliases>
      <alias>allseen</alias>
    </aliases>
    <documentation>
      <description>
        States the last fifteen users that the bot has seen.
      </description>
    </documentation>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="lastwhisper">
    <aliases>
      <alias>lw</alias>
    </aliases>
    <documentation>
      <description>
        States the name of the user whom last privately messaged the bot.
      </description>
    </documentation>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="locktext">
    <aliases>
      <alias>lockchat</alias>
    </aliases>
    <documentation>
      <description>
        Disables the display of incoming chat messages.
      </description>
    </documentation>
    <access>
      <rank></rank>
    </access>
  </command>
  <command name="safecheck">
    <aliases/>
    <documentation>
      <description>
        States the safelist status of a specified user or tag.
      </description>
    </documentation>
    <arguments>
      <argument name="username" type="word">
        <documentation>
          <description>
            The username or group to check.
          </description>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="scripts">
    <aliases/>
    <documentation>
      <description>
        Lists the bot's currently loaded scripts.
      </description>
      <specialnotes>
        Names encased in parenthesis means the script is disabled.
      </specialnotes>
    </documentation>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="say">
    <aliases/>
    <documentation>
      <description>
        Echoes the specified phrase
      </description>
    </documentation>
    <arguments>
      <argument name="message" type="string">
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="shout">
    <aliases/>
    <documentation>
      <description>
        Echoes the specified phrase using all capital letters.
      </description>
    </documentation>
    <arguments>
      <argument name="message" type="string">
        <documentation>
          <description>
            SHOUT A MESSAGE.
          </description>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
  <command name="watch">
    <aliases/>
    <documentation>
      <description>
        Makes the specified user's name appear red inbot.
      </description>
      <specialnotes>
        The username specified may include wildcards.
      </specialnotes>
    </documentation>
    <arguments>
      <argument name="username" type="word">
        <documentation>
          <description>
            The name of the person you wish to watch.
          </description>
          <specialnotes>
            May contain wildcards
          </specialnotes>
        </documentation>
      </argument>
    </arguments>
    <access/>
  </command>
  <command name="watchoff">
    <aliases/>
    <documentation>
      <description>
        Stops watching for a user (they will no longer shop up as red).
      </description>
    </documentation>
    <access/>
  </command>
  <command name="whispercmds">
    <aliases>
      <alias>wc</alias>
    </aliases>
    <documentation>
      <description>
        Toggles or displays the use of private messaging as a means for delivering command responses.
      </description>
    </documentation>
    <arguments>
      <argument name="subcommand" type="word" optional="1">
        <documentation>
          <description>
            The subcommand to use: 'status', 'on', or 'off'
          </description>
        </documentation>
      </argument>
    </arguments>
    <access>
      <rank></rank>
    </access>
  </command>
  <command name="expand">
    <aliases>
      <alias>url</alias>
    </aliases>
    <arguments>
      <argument name="message" type="string">
    <documentation>
      <description>
        Echoes the specified phrase, placing a space after each character.
      </description>
    </documentation>
      </argument>
    </arguments>
    <access>
      <rank>1</rank>
    </access>
  </command>
</commands>



capidaptor.txt
Script("Name") 			= "SC Remastered Bot API Helper"
Script("Abbreviation")	= "SCRBAPIH"
Script("Author") 		= "Fpa-rF- and PsYChiC-rF-"
Script("Category")		= "Utility"
Script("Major")			= 1
Script("Minor")			= 0
Script("Revision")		= 1
Script("Description")	= "SC Remastered Bot API Helper"


' https://pastebin.com/8swA4uw3
' 
' SCRIPT COMMANDS
' ===============
' /autobot  - CONNECTS BOT USING CAPIDAPTOR

' SCRIPT SETTINGS
' ===============
'ENTER YOUR REQUIRED APIKEY (Get API key from email after /register-bot command in bnet chat)
Public apikey : apikey = ""

'https://davnit.net/projects/capidaptor/
'PATH TO CAPIDAPTOR EXE - MUST BE IN A WORKING DIRECTORY
Public capidaptor_path : capidaptor_path = "C:\PATH\TO\capidaptor.exe"

Sub connectTimer_Timer()
	connectTimer.Enabled = False
	Set wShell = CreateObject("WScript.Shell")
	statusCode = wShell.Run(capidaptor_path, 1, True)
End Sub

Public Sub Event_Load()
	
	CreateObj "LongTimer", "connectTimer"
	connectTimer.Interval = 1
	connectTimer.Enabled = False
	
	'DoEvents
	If OpenCommand("autobot") Is Nothing Then
 		With CreateCommand("autobot")
  			.Description = "SC Remastered Bot API Helper"
  			'.RequiredRank = 0
			.Save
		End With
	End If


End Sub

Public Sub Event_Command(Command)

	If LCase(Command.Name) = "autobot" Then
		AddChat &H99CC00, "Loading CAPIDAPTOR Bot - Please Wait"
		OpenCAPIDAPTOR()
		LoadAPIKey()
	End If
	
End Sub

Private Sub OpenCAPIDAPTOR()

	connectTimer.Enabled = True

End Sub

Private Sub LoadAPIKey()
	Call Command(BotVars.Username, "/setserver localhost", True)
	Call Command(BotVars.Username, "/setname " & apikey, True)
	Call Command(BotVars.Username, "/setpass nopassword", True)
	Call Command(BotVars.Username, "/connect", True)
End Sub


This post has been edited by Fpa: December 10, 2020 - 10:06 PM


#3 User is offline   Fpa Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: August-23 19

Posted December 11, 2020 - 03:09 AM

**FIXED A BUG USE THIS ONE NOT ONE ABOVE**

Replace line 323
If LCase(strCommand) = "list" Then



With

If LCase(strCommand) = "helprank" Or LCase(strCommand) = "helpr" Or LCase(strCommand) = "list" Or LCase(strCommand) = "commands" Or LCase(strCommand) = "access" Then



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