Hier mal das Gerüst eines Teamspeak Bots.
Bei Fragen zur Installation gerne PM, jedoch werde ich hieraus keinen Guide machen.
Benutzt wird die Teamspeak API von TheHolyWaffle
package de.luqas.tsBot.Main;
import com.github.theholywaffle.teamspeak3.TS3Config;
import com.github.theholywaffle.teamspeak3.TS3Query;
import com.github.theholywaffle.teamspeak3.TS3Api;
import com.github.theholywaffle.teamspeak3.TS3Query.FloodRate;
import de.luqas.tsBot.Events.Event;
import java.util.logging.Level;
public class Load {
public static final TS3Config config = new TS3Config();
public static final TS3Query query = new TS3Query(config);
public static final TS3Api api = new TS3Api(query);
public static void main(String[] args) {
config.setHost("**.***.***.***");//Der Host des Teamspeak Servers
config.setFloodRate(FloodRate.UNLIMITED);
config.setDebugLevel(Level.ALL);
query.connect();
api.login("Username", "Password");//Query Login
api.selectVirtualServerByPort(9987);
api.setNickname("Bot");// Der TS Name vom Bot
Event.loadEvents();
System.out.println("Der Bot wurde gestartet!");//Konsolen Ausgabe
}
}
Alles anzeigen
package de.luqas.tsBot.Events;
import com.github.theholywaffle.teamspeak3.api.HostMessageMode;
import com.github.theholywaffle.teamspeak3.api.event.*;
import com.github.theholywaffle.teamspeak3.api.wrapper.Client;
import com.github.theholywaffle.teamspeak3.api.wrapper.VirtualServer;
import de.luqas.tsBot.Main.Load;
import sun.plugin2.message.TextEventMessage;
public class Event {
public static void loadEvents() {
Load.api.registerAllEvents();
Load.api.addTS3Listeners(new TS3Listener() {
@Override
public void onTextMessage(TextMessageEvent textMessageEvent) {
}
@Override
public void onClientJoin(ClientJoinEvent clientJoinEvent) {
Load.api.sendPrivateMessage(clientJoinEvent.getClientId(), "Willkommen auf unserem Teamspeak³ Server" + " " + clientJoinEvent.getClientNickname() + " ");
}
@Override
public void onClientLeave(ClientLeaveEvent clientLeaveEvent) {
}
@Override
public void onServerEdit(ServerEditedEvent serverEditedEvent) {
}
@Override
public void onChannelEdit(ChannelEditedEvent channelEditedEvent) {
}
@Override
public void onChannelDescriptionChanged(ChannelDescriptionEditedEvent channelDescriptionEditedEvent) {
}
@Override
public void onClientMoved(ClientMovedEvent clientMovedEvent) {
}
@Override
public void onChannelCreate(ChannelCreateEvent channelCreateEvent) {
}
@Override
public void onChannelDeleted(ChannelDeletedEvent channelDeletedEvent) {
}
@Override
public void onChannelMoved(ChannelMovedEvent channelMovedEvent) {
}
@Override
public void onChannelPasswordChanged(ChannelPasswordChangedEvent channelPasswordChangedEvent) {
}
@Override
public void onPrivilegeKeyUsed(PrivilegeKeyUsedEvent privilegeKeyUsedEvent) {
}
});
}
}
Alles anzeigen