public class MultiBotManager extends Object
Lifecycle:
start()
is called, all queued bots are connected. Any bots
added after this point are automatically connectedstop()
is called, OutputIRC.quitServer()
is called
on all bots. No more bots can be added, the Manager is finished. Note that an
optional stopAndWait()
method is provided to block until all bots
shutdown
executeBot(org.pircbotx.PircBotX)
is overridable if you wish
to do your own connectingConstructor and Description |
---|
MultiBotManager()
Create MultiBotManager with a cached thread pool.
|
MultiBotManager(ExecutorService botPool)
Create MultiBotManager with the specified thread pool.
|
Modifier and Type | Method and Description |
---|---|
void |
addBot(Configuration config)
|
void |
addBot(PircBotX bot)
Alias of
addNetwork(org.pircbotx.PircBotX) |
void |
addNetwork(Configuration config)
Adds a managed bot using the specified configuration.
|
void |
addNetwork(PircBotX bot)
Adds a bot to be managed.
|
<B extends PircBotX> |
getBotById(int id)
Lookup a managed bot by id.
|
com.google.common.collect.ImmutableSortedSet<PircBotX> |
getBots()
Get all the bots that this MultiBotManager is managing.
|
void |
start()
Start the manager, connecting all queued bots.
|
void |
stop()
Stop with no quit message
|
void |
stop(String quitMessage)
Disconnect all bots from their respective severs cleanly.
|
void |
stopAndWait()
stop() and wait for all bots to disconnect. |
public MultiBotManager()
public MultiBotManager(ExecutorService botPool)
botPool
- A provided thread pool.public void addBot(Configuration config)
config
- addNetwork(org.pircbotx.Configuration)
public void addNetwork(Configuration config)
config
- A configuration to pass to the created botpublic void addBot(PircBotX bot)
addNetwork(org.pircbotx.PircBotX)
bot
- addNetwork(org.pircbotx.PircBotX)
public void addNetwork(PircBotX bot)
bot
- An existing unconnected botpublic void start()
public void stop()
stop(java.lang.String)
public void stop(String quitMessage)
public void stopAndWait() throws InterruptedException
stop()
and wait for all bots to disconnect.InterruptedException
- If this is interrupted while waitingpublic com.google.common.collect.ImmutableSortedSet<PircBotX> getBots()
public <B extends PircBotX> B getBotById(int id)
id
- The id of the botCopyright © 2010–2020 Leon Blakey. All rights reserved.