How do bots work?

643 views

And I don’t mean like spam bots. I searched this sub and couldn’t find much. For example, I see people tagging u/ savevideo or u/ savephoto, and just saw one “shakespeare bot” that repeated a comment but in “shakespeare language.” Are these real people? Im assuming not, but on the video one I think, I saw the “user” post they got banned. So I’m a bit confused? I’m fairly new here

In: Technology

3 Answers

Anonymous 0 Comments

Reddit has an API (Application Programming Interface) which is basically just a web page meant for software to read and interact with, rather than a human. In Reddit’s case, it’s a series of pages where a program can read comments or other information, then post their own comments, without having to deal with the fluff of the visual aspects.

In the Shakespeare bot’s case, it’s basically asking Reddit every few seconds for “all the posts in a specific set of subreddits,” which reddit gives it. The program, which is running on its creator’s computer, then does some processing to figure out which comments it wants to reply to and what it will say, and then uses the same API to reply directly to the original comment.

However, in order to do this, the bot itself needs its own account, with its own credentials (username & password). The bot sends this information along with the contents of its post so that Reddit knows what username to associate with the bot. This also gives Reddit the power to ban a bot as if it were a human, because to Reddit’s servers, they’re basically the same thing.

Anonymous 0 Comments

Those bots either search all of Reddit (with some subreddit exceptions) for their summon word (or sometimes on specific comments like haiku bot which looks for words with specific syllable combinations) or wait to be summoned by being tagged. Then when that happens they run code to do their thing, like for Shakespeare language it replaces words based on context, and save video generates a link to where you can download Reddit videos.

Anonymous 0 Comments

A bot is just a program running on a computer somewhere–it could be a server in the cloud, a desktop/laptop, or I suppose you could even do it on a smartphone if you were so inclined.

Reddit has the “normal” interface where you go to reddit.com and you see the posts and comments laid out on the page, but it also has a computer-readable format that just packs the data in nice easily digested chunks. 3rd party Reddit apps tend to consume that interface and apply their own formatting.

A bot will also use that interface and check for whatever trigger the programmer sets it to. Sometimes that means checking every comment looking for certain phrases (e.g. the ubiquitous grammar correcting bots that are quickly banned because they’re stupid and add nothing to the conversation). Many will periodically check for username mentions, then jump to whatever comment mentioned their name.

Once the program has detected its trigger it does whatever it was programmed to do. Simple bots may just reply with a canned message. Marginally more complex would be doing a find-replace, a unit conversion, or looking up a keyword in a database (this is common on competitive card game subreddits like /r/mtg where bots are made to facilitate calling out a card by name, then the bot will look up a link to that card and post some relevant information from it). The sky is the limit here–a bot could take in an image of a chess board and tell you the best next move, or take in an entire news article and run it through a pile of AI to spit out a summarized version of the article.

When that processing is done the program then usually posts a comment. Technically the bot can interact with reddit in any way a human can, but certain interactions are bannable (e.g. posting the same link all over the place, upvoting/downvoting).