Aliasing in Nightbot

Asked May 15, 2022·4 replies·Last activity 4 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.

I am trying to make a dynamic Rank update command,

currently it is:
!rank
XXX is currently Rank: $(rankupdate)
Alias: $rankupdate

!rankupdate
G1

When I run !rank, it just says G1, instead of saying:
xxx is currently Rank: G1

I have a bit of bash experience, so this shouldn't be this hard, am I missing a symbol?

4 replies

Hey @Plucky Owl!

I'm sorry, but what are you talking about?
What is this rank command about? Nightbot doesn't have a $(rankupdate) variable. Don't even know what G1 means?
Don't assume we know what you're talking about when you open a topic, we aren't in your head, instead, be specific (link expired)!

Nightbot doesn't run Bash, but JavaScript.

I am trying to make a dynamic updatable command.
I want for an administrator to be able to run the !updaterank command and change it to a different set of characters (b1 s1 s2 g1), but all it would do is update variable in the constant in the command.

The values in !updaterank are not important, whats important is that when someone types in !rank
it would output xxx user's rank is currently: valueof(!rankupdate).

Instead the output has been just:
!rankupdate

Ultimately I am trying to add a string to the end of a command, without it clearing the entire message.

Ah, I see, you want to store a value inside a command, right?

This isn't possible without editing the entire command, Nightbot doesn't have a memory, it can't save values inside variables, so it doesn't have constants, it just runs code when called.

So here's the solution I can offer (you just need to copy/paste the code fields in your chat):
!rankupdate, you call it like this !rankupdate [rank], so for example !rankupdate G1:

!addcom !rankupdate -ul=mod -a=!editcom !rank $(user) → $(channel)'s rank currently is: $(query)

!rank:

!addcom !rank $(user) → $(channel)'s rank currently is: