+1  A: 

You need to pass the return value of myURL.WebURL(myArray) to send messgae

String myURLString = myURL.WebURL(myArray);
sendMessage(channel, myURLString);

The error message is quite correct - they're usually quite helpful and are almost always very clear about type errors.

Robert Christie
+1  A: 

Well myURL is not a string it is an MyBot. You need to assgin the result of calling myURL.WebURL(myArray); to a String variable and use that to call sendMessage();:

if (message.startsWith("!def ")) {
    String[] myArray = new String[2];   
    myArray[0] = message;
    MyBot myURL = new MyBot();
    String myURLString = myURL.WebURL(myArray);
    sendMessage(channel, myURLString);
}
Tendayi Mawushe
+2  A: 

myUrl is a type MyBot from the line:

MyBot myURL = new MyBot();

If you change the next lines from:

myURL.WebURL(myArray);
sendMessage(channel, myURL);

to:

String actualUrl = myURL.WebURL(myArray);
sendMessage(channel, actualUrl);

it should work

EDIT: If you're throwing an exception from myURL.WebUrl(myArray), enclose it in a try/catch block:

String actualUrl = null;
try {
    actualUrl = myURL.WebURL(myArray);
} catch (Exception e) {
    actualUrl = "Something default";
}
Quotidian
+1  A: 

Try changing from

myURL.WebURL(myArray);
sendMessage(channel, myURL);

to this:

sendMessage(channel, myURL.WebURL(myArray));

Your WebURL method returns a String value, but you aren't doing anything with it. Instead, you're passing the myURL object itself, which is why the compiler is telling you the "cannot be applied to (java.lang.String,MyBot)" message. It's saying that you're passing something of type MyBot to something that requires a String.

Jonathon