Examples of how to do command input that will respond to Whispers, Chat, and InBot (/)
[size=]FoolOps:[/size]
'// Command Input Example
'// 1.0 - By Hero
Function Event_ParseCommand(Command, Rest, Username, Access, Inbot, Whispered)
'// Select a case of the command, convert it all to lowercase so that it is not case sensitive
Select Case LCase(Command)
Case "bye" '// If the command is bye
AddQ "Bye!" '// Send the text Bye! to battle.net
Case "hi", "hello" '// If the command is hi or hello
AddQ "Hi!" '// Send text to battle.net
Case "boot" '// If the command is boot
'// Let's kick this person
'// Check if they said a person to boot
If Args = vbNullString Then '// They didn't have arguments
'// Since they said nobody let's kick them
AddQ "/kick " & Username
Else '// They have arguments
AddQ "/kick " & Rest '// Kick the person they said
End If
Case "access" '// If the command is access
'// This command takes 10 access to use
If Access < 10 Then Exit Function '// They have less than 10 access. Exit the command input
AddQ "You have " & Access & " access."
End Select
End Function
[size=]Stealthbot:[/size]
'cmdex
'1.0
'&Command Input Example:Hero
'// Setup the events and have them call a CommandInput sub so that we can handle whispers, chat, and inbot all at once
Sub cmdex_Event_Usertalk(Username, Flags, Message, Ping)
Call cmdex_CommandInput(Username, Message, Flags, 1)
End SUb
Sub cmdex_Event_PressedEnter(Text)
Call cmdex_CommandInput(BotVars.Username, Text, botFlags, 4)
End Sub
Sub cmdex_Event_WhisperFromUser(Username, Flags, Message)
Call cmdex_CommandInput(Username, Message, Flags, 3)
End Sub
'// Command Input
Sub cmdex_CommandInput(Username, Text, Flags, Source)
'// Check for the trigger, exit if they didn't use it
If Left(Text, Len(BotVars.Trigger)) <> BotVars.Trigger Then Exit Sub
'// Get the arguments and cut off the trigger
Arg = Split(Mid(Text, Len(BotVars.Trigger) + 1))
'// Get the user's access
GetDBEntry Username, uAccess, uFlags
'// Select case that first word
Select Case LCase(Arg(0))
Case "bye" '// If the command is bye
Dsp Source, "Bye!", Username, vbGreen '// Send the text
Case "hi", "hello" '// If the command is hi or hello
Dsp Source, "Hi!", Username, vbGreen '// Send text
Case "boot" '// If the command is boot
'// Let's kick this person
'// Check if they said a person to boot
If Arg = vbNullString Then '// They didn't have arguments
'// Since they said nobody let's kick them
AddQ "/kick " & Username
Else '// They have arguments
AddQ "/kick " & Arg(1) '// Kick the person they said
End If
Case "access" '// If the command is access
'// This command takes 10 access to use
If uAccess < 10 Then Exit Sub '// They have less than 10 access. Exit the command input
Dsp Source, "You have " & Access & " access.", Username, vbGreen
End Select
End Sub