Closed KohGeek closed 10 months ago
First off: No, this is not a bug. This is an intended behavior.
What you're getting is exactly what the tag script is supposed to do.
!foo bar baz
means !foo
is the command/tag name rest of which are {args}
~ contains the entire message. {args}
== bar baz
, whereas {args(1)}
== bar
(just the first word) and so on.|
) and your command.Without going into more technicality, The rectified script would look something like this:
{{if({args(1)}==):c:pause|c:play {args}}}
- I shortened the check from every single argument you'd pass with
{if({args}==)
to a single 1 argument{if({args(1)}==)
. Which is what you should be doing as well.- I took the curly braces out of the commands (
{c:pause}
&{c:play}
) and placed them in a way where they won't get executed on their own and will only get executed depending on your passing argument.- I changed the
{c:play}
to{c:play {args}}
as this is what you're trying to do. To play any song named through your passing arguments. I usedargs
here as your search would be more than just 1 word or, argument.
That's it! As a side note, I'd highly encourage you to go through the documentation.
Hi, thank you for the speedy response, and for the listed rules and the sample code. I was staring at this documentation and none of the things you have listed are within this doc. Is the documentation found somewhere else?
Edit: Fixed the link so it wasn't actually just a 404 page of the doc.
Yep! That's the correct link you've got and about the rules; think of them as a handbook or guide. That's how tagscript works, every block has its own need, and its own set of rules (the way they work). Consider them thumb-rules to make your next custom-command.
I hope it helps and you're very welcome!
Filing this here, unsure if this is a bug or intended. First of all, thank you for forking and continuing the legacy of phen-cogs.
Code in question:
{if({args}==): {c:pause} | {c:play {args}}}
Expected behaviour: When argument is empty, the tag runs only pause command. When argument is not empty, it runs the play command with args.
Actual behaviour: Both command runs irregardless of args status.
System: Python 3.11.5 RedBot 3.5.5 Discord.py 2.3.2 Running on Raspberry Pi 4 on Raspberry Pi OS Bullseye 64-bit, headless