Added reviving
If bot crashed after running for over 1 day, it will get revived and will send message to admin if set
This commit is contained in:
parent
c6aa30a80c
commit
a1f50b7480
@ -1,5 +1,15 @@
|
|||||||
// Prostě onready
|
// Až se bot načte tak to napíše do konzole a jestli pošel, tak to oznámí adminovi
|
||||||
|
|
||||||
|
import { Client } from "discord.js";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
on_ready: () => console.log("A jedeš!")
|
on_ready: async () => {
|
||||||
|
console.log("A jedeš!");
|
||||||
|
if (!process.argv[2]) return;
|
||||||
|
const client: Client = module.exports.client;
|
||||||
|
const admin = client.users.cache.get("221561136028450816");
|
||||||
|
if (!admin) return;
|
||||||
|
await admin.createDM();
|
||||||
|
admin.dmChannel?.send("pošel jsem ty magore");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
11
start.sh
11
start.sh
@ -1,11 +1,20 @@
|
|||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
|
cas=`date +"%s"`
|
||||||
if node .
|
if node .
|
||||||
then
|
then
|
||||||
echo stahuju update
|
echo stahuju update
|
||||||
git stash
|
git stash
|
||||||
git pull
|
git pull
|
||||||
else
|
else
|
||||||
break
|
echo exit code byl $?
|
||||||
|
novejcas=`date +"%s"`
|
||||||
|
if (($cas+86400<$novejcas))
|
||||||
|
then
|
||||||
|
echo Pošlo to, let\'s restart
|
||||||
|
else
|
||||||
|
echo Pošlo to absolutně, seru na to
|
||||||
|
break
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user