public class Telegram extends BasicSense
Modifier and Type | Field and Description |
---|---|
static int |
MAX_WAIT |
static org.owasp.html.PolicyFactory |
sanitizer |
conversations, DAY, DEFAULT_SPEAKER, engaged, HOUR, MAX_FILE_SIZE, MINUTE, RETRY
Modifier and Type | Method and Description |
---|---|
void |
awake()
Start sensing.
|
void |
checkAutoPost()
Auto post.
|
long |
checkMessage(net.sf.json.JSONObject message,
long last,
long max,
Network network)
Reply to the message.
|
void |
checkMessages()
Check messages and reply.
|
void |
checkProfile()
Auto post to channel.
|
void |
checkRSS()
Check RSS feed.
|
void |
connect(java.lang.String webhook)
Register the webhook for the bot for real-time messages.
|
void |
disconnect()
Remove the webhook to disable realtime messages.
|
boolean |
getAutoPost() |
int |
getAutoPostHours() |
java.util.List<Vertex> |
getAutoPosts(Network network) |
java.lang.String |
getChannel() |
boolean |
getCheckMessages() |
Language.LanguageState |
getGroupMode() |
int |
getMaxFeed() |
int |
getMessagesProcessed() |
java.util.List<java.lang.String> |
getPostRSS() |
int |
getPosts() |
java.lang.String |
getProfileName() |
boolean |
getRealtimeMessages() |
java.util.List<java.lang.String> |
getRssKeywords() |
boolean |
getStripButtonText() |
java.lang.String |
getToken() |
boolean |
getTrackMessageObjects() |
java.lang.String |
getUserId() |
java.lang.String |
getUserName() |
void |
initProperties()
Load settings.
|
void |
inputSentence(java.lang.String text,
Vertex user,
java.lang.String botUserName,
Vertex conversation,
java.lang.String messageId,
boolean group,
net.sf.json.JSONObject message,
Network network)
Process the text sentence.
|
void |
message(Vertex source,
Vertex conversationOrUserId,
Vertex text)
Self API
Send a message to the user.
|
void |
output(Vertex output)
Output the status or direct message reply.
|
void |
post(java.lang.String text,
java.lang.String id) |
void |
post(Vertex source,
Vertex sentence) |
Vertex |
postJSON(java.lang.String url,
Vertex paramsObject,
Network network)
Call a generic Telegram web API.
|
Vertex |
postJSON(Vertex source,
Vertex url,
Vertex params)
Self API.
|
java.lang.String |
processMessage(net.sf.json.JSONObject message,
Network memory) |
java.lang.String |
sanitize(java.lang.String text) |
void |
saveProperties(java.util.List<java.lang.String> autoPosts) |
void |
sendMessage(java.lang.String text,
java.lang.String replyUser,
java.lang.String conversationOrUserId,
java.lang.String command)
Send a message to the user.
|
void |
sendMessage(Vertex source,
Vertex text,
Vertex conversationOrUserId)
Self API
Send a message to the user.
|
void |
sendMessage(Vertex source,
Vertex text,
Vertex conversationOrUserId,
Vertex command)
Self API
Send a message to the user.
|
void |
setAutoPost(boolean autoPost) |
void |
setAutoPostHours(int autoPostHours) |
void |
setChannel(java.lang.String channel) |
void |
setCheckMessages(boolean checkMessages) |
void |
setGroupMode(Language.LanguageState groupMode) |
void |
setMaxFeed(int maxFeed) |
void |
setMessagesProcessed(int messagesProcessed) |
void |
setPostRSS(java.util.List<java.lang.String> postRSS) |
void |
setPosts(int posts) |
void |
setProfileName(java.lang.String profileName) |
void |
setRealtimeMessages(boolean realtimeMessages) |
void |
setRssKeywords(java.util.List<java.lang.String> rssKeywords) |
void |
setStripButtonText(boolean stripButtonText) |
void |
setToken(java.lang.String token) |
void |
setTrackMessageObjects(boolean trackMessageObjects) |
void |
setUserId(java.lang.String userId) |
void |
setUserName(java.lang.String userName) |
addListener, checkEngaged, checkSentence, discover, discoverSentence, getAction, getBot, getEmotionalState, getLanguageState, getListeners, getName, getPrimitive, getResponseListener, getShortTermMemory, initialize, input, input, isEnabled, log, log, log, migrateProperties, notifyExceptionListeners, notifyResponseListener, pool, printInput, removeListener, saveProperties, setAction, setBot, setEmotionalState, setIsEnabled, setLanguageState, setName, setResponseListener, shutdown, toString
public static org.owasp.html.PolicyFactory sanitizer
public static int MAX_WAIT
public boolean getTrackMessageObjects()
public void setTrackMessageObjects(boolean trackMessageObjects)
public Language.LanguageState getGroupMode()
public void setGroupMode(Language.LanguageState groupMode)
public java.lang.String getChannel()
public void setChannel(java.lang.String channel)
public int getMaxFeed()
public void setMaxFeed(int maxFeed)
public int getMessagesProcessed()
public void setMessagesProcessed(int messagesProcessed)
public int getPosts()
public void setPosts(int posts)
public java.lang.String getProfileName()
public void setProfileName(java.lang.String profileName)
public boolean getStripButtonText()
public void setStripButtonText(boolean stripButtonText)
public java.util.List<java.lang.String> getRssKeywords()
public void setRssKeywords(java.util.List<java.lang.String> rssKeywords)
public boolean getAutoPost()
public void setAutoPost(boolean autoPost)
public int getAutoPostHours()
public void setAutoPostHours(int autoPostHours)
public void awake()
awake
in interface Sense
awake
in class BasicSense
public void initProperties()
public void saveProperties(java.util.List<java.lang.String> autoPosts)
public void connect(java.lang.String webhook) throws java.lang.Exception
java.lang.Exception
public void disconnect() throws java.lang.Exception
java.lang.Exception
public void checkProfile()
public void checkMessages()
public java.lang.String processMessage(net.sf.json.JSONObject message, Network memory)
public long checkMessage(net.sf.json.JSONObject message, long last, long max, Network network)
public void checkRSS()
public void checkAutoPost()
public void output(Vertex output)
output
in interface Sense
output
in class BasicSense
public java.lang.String sanitize(java.lang.String text)
public Vertex postJSON(java.lang.String url, Vertex paramsObject, Network network)
public Vertex postJSON(Vertex source, Vertex url, Vertex params)
public void sendMessage(java.lang.String text, java.lang.String replyUser, java.lang.String conversationOrUserId, java.lang.String command)
public void message(Vertex source, Vertex conversationOrUserId, Vertex text)
public void sendMessage(Vertex source, Vertex text, Vertex conversationOrUserId)
public void sendMessage(Vertex source, Vertex text, Vertex conversationOrUserId, Vertex command)
public java.lang.String getUserName()
public void setUserName(java.lang.String userName)
public java.lang.String getUserId()
public void setUserId(java.lang.String userId)
public void inputSentence(java.lang.String text, Vertex user, java.lang.String botUserName, Vertex conversation, java.lang.String messageId, boolean group, net.sf.json.JSONObject message, Network network)
public java.lang.String getToken()
public void setToken(java.lang.String token)
public boolean getCheckMessages()
public void setCheckMessages(boolean checkMessages)
public boolean getRealtimeMessages()
public void setRealtimeMessages(boolean realtimeMessages)
public java.util.List<java.lang.String> getPostRSS()
public void setPostRSS(java.util.List<java.lang.String> postRSS)
public void post(java.lang.String text, java.lang.String id)