jagrosh / MusicBot

🎶 A Discord music bot that's easy to set up and run yourself!
https://jmusicbot.com
Apache License 2.0
5.41k stars 2.58k forks source link

[Bug Report] Eval command not working #1175

Closed Yenaman closed 2 years ago

Yenaman commented 2 years ago

Bug Description

The eval command is not working, even though I have the setting enabled in the config file. It throws me an error in the console with every argument I pass to the command.

Here is the error:

java.lang.NullPointerException: Cannot invoke "javax.script.ScriptEngine.put(String, Object)" because "se" is null
        at com.jagrosh.jmusicbot.commands.owner.EvalCmd.execute(EvalCmd.java:45)
        at com.jagrosh.jdautilities.command.Command.run(Command.java:323)
        at com.jagrosh.jdautilities.command.impl.CommandClientImpl.onMessageReceived(CommandClientImpl.java:557)
        at com.jagrosh.jdautilities.command.impl.CommandClientImpl.onEvent(CommandClientImpl.java:445)
        at net.dv8tion.jda.api.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:96)
        at net.dv8tion.jda.internal.hooks.EventManagerProxy.handleInternally(EventManagerProxy.java:88)
        at net.dv8tion.jda.internal.hooks.EventManagerProxy.handle(EventManagerProxy.java:70)
        at net.dv8tion.jda.internal.JDAImpl.handleEvent(JDAImpl.java:160)
        at net.dv8tion.jda.internal.handle.MessageCreateHandler.handleInternally(MessageCreateHandler.java:123)
        at net.dv8tion.jda.internal.handle.SocketHandler.handle(SocketHandler.java:36)
        at net.dv8tion.jda.internal.requests.WebSocketClient.onDispatch(WebSocketClient.java:952)
        at net.dv8tion.jda.internal.requests.WebSocketClient.onEvent(WebSocketClient.java:839)
        at net.dv8tion.jda.internal.requests.WebSocketClient.handleEvent(WebSocketClient.java:817)
        at net.dv8tion.jda.internal.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:991)
        at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:385)
        at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:276)
        at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:996)
        at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:755)
        at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
        at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
        at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)

Steps to Reproduce

  1. Be the owner of the bot
  2. Do the eval command with the right prefix
  3. Watch the console

Expected Result

I expected to see the result of the eval command but instead I get an error.

Debug Output

System Properties:
  java.version = 17.0.3
  java.vm.name = OpenJDK 64-Bit Server VM
  java.vm.specification.version = 17
  java.runtime.name = OpenJDK Runtime Environment
  java.runtime.version = 17.0.3+7-Ubuntu-0ubuntu0.21.10.1
  java.specification.version = 17
  os.arch = amd64
  os.name = Linux

JMusicBot Information:
  Version = 0.3.8
  Owner = 326091067466448907
  Prefix = *
  AltPrefix = null
  MaxSeconds = 0
  NPImages = false
  SongInStatus = false
  StayInChannel = true
  UseEval = true
  UpdateAlerts = true

Dependency Information:
  JDA Version = 4.4.0_352
  JDA-Utilities Version = 3.0.5
  Lavaplayer Version = 1.3.78

Runtime Information:
  Total Memory = 37
  Used Memory = 18

Discord Information:
  ID = 887440390247047239
  Guilds = 7
  Users = 20

Additional Info

No response

Checklist

MichailiK commented 2 years ago

Duplicate of #933 (see my comment)