Telegram action modification

We make the modification at telegram add-on which allows us to receive messages. We have function checkTelegram, but when we try to access it by rules there are errors:

[ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule do checkTelegram every 2 seconds: An error occured during the script execution: The name 'checkTelegram(<XStringLiteralImpl>)' cannot be resolved to an item or type.

Any ideas?


import org.joda.time.*
import org.openhab.model.script.actions.Timer

var Timer timer
var message = ""

rule "do checkTelegram every 2 seconds"
    Time cron "0/2 * * * * ?"
    message = checkTelegram("bot3")
    if (message == "Hello")
        sendTelegram("bot3","Yo man")

// vim: syntax=Xtend