Bot bot;
synchronized (networkBots) {
if (!networkBots.contains(network.get(), channelMessageReceived.source().nick().get())) {
- bot = new Bot(network.get(), channelMessageReceived.source().nick().get());
+ bot = new Bot(network.get(), channelMessageReceived.channel(),
+ channelMessageReceived.source().nick().get());
networkBots.put(network.get(), channelMessageReceived.source().nick().get(), bot);
eventBus.post(new BotAdded(bot));
} else {
/** The network this bot is on. */
private final Network network;
+ private final String channel;
/** The packs this bot carries. */
private final Map<String, Pack> packs = Maps.newHashMap();
/** The current name of the bot. */
private String name;
- /**
- * Creates a new bot.
- *
- * @param network
- * The network the bot is on
- * @param name
- * The name of the bot
- */
- public Bot(Network network, String name) {
+ public Bot(Network network, String channel, String name) {
this.network = checkNotNull(network, "network must not be null");
+ this.channel = checkNotNull(channel, "channel must not be null");
this.name = checkNotNull(name, "name must not be null");
}
return network;
}
+ public String channel() {
+ return channel;
+ }
+
/**
* Returns the current name of this bot.
*