lepší startovač

This commit is contained in:
Histmy 2022-11-30 14:30:49 +01:00
parent 5a225c3ece
commit d8c9c24da8
4 changed files with 21 additions and 12 deletions

View File

@ -7,7 +7,7 @@ import { adminLog, log } from "../utils/utils";
const exp: Modul = {
on_ready: async () => {
log("A jedeš!");
if (process.argv.length < 3) return;
if (process.argv.length < 4) return;
const client: Client = module.exports.client;
adminLog(client, "pošel jsem");
}

View File

@ -40,9 +40,10 @@ const exp: Modul = {
},
lastuptime: () => {
const cislo = Number(process.argv[2]);
if (!cislo) return "aj forgor 💀";
return `naposled jsem jel ${formatCas(cislo)}`;
const index = process.argv.length > 3 ? 3 : 2;
const sekundy = Number(process.argv[index]);
if (!sekundy) return "aj forgor 💀";
return `naposled jsem jel ${formatCas(sekundy)}`;
}
},

View File

@ -84,7 +84,10 @@ export async function joinVoice(channel: VoiceChannel | StageChannel | string, g
return { conn, prev: true };
}
prev = conn.joinConfig.channelId!;
if (!prev) throw new Error(`Ty si fakt dement @histmy, ${typeof prev}`);
if (!prev) {
log(new Error(`chci do kanelu "${channelId}", na serveru "${guildId}" a config channelid nen`));
throw new Error("Dement no");
}
}
conn = joinVoiceChannel({

View File

@ -1,24 +1,29 @@
declare -a casy
i=0
while true
do
cas=$(date +"%s")
if node . $neco
if node . $posel $posledni
then
echo stahuju update
git stash
git pull
npm i --omit=dev
tsc >/dev/null
unset neco
unset posel
else
echo exit code byl $?
novejcas=$(date +"%s")
neco=$(($novejcas-$cas))
if (($cas+86400<$novejcas))
posel=1
casy[$i]=$(date +"%s")
posledni=$(($((casy[$i]))-$cas))
if (($i < 3)) || (($((casy[$(($i - 3))])) < $(($((casy[$i])) - 864000))))
then
echo Poslo to, let\'s restart
echo Poslo to dostatecne malo, restartuju
else
echo Poslo to absolutne, seru na to
echo Poslo to moc, seru na to
break
fi
i=$(($i+1))
fi
done