|
|||||||
![]() |
Forum Index > Jibble.org > PircBot | ||
messaging instead of giving command |
|||
| | | Printable Version |
|
acetolyne | ||||||||
|
hello Ive been looking hard for the answer to my question but cant seem to find it what Im trying to do is make a simple command that when the word "buzz" is put in the bot sends the line /sound snd/bell.au however a problem occurs instead of sending it thru the text area it simply displays it in chat not actually giving the command simply saying it to the channel heres my coding for the command I have tried sendRawLine and sendMessage Ive tried sendRawLine('channel'',"/sound snd/hello.au" channel with Nickserv and Chanserv still nothing anyone have examples or a site for resources that may help me solve this problem ty all help is much appriciated
if (message.equalsIgnoreCase("buzz" { sendMessage(channel',"/sound snd/hello.au" }
ALSO is it possible to search for a word inside of what the user inputs EXAMPLE when searching for the word buzz respond if they wrote "I wonder if I can BUZZ someone right now" make it respond because "buzz" was used inside a sentence? thx
|
![]() Newbie ![]() Status: offline
Registered: 01/17/10 |
||||||||
|
|||||||||
|
DeadEd | ||||||||
|
Hi I think that there may be a little confusion here - either in what you are doing or what I think you are trying to do - let's see ...
Are you expecting your bot to play a sound when you try to make it respond to "/sound snd/hello.au" ? Remember that this is an IRC API, not an IRC client. When you use a program such as mIRC and do something like "/j #deaded" it actually parses that user command and sends the correct command to the server with the IRC protocol. All of these "/" starting "commands" are not actual IRC commands, they are user friendly shortcuts and are implemented by that client. And for something like playing sounds, that is done on the client anyway. This means that you can check for "buzz" and then use some Java API to play a sound (as playing a sound on your client has nothing to do with the IRC protocol). Was this what you are trying to achieve?
As for the questions about finding words etc, then yes it is possible. With PircBot, a lot of the things you deal with are Strings and there are many methods available from the JDKs String class - contains() being one that you could use in this particular case.
If you want to see some simple, working, example bot code, then take a look at the PircBot Demos |
![]() Moderator Status: offline
Registered: 06/01/04 |
||||||||
|
|||||||||
|
acetolyne | ||||||||
|
Sorry for being unclear and ty for responding to my question:
YOU WROTE Are you expecting your bot to play a sound when you try to make it respond to "/sound snd/hello.au" ? Remember that this is an IRC API, not an IRC client. When you use a program such as mIRC and do something like "/j #deaded" it actually parses that user command and sends the correct command to the server with the IRC protocol. All of these "/" starting "commands" are not actual IRC commands, they are user friendly shortcuts and are implemented by that client. And for something like playing sounds, that is done on the client anyway.
Not expecting the bot to play the sound "sound snd/bell2.au is the specific command that does play a sound thu the irc server i use the coding was inside a onMessage(), statement thus when u type buss it sends the command "/sound snd/bell2.au"
YOU WROTE: When you use a program such as mIRC and do something like "/j #deaded" it actually parses that user command and sends the correct command to the server with the IRC protocol
yes this is what I need for it to actual parse the command instead of typing the command to the output screen seems the Pirc bot sends it to the output screen and does not parse it is there a way to do this without a pre added command like the one above? or is there a way to find this command somehow I have checked all documentation i could find for their commands and nothing like that so ide like a way to do it thru the Pirc bot Sorry for not making it so clear the first time hope it is clear what I am trying to achieve Also thank you for the link to the strings definitions very helpful
|
![]() Newbie Status: offline
Registered: 01/17/10 |
||||||||
|
|||||||||
|
Bo The Pro | ||||||||
Quote by: acetolyne
hello Ive been looking hard for the answer to my question but cant seem to find it what Im trying to do is make a simple command that when the word "buzz" is put in the bot sends the line /sound snd/bell.au however a problem occurs instead of sending it thru the text area it simply displays it in chat not actually giving the command simply saying it to the channel heres my coding for the command I have tried sendRawLine and sendMessage Ive tried sendRawLine('channel'',"/sound snd/hello.au" channel with Nickserv and Chanserv still nothing anyone have examples or a site for resources that may help me solve this problem ty all help is much appriciated
if (message.equalsIgnoreCase("buzz" { sendMessage(channel',"/sound snd/hello.au" }
ALSO is it possible to search for a word inside of what the user inputs EXAMPLE when searching for the word buzz respond if they wrote "I wonder if I can BUZZ someone right now" make it respond because "buzz" was used inside a sentence? thx
you answered, all of your questions in your own post.
for starts it sends the message when the word buzz is sent in the message because of this line if (message.equalsIgnoreCase("buzz" so everytime the word "buzz" is stated anything inside {} will be executed. so mainly you would probably want to do ".buzz" "!buzz" "@buzz" or anything along the lines of something that wouldnt normally be placed infront of that. and secondly it is being sent to the channel because of this line sendMessage(channel',"/sound snd/hello.au"
so for example say i want my bot to identify to the server when i say .botidentify
i would do public void onMessage(String channel, String sender, String login, String hostname, String message) { if (message.equalsIgnoreCase(".botidentify" sendMessage("NickServ", "INDENTIFY", "password" } }
any questions just ask
|
![]() Newbie Status: offline
Registered: 05/11/10 |
||||||||
|
|||||||||
|
|
| All times are CDT. The time is now 10:30 AM. |
|
|