Question with Bot & Presence and Roster

So I’m using the Botz lib to create a couple of bots. I’m using the following code to initialize the bot

BotzConnection messageBot = new BotzConnection(pr);

try {

// Create user and login

messageBot.login(botname);

Presence presence = new Presence();

presence.setStatus(“Available”);

presence.setShow(Presence.Show.chat);

messageBot.sendPacket(presence);

} catch (Exception e) {

Log.warn("Error creating bot: " + e.getMessage());

}

This works fine, the bot is logged in and shows up in the admin screen. But to to other users the Bot does not show up as availible. I’d like to do 2 things, first show correclty that the bot is online, 2 Accept all roster addition requests.

Can anyone point me in the right direction?

Thanks!

i think you have to implement a packet listener and react to packets, which ask the bot to be added to their roster. unfortunatly there’s no property of the bot where you can set something like setAutoAcceptAddRequests(true); so this could be a nice function to be added in the future (if anyoune of the developers reads this thread).

Yep you were correct I added these few lines to my procesIncoming packet function

if (packet instanceof Presence && ((Presence) packet).getType() == Presence.Type.subscribe ) {

Presence response = new Presence(Presence.Type.subscribed);

response.setTo(packet.getFrom());

bot.sendPacket(response);

}