diff --git a/src/modules/onReady.ts b/src/modules/onReady.ts index d30b00d..f442b68 100644 --- a/src/modules/onReady.ts +++ b/src/modules/onReady.ts @@ -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 = { - 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"); + } }; diff --git a/start.sh b/start.sh index 339cb6f..f93c797 100644 --- a/start.sh +++ b/start.sh @@ -1,11 +1,20 @@ while true do + cas=`date +"%s"` if node . then echo stahuju update git stash git pull 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 done