Your code will look for that PID but that PID will disappear and wont exist anymore.
No, the code checks either if a pid exists (given via eg a pidfile) or if a given process exists by name (as in, has a pid).
You don't know the pid before you start a process.
From the top of my head, you could try something like that as a cronjob:
#!/usr/bin/bash
if [[ ! $(pidof yourbot) ]]; then
echo "Bot down"
#command to restart your bot
fi
Look into the processlist to see under what name your bot is running (with "ps ax" for example).
Let's say it's "yourbot": then "pidof yourbot" will always return a pid, unless your bot has crashed and its process is gone.
As a side note: I assumed your bot is running only once; otherwise the approach needs to be changed a bit.