|
Trying out Java. I am not good at Java at all. Just want a bot that responds to commands like "!r1" to then output "Rule 1, No spam" Need multiple lines but me being not so good I made this: import org.jibble.pircbot.*;
The first command works but anything after does not. It also can be used by anyone and should be op only. Hope someone can give me a bit of advise :) Jack, |
|
Its just a generic programming mistake. You have the second if inside the first if, meaning that you only check if the message is equal to "lol" if the message is equal to "hi", this just doesn't seem right ;) The right code would be:
or:
So you don't check the string again even after you already found your match. |
|
You really think it's that easy to detect spamm? What your script can do for you without any problems is censoring curse words. But if you actually try to take away spam via this method then you will have a massive class with way to many if-else statements which will be extremely slow. You can use regex to check for links and E-Mail address for spam at best but actually checking the message itself on everything in it is insane! You've added 'hi' to your list for 'Hello'. What if I were to say hey or 'what's up?' or even 'whats up' ? There are to many possibilities and after that you've got intended grammar mistakes like 'wahts up?' as if you've typed to fast. As you said you have very little experience with Java yet you are trying to write a script that is a intermediate task even for the professional developers. My suggestion would be to talk to a developer you know and get some help on this. If you read the question and the script you can see that all it does is say something. Nothing to get rid of spam simply a way to warn people. But no you are trying to be a smart ass and has gotten it all wrong trying to make me look stupid and in turn has made himself look like a fool. So "Just want a bot that responds to commands like "!r1" to then output "Rule 1, No spam"" doesn't mean you want to prevent spam? I'm confused.. @hasta_la_vitoria (cool name) made a good improvement but I stay with what I said, if you are going to do this in this way you will get a massive list of words to check through if you want to make it feel good to the user. And me making you look like a fool? Yeah pretty much, wasn't my intention though. Oh and "But no you are trying to be a smart ass and has gotten it all wrong trying to make me look stupid and in turn has made himself look like a fool." Am I making myself look like a fool for outsmarting you is is this "himself" someone else? |
