File tree Expand file tree Collapse file tree 3 files changed +20
-21
lines changed Expand file tree Collapse file tree 3 files changed +20
-21
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import { Client } from "discord.js";
33import { isDocker } from "../utils/util" ;
44
55export default ( client : Client ) : void => {
6-
76 // Check if the bot is running in a docker container by checking if the env variable UPTIME_KUMA_CONTAINERIZED is true
87 if ( isDocker ( ) ) return ;
98 const updateStatus = async ( ) => {
Original file line number Diff line number Diff line change @@ -28,7 +28,8 @@ const client = new DiscordJs.Client({
2828client . on ( "ready" , async ( ) => {
2929 if ( client . user ) {
3030 console . log ( chalk . green ( `Logged in as ${ client . user . tag } !` ) ) ;
31- if ( isDocker ( ) ) console . log ( chalk . blueBright ( `Running in a Docker container!` ) ) ;
31+ if ( isDocker ( ) )
32+ console . log ( chalk . blueBright ( `Running in a Docker container!` ) ) ;
3233 console . log (
3334 chalk . yellow . bold ( `I am running version: ${ process . env . VERSION } ` )
3435 ) ;
Original file line number Diff line number Diff line change 1- import fs from ' node:fs' ;
1+ import fs from " node:fs" ;
22export function sleep ( ms : number ) {
33 // Create new promise that resolves itself after a delay of <ms>
44 return new Promise ( ( resolve : ( args : void ) => void ) =>
55 setTimeout ( resolve , ms )
66 ) ;
77}
88
9-
109//! This code was taken from the package `is-docker` and modified to work here with esm
1110//! Original repository: https://github.com/sindresorhus/is-docker
1211let isDockerCached : boolean ;
1312
1413function hasDockerEnv ( ) {
15- try {
16- fs . statSync ( ' /.dockerenv' ) ;
17- return true ;
18- } catch {
19- return false ;
20- }
14+ try {
15+ fs . statSync ( " /.dockerenv" ) ;
16+ return true ;
17+ } catch {
18+ return false ;
19+ }
2120}
2221
2322function hasDockerCGroup ( ) {
24- try {
25- return fs . readFileSync ( ' /proc/self/cgroup' , ' utf8' ) . includes ( ' docker' ) ;
26- } catch {
27- return false ;
28- }
23+ try {
24+ return fs . readFileSync ( " /proc/self/cgroup" , " utf8" ) . includes ( " docker" ) ;
25+ } catch {
26+ return false ;
27+ }
2928}
3029
3130export function isDocker ( ) {
32- // TODO: Use `??=` when targeting Node.js 16.
33- if ( isDockerCached === undefined ) {
34- isDockerCached = hasDockerEnv ( ) || hasDockerCGroup ( ) ;
35- }
31+ // TODO: Use `??=` when targeting Node.js 16.
32+ if ( isDockerCached === undefined ) {
33+ isDockerCached = hasDockerEnv ( ) || hasDockerCGroup ( ) ;
34+ }
3635
37- return isDockerCached ;
38- }
36+ return isDockerCached ;
37+ }
You can’t perform that action at this time.
0 commit comments