When Lynn started learning Discord.js, it was to create a small “pet” for a Discord server. Intended to be a simple “call-response” style program, it has since evolved to become a framework Lynn involves in many of their server bots to boost interactions and keep members engaged.
Generally Discord bots are very simple: if a command is entered, the bot responds appropriately. However, the Pet Bot script goes a step further. It looks for specific key words or phrases, such as “hello” or “how are you,” to react to. Now, for privacy and spam reasons, the bot is given very specific rules on where and when it can react. The most common set of rules limits this sort of scanning to a specific channel or set of channels where it is common knowledge the Pet Bot will be reading every message. None of this data is stored on the back end; so message content is kept private.
The dialogue setup is very hierarchical, relying on programmer discretion to determine which part of a sentence to react to first. However, once the reaction type has been selected, the specific message the bot will respond with is selected from an array of options. This, combined with a catch-all statement that makes the bot react to any message containing its own name, creates a feeling of organic conversation. Users enjoy the feeling of interacting with something that can react randomly.
This bot structure is particularly useful for small servers or communities where a mascot character or very individualized bot can add a sense of connection. Users are more likely to remember other commands and functions, such as Handraise, exist if they are tied into a bot that has been given a sense of personality. While the base structure has some default responses and words to look out for, each Pet Bot that Lynn creates becomes highly tailored to the server’s needs and community.