!v alias for !volume that does NOT set to 0 when query is null

Asked Sep 25, 2022·2 replies·Last activity 3 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Saw this in a previous post

`!addcom !v -a=!volume $(query)`

But if you type !v on its own it will set your volume to 0.

Would prefer that a null result tells you the current volume. Tinkered around with the following code but it wasn't sticking:

`$(eval x=$(query);for('$(query)' === 'null' ? ''))`

2 replies

Hey @Amiable Wolf!

When empty, $(query) doesn't give you null, but an empty string. You can test that by adding the following command and calling it with no argument:

!addcom !test This is a $(query) test

Nightbot won't answer with "This is a null test," but with "This is a test" because $(query) is empty.

However, $(1) gives you null when empty.

With all that said, your original command works just fine for what you're looking for:

!addcom !v -a=!volume $(query)
Kd9xW6GUDE.png

Excellent, I had been tweaking the command that had previously used $(1)

Everything mentioned is true and perfect, thank you!