Store a bot’s channel.
[xudocci.git] / src / main / java / net / pterodactylus / xdcc / core / Core.java
index 10cb06d..d4e5155 100644 (file)
@@ -184,7 +184,7 @@ public class Core extends AbstractExecutionThreadService {
                return networkConnections.entrySet().stream().map((entry) -> {
                        Network network = entry.getKey();
                        Collection<Bot> bots = networkBots.row(network).values();
-                       int packCount = bots.stream().mapToInt((bot) -> bot.packs().size()).reduce((a, b) -> a + b).getAsInt();
+                       int packCount = bots.stream().mapToInt((bot) -> bot.packs().size()).reduce((a, b) -> a + b).orElse(0);
                        return new ConnectedNetwork(network, entry.getValue().hostname(),
                                        entry.getValue().port(), entry.getValue().nickname(),
                                        channels.stream()
@@ -586,7 +586,7 @@ public class Core extends AbstractExecutionThreadService {
                if (channelNotJoined.reason() == banned) {
                        channelBanManager.ban(channel.get());
                        eventBus.post(new GenericMessage(
-                                       format("Banned from %s, suspending join for  day.",
+                                       format("Banned from %s, suspending join for a day.",
                                                        channel.get())));
                        return;
                }
@@ -739,7 +739,8 @@ public class Core extends AbstractExecutionThreadService {
                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 {