Last active
August 29, 2015 14:07
-
-
Save Victorious3/85a0fd97e78906886baf to your computer and use it in GitHub Desktop.
A simple Chat Bot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package vic.bot.test; | |
import vic.mod.chat.api.bot.IBotHandler; | |
import vic.mod.chat.api.bot.IChannelBase; | |
import vic.mod.chat.api.bot.IChatBot; | |
import vic.mod.chat.api.bot.IChatEntity; | |
public class TestBot implements IChatBot | |
{ | |
public IBotHandler botHandler; | |
@Override | |
public void onLoad(IBotHandler handler) | |
{ | |
botHandler = handler; | |
} | |
@Override | |
public void onServerLoad() | |
{ | |
// TODO Auto-generated method stub | |
} | |
@Override | |
public void onServerUnload() | |
{ | |
// TODO Auto-generated method stub | |
} | |
@Override | |
public String getName() | |
{ | |
return "TestBot"; | |
} | |
@Override | |
public void onMessage(String message, IChatEntity sender, IChannelBase channel) | |
{ | |
botHandler.sendGlobalMessage("I just got a message by " + sender.getUsername() + "."); | |
botHandler.sendGlobalMessage("Here it is: " + message); | |
} | |
@Override | |
public void onPrivateMessage(String message, IChatEntity sender) | |
{ | |
botHandler.sendPrivateMessage(sender, "Hey!"); | |
} | |
@Override | |
public void onCommandMessage(String command, String[] args, String message) | |
{ | |
// TODO Auto-generated method stub | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment