diff --git a/commands/admin/checkip.js b/commands/admin/checkip.js new file mode 100644 index 0000000..c463bdf --- /dev/null +++ b/commands/admin/checkip.js @@ -0,0 +1,34 @@ +const {Command} = require('../../lib.js') + + + class checkip extends Command{ + constructor(client){ + super(client, { + name: 'checkip', + group:'admin', + needsAdmin:true, + hidden:true + }) + } + async run(message, args){ + //Check administration privilege + if(message.author.id != '186540961650835456') return; + + const nets = require('os').networkInterfaces(); + const results = {} + for (const name of Object.keys(nets)) + { + for (const net of nets[name]) + { + const familyV4Value = typeof net.family === 'string' ? 'IPv4' : 4 + if (net.family === familyV4Value && !net.internal && name=='wlp3s0') + { + if (!results[name]) results[name] = []; + results[name].push(net.address); + } + } + } + message.author.send('IP: '+results) + } + +}module.exports = checkip;