Nowadays there are tons of bots out there, some good some bad. But how to do block the bad ones from accessing your server?

For me, there were a bunch of really annoying requests coming in from some presumably bot servers trying to hack me? Not exactly sure what their purpose was, but they were muddying up my logs so I wanted them gone.

UFW (Uncomplicated Firewall) is a really simple and useful firewall tool on linux. With it you're able to defined rules to either allow or block ip addresses, ports, etc. It is by far the easiest way I know of to block ip addresses from a server. The command to block an ip address is simply
$ sudo ufw deny from [ip] to any
In this case:
$ sudo ufw deny from to any
Rule added

except when I checked the logs I still saw the annoying requests still coming in.

With UFW rules have an order to them and the deny rules I added went after other rules which rendered them useless.
$ sudo ufw status numbered
Status: active

     To                         Action      From
          --                         ------      ----
          [ 1] 22                         ALLOW IN    Anywhere
          [ 2] 80                         ALLOW IN    Anywhere
          [ 3] 443                        ALLOW IN    Anywhere
          [ 4] 115/tcp                    ALLOW IN    Anywhere
          [ 5] Anywhere                   DENY IN
          [ 6] Anywhere                   DENY IN
          [ 7] 22 (v6)                    ALLOW IN    Anywhere (v6)
          [ 8] 80 (v6)                    ALLOW IN    Anywhere (v6)
          [ 9] 443 (v6)                   ALLOW IN    Anywhere (v6)
          [10] 115/tcp (v6)               ALLOW IN    Anywhere (v6)
And to delete a rule:
$ sudo ufw delete 5
 deny from
Proceed with operation (y|n)? y   
Rule deleted
Then to add a rule at the top so it overrides all other rules:
$ sudo ufw insert 1 deny from to any

And with that, the bot requests are no longer getting in.