Skip to content

Bot That Answers

You'll put a bot in your group chat that does one useful thing when someone asks, and keep it running somewhere that isn't your laptop.

About

A bot is a script with a chat window. On Discord, Telegram or Slack you can have one running in an afternoon with a free token. Make it do something the group actually asks for, like the weather at the trailhead, whose turn it is to cook, or rolling the dice. Keep the token out of the code and out of your screenshots. The hard part isn't the bot itself, it's answering fast enough that people keep using it.

At a glance

Per requirement
35 XP
Completion bonus
300 XP
Requirements
6
Takes
Two weekends
Skill level
Intermediate (months of practice)
Cost
Free
Supplies
You need some
Where
At home
Other people
With other people
Locked for now
Earn two more Uncommon badges in Automation & Scripts to open this one. Log in to see how far along you are.

Requirements

  1. 1
    Register a bot and make it reply 'pong' when someone types 'ping'. Discord, Telegram and Slack all have a bot setup page and a library in every language. The token goes in an environment variable or a file outside your repo, never in the code and never in a screenshot. Film the ping and the pong, or take a screenshot of the exchange. Photo or video
  2. 2
    Add one command that fetches something real and formats it. Weather from a free API, the next bus, or a random item from a list the group keeps all work. Format it so it reads well on a phone. Take a screenshot of the command and the reply. Photo
  3. 3
    Handle bad input without crashing. Send it an empty command, a huge one, an emoji and a word in another alphabet. It should reply with a short help line rather than falling over. Film the three bad inputs and the replies, or take a screenshot of the exchange. Photo or video
  4. 4
    Run it somewhere that isn't your laptop for two weeks. A free tier host, an always-on box at home or a friend's server all work. Add a restart on crash with systemd, pm2 or the host's own restart setting. Take a screenshot of the uptime after two weeks. Photo
  5. 5
    Get three people who aren't you to use it, and show the chat. This means real asks in the real group, not a test. Take a screenshot of three different people's commands and the replies they got. Photo
  6. 6
    Add a per-user cooldown and show it kicking in. One person spamming a command can get your API key banned. Limit each user to a few calls a minute and have the bot reply with how long to wait. Film the limit firing. Video