|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.elite.jdcbot.framework.DCIO
org.elite.jdcbot.framework.InputThreadTarget
org.elite.jdcbot.framework.jDCBot
org.elite.jdcbot.examples.ExampleBot
public class ExampleBot
ExampleBot is simple derived class from jDCBot apstract class overriding some methods. ExampleBot is example and start point for developing your bot. It shows how to overrides jDCBot methods and implements simple TimerThread which adds onTimer method.
Upon connecting, it will announce everyone on hub that it is present On private message, it will tell that it doesn't understand a word. Has +calc command on main chat that shows how to use WebPageFetcher and GoogleCalculation And will flood main chat every 10 min. showing how to use TimerThread class
Field Summary | |
---|---|
private StaticCommands |
static_cmds
|
private TimerThread |
tt
|
Fields inherited from class org.elite.jdcbot.framework.jDCBot |
---|
_botname, _conn_type, _description, _email, _hubname, _ip, _passive, _password, _port, _sharesize, downloadManager, log, shareManager, socket, socketServer, um, uploadManager, VERSION |
Constructor Summary | |
---|---|
ExampleBot()
|
Method Summary | |
---|---|
static void |
main(java.lang.String[] args)
|
void |
onConnect()
Prints on main chat that we are here and starts flood thread. |
void |
onDisconnect()
Called upon disconnecting from hub. |
void |
onPrivateMessage(java.lang.String user,
java.lang.String message)
Sends user who wants to talk to us a feedback that we're (still) stupid. |
void |
onPublicMessage(java.lang.String user,
java.lang.String message)
Simple example how to use GoogleCalculation and static commands from database. |
Methods inherited from class org.elite.jdcbot.framework.DCIO |
---|
parseCmdArgs, parseCmdName, parseRawCmd, ReadCommand, ReadCommand, SendCommand, SendCommand, set_IOExceptionMsg |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private TimerThread tt
private StaticCommands static_cmds
Constructor Detail |
---|
public ExampleBot()
Method Detail |
---|
public void onConnect()
onConnect
in class jDCBot
public void onPublicMessage(java.lang.String user, java.lang.String message)
onPublicMessage
in class jDCBot
user
- User who sent message.message
- Contents of the message.public void onPrivateMessage(java.lang.String user, java.lang.String message)
onPrivateMessage
in class jDCBot
user
- Name of user who sent us private message.message
- Contents of private message.public void onDisconnect()
jDCBot
The implementation of this method in the jDCBot abstract class resets the _inputThread to null hence when overridden super.onDisconnect() must be called first.
onDisconnect
in class jDCBot
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |