简体   繁体   中英

Java IRC bot commands

So I'm trying to make an IRC bot in java, I am currently using the pircbot api. what i want is to be able to do a command like: !dl.exec (url of file) or !update (url of file) which would be the same as the first, but kills itself after execution.

when i try

if (message.equalsIgnoreCase("!dl.exec" +paramString1)){
}

it tells me "cannot find symbol variable paramString1"

if(message.toLowerCase().startsWith("!dl.exec"))
{
    String param = message.substring("!dl.exec".length() + 1);
}

This will check if the message starts with the command you are looking for. param is the substring of message that will contain the url

I found out you can also do:

if (message.toLowerCase().startsWith("!dl.exec.jar")){
    String[] args = message.split(" ");
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM