### Example Request Headers Source: https://docs.nightbot.tv/variables/urlfetch Displays the structure of headers sent by Nightbot during a urlfetch request. ```text Nightbot-Response-Url: https://api.nightbot.tv/1/channel/send/TVRRM05UazRNVGsyT1RnNE1TOWthWE5... Nightbot-User: name=night&displayName=night&provider=twitch&providerId=11785491&userLevel=owner Nightbot-Channel: name=night&displayName=Night&provider=twitch&providerId=11785491 ``` -------------------------------- ### Adding an X Command Source: https://docs.nightbot.tv/variables/x Example of creating a command that allows viewers to post about the current stream using the X variable. ```text !commands add !x $(x Come watch @`XUser` while they play $(twitch $(channel) "{{game}}} on Twitch! {{url}}}")) ``` -------------------------------- ### Example usage of the Bluesky variable Source: https://docs.nightbot.tv/variables/bluesky Demonstrates the variable with a specific message containing a URL. ```text $(bluesky Come check out Night's Twitch stream: http://twitch.tv/night) ``` -------------------------------- ### Weather Variable Example Usage Source: https://docs.nightbot.tv/variables/weather Example of the weather variable with a specific location. ```text $(weather kappa) ``` -------------------------------- ### Basic Usage of querystring Source: https://docs.nightbot.tv/variables/querystring Standard implementation to encode command text. ```text $(querystring) ``` -------------------------------- ### Adding a Bluesky command Source: https://docs.nightbot.tv/variables/bluesky Creates a command that allows viewers to post about the current stream, including the game and channel URL. ```text !commands add !bluesky $(bluesky Come watch @`BlueskyUser` while they play $(twitch $(channel) "{{game}}}" on Twitch! {{url}}}")) ``` -------------------------------- ### Basic UrlFetch Usage Source: https://docs.nightbot.tv/variables/urlfetch Fetches a plain text response from a URL, limited to 400 characters. ```text $(urlfetch `url`) ``` -------------------------------- ### $(steam `username`) Source: https://docs.nightbot.tv/variables/steam Retrieves and displays the basic status and profile link for a given Steam community ID. ```APIDOC ## $(steam `username`) ### Description Displays the status and profile URL for the specified Steam community ID. ### Parameters - **username** (string) - Required - The Steam community ID to look up. ### Example > $(steam night) ### Output > Night is Offline since Sun Dec 06 2015 04:09:04 GMT-0500 (EST) - http://steamcommunity.com/id/night/ ``` -------------------------------- ### $(steam `username` "`formatted string`") Source: https://docs.nightbot.tv/variables/steam Retrieves Steam profile information and formats the output using a custom string with mustache-tagged parameters. ```APIDOC ## $(steam `username` "`formatted string`") ### Description Allows for custom formatting of Steam profile data using specific placeholders. ### Parameters - **username** (string) - Required - The Steam community ID to look up. - **formatted string** (string) - Required - A string containing mustache-tagged parameters: {{name}}, {{realName}}, {{profileUrl}}, {{lastOnline}}, {{status}}, {{country}}, {{gameId}}, {{gameName}}, {{gameUrl}}, {{gameServer}}. ### Example > $(steam night "{{name}} resides in {{country}} - {{profileUrl}}") ### Output > Night resides in US - http://steamcommunity.com/id/night/ ``` -------------------------------- ### Basic X Variable Usage Source: https://docs.nightbot.tv/variables/x Generates a click-to-post link for the specified message. ```text $(x Come check out Night's Twitch stream: http://twitch.tv/night) ``` -------------------------------- ### Secure Input Handling in Eval Source: https://docs.nightbot.tv/variables/eval Demonstrates vulnerable and secure patterns for handling user input to prevent command injection. ```text !addcom !upper $(eval "@$(user), " + "$(query)".toUpperCase()) ``` ```text !upper ";"!settitle Last stream ever!"// ``` ```text !addcom !upper $(eval "@$(user), " + decodeURIComponent("$(querystring)").toUpperCase()) ``` ```text !addcom !upper $(eval "@$(user), " + decodeURIComponent("$(querystring $(3))").toUpperCase()) ``` -------------------------------- ### $(rainwave `station` "`formatted string`") Source: https://docs.nightbot.tv/variables/rainwave Fetches the currently playing song for a specified Rainwave station and formats the output using a custom string. ```APIDOC ## $(rainwave `station` "`formatted string`") ### Description Displays the currently playing song on the specified Rainwave station using a custom formatted string with mustache tags. ### Parameters - **station** (string) - Required - The station to look up. - **formatted string** (string) - Required - A string containing mustache tags: {{artist}}, {{title}}, or {{url}}. ### Example $(rainwave ocremix "{{title}} by {{artist}} - {{url}}") // Result: The Vision of the Wind Fish by Sound Test - http://threshold.ocremix.org ``` -------------------------------- ### Add Weather Lookup Command Source: https://docs.nightbot.tv/variables/weather Command to allow users to look up their own weather via query. ```text !commands add !weatherlookup $(weather $(query)) ``` -------------------------------- ### 8ball Command Implementation Source: https://docs.nightbot.tv/variables/eval Selects a random response from an array to simulate an 8ball game. ```text !commands add !8ball 🎱 $(eval const responses = ['All signs point to yes...', 'Yes!', 'My sources say nope.', 'You may rely on it.', 'Concentrate and ask again...', 'Outlook not so good...', 'It is decidedly so!', 'Better not tell you.', 'Very doubtful.', 'Yes - Definitely!', 'It is certain!', 'Most likely.', 'Ask again later.', 'No!', 'Outlook good.', 'Don\'t count on it.']; responses[Math.floor(Math.random() * responses.length)];) ``` -------------------------------- ### Weather Variable Syntax Source: https://docs.nightbot.tv/variables/weather Basic syntax for the weather variable. ```text $(weather `location`) ``` -------------------------------- ### $(rainwave `station`) Source: https://docs.nightbot.tv/variables/rainwave Fetches the currently playing song for a specified Rainwave station. ```APIDOC ## $(rainwave `station`) ### Description Displays the currently playing song on the specified Rainwave station. ### Parameters - **station** (string) - Required - The station to look up. Valid values: all, game, chiptune, ocremix, covers. ### Example $(rainwave game) // Result: Battlefield - Those That Slay and Fall by Yuzo Koshiro ``` -------------------------------- ### $(lastfm `username` "`formatted string`") Source: https://docs.nightbot.tv/variables/lastfm Displays the most recent song scrobbled to the specified Last.fm account using a custom formatted string. ```APIDOC ## $(lastfm `username` "`formatted string`") ### Description Displays the most recent song scrobbled to the specified Last.fm account using a custom format string with mustache tags. ### Parameters - **username** (string) - Required - The Last.fm username to look up. - **formatted string** (string) - Required - A string containing mustache-tagged parameters: {{artist}}, {{title}}, and {{url}}. ### Example `$(lastfm night "{{title}} by {{artist}} - {{url}}")` ### Output `The Reason by Hoobastank - http://www.last.fm/music/Hoobastank/_/The+Reason` ``` -------------------------------- ### Basic Bluesky variable usage Source: https://docs.nightbot.tv/variables/bluesky Generates a shortened click-to-post link for a specified message. ```text $(bluesky `message`) ``` -------------------------------- ### Add Local Weather Command Source: https://docs.nightbot.tv/variables/weather Command to display a specific local weather location. ```text !commands add !weather $(weather `location`) ``` -------------------------------- ### $(lastfm `username`) Source: https://docs.nightbot.tv/variables/lastfm Displays the most recent song scrobbled to the specified Last.fm account in a default format. ```APIDOC ## $(lastfm `username`) ### Description Displays the most recent song scrobbled to the specified Last.fm account. ### Parameters - **username** (string) - Required - The Last.fm username to look up. ### Example `$(lastfm night)` ### Output `The Reason by Hoobastank` ``` -------------------------------- ### $(leagueoflegends `riot_id` `region`) Source: https://docs.nightbot.tv/variables/leagueoflegends Retrieves the current rank for a specified Riot ID and region. ```APIDOC ## $(leagueoflegends `riot_id` `region`) ### Description Displays the current rank information for a given Riot ID in a specific region. ### Parameters - **riot_id** (string) - Required - The Riot ID to look up (format: GameName#TagLine). - **region** (string) - Required - The region the summoner plays on. ### Example Usage $(leagueoflegends testing#1234 na) ### Result testing#1234's current rank: Challenger I ``` -------------------------------- ### Wikipedia Search Command Source: https://docs.nightbot.tv/variables/urlfetch Uses urlfetch with JSON to retrieve and format Wikipedia search results via eval. ```text !commands add !wiki Wikipedia Article: $(eval const api = $(urlfetch json https://en.wikipedia.org/w/api.php?format=json&action=opensearch&search=$(querystring)); api.error || !api[1][0] ? 'Please add a query to the search' : `${api[1][0]} - ${api[3][0]}`) ``` -------------------------------- ### JSON UrlFetch Usage Source: https://docs.nightbot.tv/variables/urlfetch Fetches a JSON response, allowing for larger payloads and integration with eval. ```text $(urlfetch json `url`) ``` -------------------------------- ### Nested Usage of querystring Source: https://docs.nightbot.tv/variables/querystring Encodes the output of another variable, such as a Twitch channel URL. ```text $(querystring $(twitch $(channel) "{{url}}}")) ``` -------------------------------- ### Basic Arithmetic Evaluation Source: https://docs.nightbot.tv/variables/eval Performs simple mathematical operations within a command. ```text $(eval 2 + 2) ``` -------------------------------- ### Conditional logic using ChatID Source: https://docs.nightbot.tv/variables/chatid Use this snippet within an eval variable to execute specific commands based on the current chat's unique ID. ```text $(eval '$(chatid)' === 'pM4IfHZ5qcYSf987SDFDF9' ? 'say this' : 'say something else') ``` -------------------------------- ### Random Number Generation Source: https://docs.nightbot.tv/variables/eval Generates a random integer between 1 and 100. ```text !commands add !random The Random Number is: $(eval Math.floor((Math.random() * 100) + 1)) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.