Custom Command Help

Asked Mar 25, 2021·2 replies·Last activity 5 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.

Hello All,

I'm very new to Nightbot and definitely not a developer so I figured I'd come to the Forums to seek the advice I need.

I'd like to have a command in my channel that displays the current route I'm riding in Zwift. I don't believe there is any API available for doing something like this, so my initial thought is to create a !route command that would then return a response that I would manually update at the beginning of each ride.

What is the proper syntax for doing this, and how do I include a variable that I can change during each session?

Example:
!route would return "We are currently riding Alpe du Zwift", then using a command such as !setroute I could change the route name...

What would be the best practice for doing this?

Thanks in Advance!

2 replies

Probably something like this:

!addcom !setroute -ul=moderator -a=!editcom $(eval a=[`RouteName1`,`RouteName2`,`RoutNameX`];`We are currently riding ${a[$(1)-1]}`

You just need to use !setroute {NumberOfRouteInList}

Alternatively you could use $(query) and type the name of the place everytime
That would look like this:

!addcom !setroute -ul=moderator -a=!editcom We are currently riding $(query)

Awesome, thanks for that suggestion..

I think I'd just as soon manually type in the route name each time and would want to include a link to a website that gives additional info on the route.

I'll play around with what you've recommended and come back if I have more questions.

Thanks Again for the Help!