import discord4j.core.GatewayDiscordClient;
import discord4j.core.DiscordClientBuilder;
import discord4j.core.event.domain.lifecycle.ReadyEvent;
import discord4j.core.event.domain.message.MessageCreateEvent;
import discord4j.core.object.presence.*;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class disMCbot {
    private static final Logger logger = LogManager.getLogger(disMCbot.class);

    public static void main(String[] args) {
        logger.info("Starting Discord Bot...");
        String token = "MTIyNjY1NTgxODU0NDMxNjQxNw.GXAYvx.m2_ZmH-J5-iGhqdkW3M2VViG1wBQguKq-OjN80";

        GatewayDiscordClient client = DiscordClientBuilder.create(token).build().gateway().login().block();

        client.updatePresence(ClientPresence.online(ClientActivity.playing("Crafty Minecraft"))).subscribe();

        client.getEventDispatcher().on(ReadyEvent.class)
                .subscribe(ready -> {
                    System.out.println("Logged in as: " + ready.getSelf().getUsername());
                });

        client.getEventDispatcher().on(MessageCreateEvent.class)
                .subscribe(event -> {
                    String messageContent = event.getMessage().getContent();
                    if (messageContent.equalsIgnoreCase("!ping")) {
                        event.getMessage().getChannel().block().createMessage("Pong!").block();
                    }
                    // Add more commands as needed
                });

                client.onDisconnect().subscribe();

    }
    // Other methods and event listeners can be added as needed
}
