Hacker News new | ask | show | jobs
by freedomben 874 days ago
Interesting, he seems to primarily work on a Discord Bot.

This is at heavy risk for confirmation bias, but I believe that writing chat bots is one of the best ways for people to get into and enjoy coding, because it's fun and rewarding, and simple enough (with an existing framework to use) that just uses strings. For a large generation it was MySpace and the ability to customize your page heavily with HTML. I know a number of people who learned HTML for that reason.

Chat bots seem like the closest modern day equivalent (despite the main platforms making it harder with stuff like difficult to connect to the real time websocket and force use of webhooks). 10 years ago or so when Slack was new and had a gloriously simple API, I even wrote a framework that made it as easy as implementing one function, and you could receive messages (among other metadata like the username of the sender) as strings and send replies easily as strings. It served as an entry point for a few friends who had some fun with it and learned some ruby in the process.

Anyway, if you're looking to get into coding but want to do a "real" project (or something very rewarding), start by writing simple chat bots! If you need some ideas, these are simple:

1. Start with writing a simple echo bot that just replies to every message with the same message that it received.

1. Write a bot that responds to every message with a random number between 1 and 100. For a slight increased challenge, have it do fizzbuzz where the nth message received is the counter.

2. Write a bot that that will reverse the message of whatever it receives, so it echoes replies but backwards.

3. Write a bot that will lookup a word when the message sent is "define <word>" and reply with the definition from one of the many dictionary APIs out there.

Go from there!

10 comments

I teach software engineering to grad students. Discord bots specifically have been fantastic:

1) auth/identity is built in

2) the UX is highly constrained (having students lose a month to CSS issues is perhaps good prep for the real world but feels awful)

3) all of the tooling is free*

*With the restrictions on free Heroku and the removal of free orgs on fly (it seems) I’ve had to retool a bit but codespaces cover a lot of what students need.

How is that different from writing command-line apps?
It is more engaging to do something related to the software students (might) be using daily or at least have some experience. It's easier to show of the final result to (non programming) friends, or get some ideas for potentially useful tools or at least fun toys.

Sure for experienced developers command line tools are used daily (at least for some developers), but for many students it can be alien world that they don't use outside the lessons.

Also overall usefulness. Simple terminal program that responds with a fixed message, is just an exerciser but otherwise useless. You need to get a lot more complicated to make useful tool. But a chatbot which responds with fixed messages (usually FAQ type stuff) is a commonly used tool for the purpose of community management.

Most computer users don't use command-line apps day in and day out. Most computer users nowadays use chat apps (Discord, Slack, Whatsapp) and have probably encountered bots on those platforms before. There is an inherent familiarity that makes it feel more accessible.
1. Networking, multiplayer and multimedia are built in.

2. The social component is fun. Students can easily show their work to each other. Don't underestimate the power of memes.

3. The Discord server provides shared history/some persistance without the students needing to implement their own servers.

"Normal" people don't use command-line apps. Making 'real' things that other people use can be a huge motivator for early learners.
The two pieces of software I'm most proud of having written in college were a simple NFS driver and a simple GET-only HTTP server. There's just something magical about seeing your software not only working, but also integrating with something else that's "real". (In this case, being able to mount a network drive in the OS and opening a page in a real browser)
It’s much easier to share a link to a Discord server than it is to convince your friends/family to install an app. Packaging and distribution alone would take up most of your development time - a semester is only 15 weeks. (This is why I used to do web-based projects.)

Discord also supports some simple UI elements - images, buttons, form fields, and dropdowns - so it’s a nice step above a CLI for teaching UX, which is part of the course.

Definitely agree—Discord bots got me into JavaScript! (For better or worse, lol.)

To anyone who wants to build and host a hobby bot, I've had a good experience with using fly.io to host mine. They don't charge you for any monthly billing periods whose total cost would be less than five dollars (USD), so for small projects that would never get close to meeting that threshold, it's free ninety nine. Hard to beat that!

I didn't realize they had a (effectively) scale-to-zero option! Is it possible to store a bit of state, or is the bot entirely for ephemeral responses? I wasn't clear on what storage would be available from their pricing page.
Both bots I run are just for ephemeral responses, so unfortunately I'm not sure. I tend to be well under the $5 threshold, though, even at 2x bots, so it seems like there's plenty of wiggle room for more storage without incurring totally nutso costs.

(And even if you do exceed the $5 threshold, it's still waaaaaay cheaper than other options I've seen. RIP to Heroku's free hobby tier.)

This would be a good dbrand style marketing point; "Round down pricing: You're a rounding error, so why would we bother charging you!" :-)
Their end of the month email is

Good news from Fly.io! We don’t collect bills smaller than $5.00.

This month, your bill of $2.01 falls below that threshold, so we’re discounting it by 100%.

There's a whole generation of us who started coding on mIRC-scripting exactly for that reason.
Whippersnapper, in my day real IRC bots were coded in Tcl [0]! ;)

0: https://docs.eggheads.org/tutorials/firstscript.html

> Interesting, he seems to primarily work on a Discord Bot.

No, that's just his only public repo. It only has 95 commits but he makes on average 1,000 commits per year on private repos (including Weezify, presumably). So it's really a very small fraction of his activity.

There was a fad for chatbots during the MySpace era (or at least the early-mid-00s AIM era?) too, I remember messing around with trying to build them. They were a lot less accessible and less documented than the APIs available today though!

Eg https://en.m.wikipedia.org/wiki/SmarterChild

I once heard that there are a couple types of projects that every software dev must go through at least once as a rite of passage. For me and those around me those definitely were IRC bots and bulletin board systems. Everyone created their own.
You have a good point. For me it was IRC bots.

It's a quick and easy return on investment. You see results and you can share results with friends, and the APIs aren't too hard.

What kind of person acknowledges there might be confirmation bias?
I mean, entire generations of programmers started out writing terminal programs, a chat bot is basically a multiplayer CLI program
Eggdrop represent
Still going strong, it seems!

https://github.com/eggheads/eggdrop