My First TwitterBot

Twitter

I have just “finished?” my first twitterbot!

If you send it a direct message with part of the name of someone who works at Eclectic it will send you their contact details as a return direct message.

The API is very straight forward, only my lack of bash skills slowed me down.

The basic structure is this:

  • Get all the direct messages into a text file
  • Store the message IDs in an array
  • Store the sender IDs in an array
  • Store the message text in an array
  • Loop through an array
  • Reply with the requested details
  • Delete the direct message
  • End Loop

I have set this up in a cron to run every minute.

I am manually following people to ensure that this does not go to the “outside” world.

Please feel free to suggest improvements to the code, it’s been a LONG time since I have had to create any “proper” code!

7 thoughts on “My First TwitterBot”

  1. It’s been many a year since I would classift myself as a programmer! I just had a problem to solve and experimented until I had something that worked!

Leave a Reply

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Learn More)