File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export default async function (msg: Message) {
4949 const searchUrl = `https://duckduckgo.com/?q=${ encodeURIComponent ( query ) } ` ;
5050 await msg . reply ( `DuckDuckGo search results for "${ query } ":\n${ searchUrl } ` ) ;
5151 } catch ( error ) {
52- log . error ( "GoCommand " , "Error fetching DuckDuckGo results:" , error ) ;
52+ log . error ( "Command " , "Error fetching DuckDuckGo results:" , error ) ;
5353 await msg . reply ( "Failed to search DuckDuckGo." ) ;
5454 }
5555}
Original file line number Diff line number Diff line change 1+ import { Message } from "whatsapp-web.js" ;
2+ import log from "npmlog" ;
3+ import os from "os" ;
4+
5+ export const command = "stats" ;
6+
7+ export default async function ( msg : Message ) {
8+ try {
9+ const stats = {
10+ platform : os . platform ( ) ,
11+ arch : os . arch ( ) ,
12+ cpuCount : os . cpus ( ) . length ,
13+ totalMemory : os . totalmem ( ) ,
14+ freeMemory : os . freemem ( ) ,
15+ uptime : process . uptime ( ) ,
16+ } ;
17+
18+ const statsMessage = `
19+ *System Stats:*
20+ - Platform: ${ stats . platform }
21+ - Architecture: ${ stats . arch }
22+ - CPU Count: ${ stats . cpuCount }
23+ - Total Memory: ${ ( stats . totalMemory / ( 1024 ** 3 ) ) . toFixed ( 2 ) } GB
24+ - Free Memory: ${ ( stats . freeMemory / ( 1024 ** 3 ) ) . toFixed ( 2 ) } GB
25+ - Uptime: ${ ( stats . uptime / 3600 ) . toFixed ( 2 ) } hours
26+ - Node.js Version: ${ process . version }
27+ ` ;
28+
29+ await msg . reply ( statsMessage ) ;
30+ } catch ( error ) {
31+ log . error ( "Command" , "Error occured while processing the request:" , error ) ;
32+ await msg . reply ( "An error occurred while processing your request." ) ;
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments