Discord Java Bot 没有响应

时间:2021-01-09 14:11:25

标签: java discord discord-jda

所以我的不和谐机器人不回复我的消息:/ 这是我的代码。也许你能帮我。

    public static JDA jda;
    public static String prefix = "+";
    
    // Main method
    public static void main(String[] args)  throws LoginException{
        
        jda = JDABuilder.createDefault(REDACTED).build();
        jda.getPresence().setStatus(OnlineStatus.DO_NOT_DISTURB);
        jda.getPresence().setActivity(Activity.watching("Im watching you"));
        
        jda.addEventListener(new Commands());
        
    }
}

命令监听器:

    public void onGuildMessageRecived(GuildMessageReceivedEvent event) {
        String[] args = event.getMessage().getContentRaw().split(" ");
        
        
        if(args[0].equalsIgnoreCase(Main.prefix + "info")) {
            
            event.getChannel().sendTyping().queue();
            event.getChannel().sendMessage("Started on 09.01.2021").queue();
            
            
        }
    }
}

1 个答案:

答案 0 :(得分:0)

是否扩展了 ListenerAdapter?

public class Commands extends ListenerAdapter {