kr45732 / skyblock-plus

Source code for the Skyblock Plus Discord Bot
https://skyblock-plus.vercel.app
GNU Affero General Public License v3.0
25 stars 5 forks source link

Error #364

Closed WertypasEstudios closed 3 months ago

WertypasEstudios commented 3 months ago

Hello, I am having two problems when starting the bot. The first one is in the Main class error;

17:01:20.212 main Main

            ERROR  Exception while initializing constants
         java.lang.IllegalStateException: Not a JSON Object: 404
        at com.google.gson.JsonElement.getAsJsonObject(JsonElement.java:165)
          at com.skyblockplus.utils.Constants.initialize(Constants.java:1397)
       at com.skyblockplus.Main.main(Main.java:86)
         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:91)
    at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:53)
    at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:58)

`

The second one is with recipeSlashCommand error;

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 17:01:37.004 main SpringApplicati ERROR Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'recipeSlashCommand' defined in URL [jar:nested:/home/container/SkyblockPlus-0.0.1.jar/!BOOT-INF/classes/!/com/skyblockplus/miscellaneous/RecipeSlashCommand.class]: Failed to instantiate [com.skyblockplus.miscellaneous.RecipeSlashCommand]: Constructor threw exception at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1319) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1204) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:962) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) at com.skyblockplus.Main.main(Main.java:92) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:91) at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:53) at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:58) Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.skyblockplus.miscellaneous.RecipeSlashCommand]: Constructor threw exception at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:221) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:88) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1313) ... 22 common frames omitted Caused by: java.lang.NullPointerException: Cannot invoke "com.google.gson.JsonObject.entrySet()" because the return value of "com.skyblockplus.utils.utils.JsonUtils.getInternalJsonMappings()" is null at com.skyblockplus.miscellaneous.RecipeSlashCommand.<init>(RecipeSlashCommand.java:50) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:195) ... 24 common frames omitted

kr45732 commented 3 months ago

What is your "DATA_REPO_GITHUB‎" set to in your DevSettings? Seems like it isn't able to access your data repo.

WertypasEstudios commented 3 months ago

yes it was that, but now I get this error when running /networth:

java.lang.IllegalArgumentException: Formatting Code may not be null
    at net.dv8tion.jda.internal.utils.Checks.notNull(Checks.java:86)
    at net.dv8tion.jda.internal.utils.Checks.notEmpty(Checks.java:92)
    at net.dv8tion.jda.api.entities.emoji.Emoji.fromFormatted(Emoji.java:153)
    at com.skyblockplus.utils.utils.Utils.getEmojiObj(Utils.java:352)
    at com.skyblockplus.miscellaneous.networth.NetworthExecute.getPages(NetworthExecute.java:358)
    at com.skyblockplus.miscellaneous.networth.NetworthExecute.getPlayerNetworth(NetworthExecute.java:248)
    at com.skyblockplus.miscellaneous.networth.NetworthExecute.getPlayerNetworth(NetworthExecute.java:136)
    at com.skyblockplus.miscellaneous.networth.NetworthSlashCommand.execute(NetworthSlashCommand.java:47)
    at com.skyblockplus.utils.command.AbstractSlashCommand.lambda$run$1(AbstractSlashCommand.java:132)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:840)

It also no longer lets me execute dev commands like +ev, nothing comes out when I send it, I have my owner id and trying with dev: true and false

kr45732 commented 3 months ago

yes it was that, but now I get this error when running /networth:

java.lang.IllegalArgumentException: Formatting Code may not be null
  at net.dv8tion.jda.internal.utils.Checks.notNull(Checks.java:86)
  at net.dv8tion.jda.internal.utils.Checks.notEmpty(Checks.java:92)
  at net.dv8tion.jda.api.entities.emoji.Emoji.fromFormatted(Emoji.java:153)
  at com.skyblockplus.utils.utils.Utils.getEmojiObj(Utils.java:352)
  at com.skyblockplus.miscellaneous.networth.NetworthExecute.getPages(NetworthExecute.java:358)
  at com.skyblockplus.miscellaneous.networth.NetworthExecute.getPlayerNetworth(NetworthExecute.java:248)
  at com.skyblockplus.miscellaneous.networth.NetworthExecute.getPlayerNetworth(NetworthExecute.java:136)
  at com.skyblockplus.miscellaneous.networth.NetworthSlashCommand.execute(NetworthSlashCommand.java:47)
  at com.skyblockplus.utils.command.AbstractSlashCommand.lambda$run$1(AbstractSlashCommand.java:132)
  at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
  at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
  at java.base/java.lang.Thread.run(Thread.java:840)

That error is caused by IdToEmojiMappings missing the mapping for the "SKYBLOCK_MENU" emoji. You need to either set up the custom emojis or remove the use of custom emojis in the code.

It also no longer lets me execute dev commands like +ev, nothing comes out when I send it, I have my owner id and trying with dev: true and false

Do other prefix commands work? If not, is the message content intent enabled in both the Discord Developer Portal and in the bot's code?

WertypasEstudios commented 3 months ago

Okay, everything's solved now. The issue with prefix commands was because I hadn't enabled the "message content intent" in the code hahaha.