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 = { const exp: Modul = {
on_ready: async () => { on_ready: async () => {
log("A jedeš!"); log("A jedeš!");
if (process.argv.length < 3) return; if (process.argv.length < 4) return;
const client: Client = module.exports.client; const client: Client = module.exports.client;
adminLog(client, "pošel jsem"); adminLog(client, "pošel jsem");
} }

View File

@ -40,9 +40,10 @@ const exp: Modul = {
}, },
lastuptime: () => { lastuptime: () => {
const cislo = Number(process.argv[2]); const index = process.argv.length > 3 ? 3 : 2;
if (!cislo) return "aj forgor 💀"; const sekundy = Number(process.argv[index]);
return `naposled jsem jel ${formatCas(cislo)}`; 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 }; return { conn, prev: true };
} }
prev = conn.joinConfig.channelId!; 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({ conn = joinVoiceChannel({

View File

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