Removing an Alias from a command

Asked May 20, 2020·2 replies·Last activity 6 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.

Hi,

We use two different !song commands for the Nightbot song requests and the LastFM spotify lookup;

!editcom !song @$(touser) Current song: $(lastfm Andybrew3 "{{title}} by {{artist}}")
!editcom !song -a=!songs current

I am trying to make it so that other moderators that don't have access to the dashboard can make these changes.

Currently when I switch between these two commands the Alias from the Nightbot song request command stays so breaks the other command.

Is there a way to clear the alias through a chat command, or is there a better way of handeling this?

Preferably we want to keep the commands on the same command (and switch them) so that viewers don't have to work out which command to use.

Thanks
Shiftingfall

2 replies

Hey @Brisk Beetle!

I'm not sure how I would clear an alias, I tried a few things but I couldn't figure it out.

However, I have a solution for you:
Edit your !song command:

!editcom !song Display current song

Create a _lastfm command:

!addcom _lastfm @$(touser) Current song: $(lastfm Andybrew3 "{{title}} by {{artist}}")

Then when you edit !song, replace the alias with either _lastfm or !songs current according to what you want.
So if you want to get the songs playing from Spotify, use:

!editcom !song -a=_lastfm

And if you want to get the songs playing from the AutoDJ, use:

!editcom !song -a=!songs current

To make it even easier on your mods, you could create a command to switch the source so they don't have to type or copy/paste everything every time they have to switch, it would look like this:

!addcom !switch -ul=mod -a=!editcom !song $(eval q=decodeURIComponent(`$(querystring)`).toLowerCase();q.includes(`spotify`)?`-a=_lastfm`:q.includes(`autodj`)?`-a=!songs current`:`-a=_switcherror`)

To switch the source you'll simply have to type either !switch spotify or !switch autodj depending on what you want.

If you choose this option, please add the following command as well:

!addcom _switcherror Error: wrong !switch input. Use "spotify" or "autodj" only.

This worked great! Thanks for your help :)

slight_smile.png