Connect with us

    Hi, what are you looking for?

    Tech

    How to Create the !uptime Command in Nightbot for Twitch and YouTube

    If you are a streamer on Twitch or YouTube, having a bot that helps manage chat and provides useful commands is essential. Nightbot is one of the most popular chatbots for streamers, offering automation and custom commands. One of the most requested commands is !uptime, which tells viewers how long your stream has been live. In this article, we will guide you step by step on how to create the !uptime command!

    Nightbot

    If you are a streamer on Twitch or YouTube, having a bot that helps manage chat and provides useful commands is essential. Nightbot is one of the most popular chatbots for streamers, offering automation and custom commands. One of the most requested commands is !uptime, which tells viewers how long your stream has been live. In this article, we will guide you step by step on how to create the !uptime command in Nightbot for both Twitch and YouTube.

    Why Use an !uptime Command?

    The !uptime command allows viewers to check how long your stream has been running without needing to ask you directly. This can improve engagement and interaction in your chat while reducing repetitive questions. It also helps moderators provide quick answers to viewers.


    How to Add the !uptime Command to Nightbot

    Nightbot does not have a built-in !uptime command, so we need to create a custom command using an API that retrieves the uptime of your stream. Follow these steps to set it up:

    Step 1: Open the Nightbot Dashboard

    1. Go to Nightbot’s official website.
    2. Log in with your Twitch or YouTube account.
    3. Click on Commands in the left menu.
    4. Click on + Add Command to create a new command.

    Step 2: Set Up the Command

    In the Command field, type:

    !uptime
    

    In the Message field, use one of the following API calls, depending on your streaming platform.

    For Twitch Streams

    Use the following API URL:


    $(urlfetch https://decapi.me/twitch/uptime?channel=$(channel))
    

    For YouTube Streams

    Since YouTube does not provide a direct uptime API like Twitch, you can use a workaround by integrating a third-party service or manually informing viewers about the stream’s start time. Some services allow tracking YouTube live streams, but they require API keys and extra setup. Currently, Nightbot does not support a direct !uptime command for YouTube like it does for Twitch.

    Alternatively, you can use a manual workaround:

    The stream started at: $(twitch $(channel) "stream started at %starttime%")
    

    This command will work if your Nightbot is set up to recognize YouTube Live data correctly.

    Step 3: Configure Command Options

    • Userlevel: Set it to Everyone so that all viewers can use the command.
    • Cooldown: Set it to around 5-10 seconds to prevent spam.
    • Alias: Leave this field empty.

    Step 4: Save and Test the Command

    Click Submit to save the command. Now, go to your chat and type !uptime to see if it works. If your stream is live, the bot should return a message like:

    The stream has been live for 2 hours, 15 minutes.
    

    For YouTube, since there is no direct API, you may need to manually update your command with your stream start time.


    Troubleshooting Common Issues

    If the !uptime command does not work, try these solutions:

    1. Ensure the API URL is Correct: Double-check the URL in the command message.
    2. Check if Nightbot is Active: Make sure Nightbot is a moderator and has joined your chat.
    3. Test the API in a Browser: Paste the API URL into your browser and see if it returns valid data (for Twitch).
    4. Ensure Your Stream is Live: The command will not work if you are offline.
    5. For YouTube, Consider Alternative Methods: Since YouTube does not have a direct uptime API, consider manually setting the start time in a pinned message or using another bot with API integration.

    Additional Customizations

    If you want to customize the response, you can modify the message output. Here are a few variations:

    Adding a Friendly Message

    $(urlfetch https://decapi.me/twitch/uptime?channel=$(channel)) - Thanks for tuning in!
    

    Adding Emojis

    ⏳ The stream has been live for $(urlfetch https://decapi.me/twitch/uptime?channel=$(channel)) ⏳
    

    Using a Different Language

    O streamer está ao vivo há: $(urlfetch https://decapi.me/twitch/uptime?channel=$(channel))
    

    Adding the !uptime command in Nightbot is a simple yet effective way to improve engagement and provide useful information to your viewers. By following the steps above, you can easily set up and customize this command for your Twitch or YouTube stream. If you have any issues, try troubleshooting using the tips provided.

    For YouTube, since a direct API is not available, you may need to manually input the stream start time or use a third-party tool. Regardless of your platform, setting up !uptime enhances the viewer experience and makes your chat more interactive.


    Now that you have successfully added the !uptime command, explore other custom commands to enhance your chat experience!

    Photo by Yan Krukau

    Written By

    My name is Juan de Souza, a 25-year-old entrepreneur, investor, blogger, and streamer. My journey in business began at the age of 10, leveraging a dial-up internet connection in Brazil to start my first venture. Currently, I reside in Porto, Portugal, where I have been based since 2025.

    Comments
    Advertisement

    Join Our Discord Server

    Advertisement
    Advertisement

    Recommended Posts for You

    HeartstopperHeartstopper

    LGBTQIA+

    Check out the full review of Netflix's Heartstopper series and find out if the Heartstopper series delivers everything it promises in full!

    Cinema

    “One of the most memorable cartoons of the 20th and 21st centuries. Its story, characters and writing are utterly captivating. “Little Bear” is known...

    Curiosities

    Super Mario World, also known as “Super Mario Bros. 4” in Japan, is without a doubt one of the most popular games of all...

    Cinema

    “Courage the Cowardly Dog” tells the story of Courage, a dog who’s easily scared and lives on a farm with Muriel and Eustace Bagge...

    Cinema

    Who doesn’t know this epic cartoon from Hanna-Barbera, Wacky Races, where eleven competitors vied in every episode for the world title of “World’s Wackiest...

    Cinema

    Sagwa, one of the best cartoons still airing on the Futura channel. In fact, all the shows on Futura are excellent. It tells the...

    Cinema

    “Do you remember the classic cartoon Timon and Pumbaa? It’s an animated TV series produced by Walt Disney Animation, starring the warthog and meerkat...

    Cinema

    At the end of the 1930s, animation was at its peak. It was called the “Golden Age” by many film enthusiasts, where classic characters...

    Cinema

    Woody Woodpecker, one of the most beloved characters of all time. Adored by children, teenagers, and adults alike. The show itself dates back to...

    Curiosities

    Grand Theft Auto V (GTA V) is known for its vast open-world gameplay, where players can explore, complete missions, or just cause chaos. One...

    Others

    “Castelo Rá‑Tim‑Bum” premiered in 1994 on TV Cultura, delighting fans of the original “Rá‑Tim‑Bum” who were tired of its reruns, as well as other...

    Tech

    If you grew up playing console games in the 1980s and 90s and never heard this one, count yourself lucky—very lucky. Here’s the urban...

    DisneyDisney

    Cinema

    Walt Disney, one of the largest and most influential entertainment giants in the world, has a long history of innovation in animation. From its...

    Games

    “Nintendo 64” is Nintendo’s third home video game console. Commonly abbreviated as “N64,” it launched on June 23, 1996 (Japan) and on September 29 in the United States....

    Games

    How about transforming your Minecraft into an even more immersive game? With that in mind, the “Realistico” Mod Pack was developed—a texture pack with...

    Games

    You’ve definitely seen, heard about, or played Just Dance at some point—it’s simply one of the most incredible games ever created and maintained by...

    Games

    Need For Speed Heat has finally hit the streets and is increasingly reminiscent of the franchise’s golden-era titles, such as Need For Speed Underground...

    Games

    It's time to talk about Far Cry 4: a new game in the iconic open-world franchise that first arrived over 10 years ago with paradisiacal...

    Plants vs. Zombies Garden WarfarePlants vs. Zombies Garden Warfare

    Games

    Recently, Plants vs. Zombies Garden Warfare was released—it’s the new game from PopCap, famous for its mobile hits. This time, we have a review...

    What is the Meaning and Function of the Kernel?What is the Meaning and Function of the Kernel?

    Devs

    The kernel is one of the most fundamental components of any operating system (OS), acting as a bridge between the hardware of a computer...