Running a twitter bot with Tootbot

I’ve always wanted to run some type of bot on some website. At first, I wanted to run a Reddit bot. However, simple reply bots aren’t that great so I decided against it.

So I found Tootbot, which is a Twitter bot that mirrors posts from a subreddit onto Twitter. It doesn’t mirror everything, but any hot posts.

So I got to work and decided to mirror posts from /r/FortniteBR because why not. Anyways, setup is very simple.

First I cloned the repository and installed the dependencies.

pip3 install -r requirements.txt

After that, I simply ran the bot using tootbot.py. It asked for some API keys which were easy to retrieve. After that, the bot was running!

Now the only problem was trying to get it running 24/7. As you know, closing off the SSH window will stop the script. So I just used nohup to run the script in the background for me.

So great, I have a Twitter bot now! It runs fine and you can change how often it posts, the threshold to post, etc.

If you want to check the bot out, you can follow @r_fortnitebr!

~hyper

How to break a website

If you saw on my Twitter, I may have broken my website on Friday night. I lost file and SSH access to it. How did it happen?

This all started with me moving my main domain over to hyper.lol. I thought I could just change all configs to the new domain and it would work. Some things were broken obviously. So I thought the issue was with file and folder ownership. So I change the directory to the site and did this command:

sudo chown -R www-data:www-data /

To anyone that is stupid enough, don’t run that command above. It WILL break your computer/VPS. That command destroys the file/folder perms making your install break. My thought process was that the / was relative to where I currently was. That was not the case. At that point, I was unable to login at all. The server couldn’t accept my key.

I realized what I did after I typed the command. Luckily, I was still logged in via WinSCP. To fix it, I just went to my root directory and mass changed the ownership back to root. I had to leave it on overnight; however, that still didn’t work.

I ended up contacting my hosting’s support. After about 10 emails, we decided that these were the best steps to fix this:

  • Support would mount a recovery tool. From there, I could access the files.
  • Download everything I want.
  • Support would unmount the recovery tool.
  • I rebuild the server’s OS.

That is what we did, and now everything is working once again.

I also did change my domain over to hyper.lol, since I had the chance to rebuild everything.

TLDR, idiot tries to change file and folder perms but messes up the location on the command. Contacts support to fix.

~hyper