Skip to main content
Corvus Connection

Take whichever lookup answers first

Expert
Race a Spotify and a Twitch query, then report whichever one wins.
On Chat CommandoutcommandargsargCountusermessageRaceinbranch0branch1branch2branch3winnercompletedSpotify: Now PlayinginouttrackTitleartistisPlayingprogressMsdurationMsTwitch: Get StreaminoutisLivetitlestartedAtTo TextvaluevalueSend Chat MessageintextoutReturnin
Graph structure (text alternative)

Trigger: onChatCommand

Nodes:

  • On Chat Command (entry.onChatCommand)
  • Race (flow.race)
  • Spotify: Now Playing (spotify.nowPlaying)
  • Twitch: Get Stream (twitch.getStream)
  • To Text (convert.toText)
  • Send Chat Message (action.sendChat)
  • Return (flow.return)

Connections:

  • On Chat Command.out → Race.in
  • Race.branch0 → Spotify: Now Playing.in
  • Race.branch1 → Twitch: Get Stream.in
  • Race.winner → To Text.value
  • Race.completed → Send Chat Message.in
  • To Text.value → Send Chat Message.text
  • Send Chat Message.out → Return.in

Walkthrough

Fire two lookups at once and act on whichever answers first.

How it works

  1. On Command fires on !status.
  2. Race starts both branches concurrently and continues the moment the first one finishes (Task.WhenAny):
    • branch 0Spotify: Now Playing
    • branch 1Twitch: Get Stream
  3. Race binds the winner index (0 or 1) to a data output.
  4. To Text turns the winner into a string and Send Chat Message reports it.

This is the shape you'd use to take the fastest of several sources. Swap the branches for whatever real work you need to race. See Race.

Uses these nodes