robinfriedli / aiode

Discord bot that plays Spotify tracks and YouTube videos or any URL including Soundcloud links and Twitch streams
Apache License 2.0
288 stars 73 forks source link

Targeting specific commands with help command not working #384

Closed PatchAlchemist closed 5 months ago

PatchAlchemist commented 5 months ago

Anytime I try to use the help command on specific commands i get this embed:

Exception IllegalArgumentException: URL must be a valid http(s) or attachment url. CommandContext ID: xxxxxxxxxxxxxxxxxxx

If I do it to a command that doesnt exist though I still get this embed:

Error No command found for 'h'

If you need help with a command you can use the help command. E.g. !help play

I believe the problem is here src/main/java/net/robinfriedli/aiode/command/commands/general/HelpCommand.java line 50

robinfriedli commented 5 months ago

Can you provide a stack trace? I can neither reproduce this nor see how line 50 is related to this exception

PatchAlchemist commented 5 months ago

ERROR 2024-04-12 14:52:28,204 [command-execution-CommandContext@13bacb2b-f7cb-455c-a401-802cd64fa3cb] net.robinfriedli.aiode.exceptions.ExceptionUtils Exception while handling command !help play on guild The Cord of Bosses net.robinfriedli.aiode.exceptions.CommandRuntimeException: java.lang.IllegalArgumentException: URL must be a valid http(s) or attachment url. at net.robinfriedli.aiode.command.interceptor.interceptors.CommandExecutionInterceptor.performChained(CommandExecutionInterceptor.java:152) at net.robinfriedli.aiode.command.interceptor.AbstractChainableCommandInterceptor.intercept(AbstractChainableCommandInterceptor.java:26) at net.robinfriedli.aiode.command.interceptor.AbstractChainableCommandInterceptor.intercept(AbstractChainableCommandInterceptor.java:36) at net.robinfriedli.aiode.command.interceptor.AbstractChainableCommandInterceptor.intercept(AbstractChainableCommandInterceptor.java:36) at net.robinfriedli.aiode.command.interceptor.AbstractChainableCommandInterceptor.intercept(AbstractChainableCommandInterceptor.java:36) at net.robinfriedli.aiode.command.interceptor.AbstractChainableCommandInterceptor.intercept(AbstractChainableCommandInterceptor.java:36) at net.robinfriedli.aiode.command.interceptor.AbstractChainableCommandInterceptor.intercept(AbstractChainableCommandInterceptor.java:36) at net.robinfriedli.aiode.command.interceptor.AbstractChainableCommandInterceptor.intercept(AbstractChainableCommandInterceptor.java:36) at net.robinfriedli.aiode.command.interceptor.AbstractChainableCommandInterceptor.intercept(AbstractChainableCommandInterceptor.java:36) at net.robinfriedli.aiode.command.interceptor.CommandInterceptorChain.intercept(CommandInterceptorChain.java:67) at net.robinfriedli.aiode.command.CommandManager.doRunCommand(CommandManager.java:137) at net.robinfriedli.aiode.concurrent.CommandExecutionTask.lambda$new$0(CommandExecutionTask.java:24) at net.robinfriedli.aiode.concurrent.QueuedTask.run(QueuedTask.java:38) at net.robinfriedli.aiode.concurrent.CommandExecutionTask.run(CommandExecutionTask.java:34) 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:833) Caused by: java.lang.IllegalArgumentException: URL must be a valid http(s) or attachment url. at net.dv8tion.jda.internal.utils.Checks.check(Checks.java:62) at net.dv8tion.jda.api.EmbedBuilder.urlCheck(EmbedBuilder.java:908) at net.dv8tion.jda.api.EmbedBuilder.setFooter(EmbedBuilder.java:799) at net.robinfriedli.aiode.command.widget.AbstractPaginationWidget.prepareEmbedBuilderForPage(AbstractPaginationWidget.java:114) at net.robinfriedli.aiode.command.widget.AbstractPaginationWidget.prepareInitialMessage(AbstractPaginationWidget.java:44) at net.robinfriedli.aiode.command.widget.AbstractWidget.initialise(AbstractWidget.java:109) at net.robinfriedli.aiode.command.commands.general.HelpCommand.lambda$showCommandHelp$1(HelpCommand.java:125) at java.base/java.util.Optional.ifPresentOrElse(Optional.java:196) at net.robinfriedli.aiode.command.commands.general.HelpCommand.showCommandHelp(HelpCommand.java:50) at net.robinfriedli.aiode.command.commands.general.HelpCommand.doRun(HelpCommand.java:45) at net.robinfriedli.aiode.command.interceptor.interceptors.CommandExecutionInterceptor.performChained(CommandExecutionInterceptor.java:61) ... 16 common frames omitted

I referenced line 50 because the help command seems to work until it tries to showCommandHelp() on line 50

robinfriedli commented 5 months ago

You need to looker higher up in the stack trace, line 50 is where it calls the lambda containing the entire help command logic. It gets up to here: at net.robinfriedli.aiode.command.commands.general.HelpCommand.lambda$showCommandHelp$1(HelpCommand.java:125) where it then fails at net.robinfriedli.aiode.command.widget.AbstractPaginationWidget.prepareEmbedBuilderForPage(AbstractPaginationWidget.java:114). This is because the logoUrl is invalid because your configuration for the property aiode.server.base_uri is wrong. Normally this is initially set to http://localhost:8000, which isn't reachable publicly of course (so there won't be a footer logo) but is a valid URL that doesn't cause an error.

PatchAlchemist commented 5 months ago

You were correct I used the wrong syntax for my aiode.server.base_uri !