本文整理汇总了Java中org.pircbotx.hooks.events.ConnectEvent类的典型用法代码示例。如果您正苦于以下问题:Java ConnectEvent类的具体用法?Java ConnectEvent怎么用?Java ConnectEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConnectEvent类属于org.pircbotx.hooks.events包,在下文中一共展示了ConnectEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onConnect
import org.pircbotx.hooks.events.ConnectEvent; //导入依赖的package包/类
@Override
public void onConnect(ConnectEvent event)
{
try
{
Logging.info("Getting default channels");
Startup.setDefaultChans();
Logging.info("Joining default channels");
Core.bot.joinDefaults();
Logging.info("Connected to server");
}
catch(Exception e)
{
Logging.stackTrace(e);
}
}
示例2: onConnect
import org.pircbotx.hooks.events.ConnectEvent; //导入依赖的package包/类
@Override
public void onConnect(ConnectEvent<IdleBot> event) throws Exception {
IdleBot.botref.loadPlayers();
if (IdleBot.botref.findPlayer("IdleMaster") == null) {
IdleMaster i = new IdleMaster();
IdleBot.botref.getPlayersRaw().add(i);
IdleBot.botref.savePlayers(false);
i.loggedIn = true;
i.fromSerialize();
} else {
Player p = IdleBot.botref.findPlayer("IdleMaster");
IdleBot.botref.handleLogin(event.getBot().getUserBot(), p);
}
super.onConnect(event);
IdleBot.botref.generateMonsters();
}
示例3: onConnect
import org.pircbotx.hooks.events.ConnectEvent; //导入依赖的package包/类
@Override
public void onConnect(ConnectEvent event)
{
if (!ConfReader.getInstance().isIdentifyEnabled() ||
event.getBot().isNickservIdentified()) return;
event.getBot().send().identify(
ConfReader.getInstance().getNickserv_passwd());
}
示例4: onConnect
import org.pircbotx.hooks.events.ConnectEvent; //导入依赖的package包/类
@Override
public void onConnect(ConnectEvent<PircBotX> event) throws Exception {
if(event.getBot().getBotId() == 1) {
event.getBot().sendCAP().request("twitch.tv/membership");
event.getBot().sendCAP().request("twitch.tv/tags");
}
}
示例5: onConnect
import org.pircbotx.hooks.events.ConnectEvent; //导入依赖的package包/类
@Override
public void onConnect(ConnectEvent<PircBotX> event) throws Exception {
if (event.getBot().getBotId() == 1) {
event.getBot().sendCAP().request("twitch.tv/commands");
} else {
System.out.println("Bot started and joined " + Defaults.getStreamer() + "'s channel.\nPlease enjoy DuskBot");
MessageSending.sendNormalMessage("Bot started. Please enjoy Chirp/DuskBot");
if (!Objects.equals(Defaults.latestVersion(), Defaults.VERSION)) {
MessageSending.sendWhisper(Defaults.getStreamer(), "You are running " + Defaults.VERSION + ". But the latest version is " + Defaults.latestVersion() + ". Please consider updating.");
}
}
}
示例6: buildNewBot
import org.pircbotx.hooks.events.ConnectEvent; //导入依赖的package包/类
protected Bot buildNewBot(CountDownLatch latch) {
Configuration.Builder cfgb = new Configuration.Builder()
.setBotFactory(new BotFactory(){
@Override
public InputParser createInputParser(PircBotX bot) {
return new SkylarkInputParser(bot);
}
})
.setEncoding(CHARSET)
.setName(botName)
.setAutoNickChange(true)
.setMessageDelay(messageDelay)
.setCapEnabled(true)
.addCapHandler(new EnableCapHandler("extended-join", true))
.addCapHandler(new EnableCapHandler("account-notify", true))
.setAutoReconnect(true)
.addListener(new ListenerAdapter(){
@Override
public void onConnect(ConnectEvent event) throws Exception {
latch.countDown();
}
});
if (port == null)
cfgb.addServer(host);
else
cfgb.addServer(host, port);
PluginManager pluginManager = serverManager.app.pluginManager;
pluginManager.plugins.iterate(plugin -> {
if (plugin instanceof ListenerPlugin)
cfgb.addListener(((ListenerPlugin)plugin).listener);
});
return new Bot(cfgb.buildConfiguration(), this);
}
示例7: onConnect
import org.pircbotx.hooks.events.ConnectEvent; //导入依赖的package包/类
public void onConnect(ConnectEvent event) throws Exception {
String NickServCommand = DatabaseUtils.getNetwork(IRCUtils.getNetworkNameByNetwork(event.getBot())).getValue(NETWORKS.NICKSERVCOMMAND);
String NickServNick = DatabaseUtils.getNetwork(IRCUtils.getNetworkNameByNetwork(event.getBot())).getValue(NETWORKS.NICKSERVNICK);
if (NickServNick == null) {
NickServNick = "NickServ";
}
if (NickServCommand != null) {
event.getBot().sendRaw().rawLine("PRIVMSG " + NickServNick + " :" + NickServCommand);
}
TimeUnit.SECONDS.sleep(10);
Registry.messageQueue.get(event.getBot()).addAll(Arrays.asList(StringUtils.split(DatabaseUtils.getNetwork(IRCUtils.getNetworkNameByNetwork(event.getBot())).getValue(NETWORKS.CHANNELS), ", ")).stream().map(channel -> ("JOIN :" + channel)).collect(Collectors.toList()));
TimeUnit.SECONDS.sleep(10);
ListenerManager listenerManager = event.getBot().getConfiguration().getListenerManager();
listenerManager.getListeners().stream().filter(lis -> !(lis instanceof ConnectListener || lis instanceof CoreHooks)).forEach(listener->listenerManager.removeListener(listener));
listenerManager.addListener(new ChanMsgListener());
listenerManager.addListener(new PartListener());
listenerManager.addListener(new PrivMsgListener());
listenerManager.addListener(new KickListener());
listenerManager.addListener(new BanListener());
listenerManager.addListener(new JoinListener());
listenerManager.addListener(new FunMsgListener());
listenerManager.addListener(new RelayMsgListener());
listenerManager.addListener(new InviteListener());
listenerManager.addListener(new TellMsgListener());
listenerManager.addListener(new NoticeListener());
listenerManager.addListener(new ActionListener());
listenerManager.addListener(new CTCPListener());
IRCUtils.sendLogChanMsg(event.getBot(), "[Connection Successful]");
}
示例8: onConnect
import org.pircbotx.hooks.events.ConnectEvent; //导入依赖的package包/类
@Override
public void onConnect(ConnectEvent event) {
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss aa");
Date date = new Date();
String curTime = dateFormat.format(date);
logger.warning("ARADIABOT CONNECTED @ " + curTime);
email.sendEmail("[email protected]", "NOTICE: Aradiabot Connected", "Aradiabot connected to the server @ " + curTime);
}
示例9: onConnect
import org.pircbotx.hooks.events.ConnectEvent; //导入依赖的package包/类
/**
* When Geffy connects to IRC, join all channels listed in Reference.joinedChannels.
*/
public void onConnect(ConnectEvent event) throws Exception{
for(String channel : Reference.joinedChannels){
Geffy.bot.sendIRC().joinChannel(channel);
}
}
示例10: onConnect
import org.pircbotx.hooks.events.ConnectEvent; //导入依赖的package包/类
@Override
public void onConnect(ConnectEvent<AgarBot> event) {
log.info("Connected.");
}
示例11: onConnect
import org.pircbotx.hooks.events.ConnectEvent; //导入依赖的package包/类
@Override
public void onConnect(ConnectEvent<SlyBot> event) throws Exception {
//Start tasks that needs the bot to be connected
event.getBot().onConnected();
}
示例12: onConnect
import org.pircbotx.hooks.events.ConnectEvent; //导入依赖的package包/类
@Override
public void onConnect(ConnectEvent<PircBotX> event) throws Exception {
connectLatch.countDown();
getLog().debug("Connected to {} as {}", bot.getConfiguration().getServerHostname(),
bot.getConfiguration().getLogin());
}
示例13: onConnect
import org.pircbotx.hooks.events.ConnectEvent; //导入依赖的package包/类
@Override
public void onConnect(ConnectEvent<PircBotX> event) throws Exception {
super.onConnect(event);
// Enables whispers to be received
event.getBot().sendRaw().rawLineNow("CAP REQ :twitch.tv/commands");
}
示例14: onConnect
import org.pircbotx.hooks.events.ConnectEvent; //导入依赖的package包/类
@Override
public void onConnect(ConnectEvent<PircBotX> event) throws Exception {
super.onConnect(event); //To change body of generated methods, choose Tools | Templates.
}
示例15: onConnect
import org.pircbotx.hooks.events.ConnectEvent; //导入依赖的package包/类
@Override
public void onConnect(ConnectEvent event) {
logger.notice("CONNECTED TO SERVER");
}