modified: package.json
modified: src/main.js new file: src/trigger/stats.js
This commit is contained in:
parent
2fbffc0574
commit
68249b6af2
@ -7,6 +7,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"coffea": "^0.4.24",
|
||||
"du": "^0.1.0",
|
||||
"fs-extra": "^0.30.0",
|
||||
"mime": "^1.3.4",
|
||||
"mysql": "^2.11.1",
|
||||
|
14
src/main.js
14
src/main.js
@ -42,18 +42,13 @@ bot.on('motd', (e) => {
|
||||
|
||||
bot.on('message', (e) => {
|
||||
trigger.trigger.forEach((entry,i,a) => {
|
||||
//if(entry.call.test(e.message) && entry.active == 1) {
|
||||
//if(e.message.match(new RegExp(entry.call, entry.flags)) && entry.active == 1) {
|
||||
if(e.message.match(entry.call) && entry.active == 1) {
|
||||
lib.log('trigger: '+entry.name);
|
||||
lib.getUserlevel(e, (cb) => {
|
||||
//setTimeout(()=>{
|
||||
if(cb.level >= entry.level) {
|
||||
entry.func(e);
|
||||
}
|
||||
else
|
||||
e.reply('no permission, min level '+entry.level+' required');
|
||||
//}, 200);
|
||||
if(cb.level >= entry.level)
|
||||
entry.func(e);
|
||||
else
|
||||
e.reply('no permission, min level '+entry.level+' required');
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -70,7 +65,6 @@ var trigger = {
|
||||
trigger.trigger.push({
|
||||
name: args.name,
|
||||
call: args.call,
|
||||
//flags: args.flags,
|
||||
func: args.func,
|
||||
desc: args.desc,
|
||||
level: args.level,
|
||||
|
20
src/trigger/stats.js
Normal file
20
src/trigger/stats.js
Normal file
@ -0,0 +1,20 @@
|
||||
var du = require('du');
|
||||
|
||||
module.exports = (bot, trigger, lib) => {
|
||||
trigger.add({
|
||||
name: 'stats',
|
||||
call: /^\!stats$/i,
|
||||
level: 10,
|
||||
active: 1,
|
||||
func: (e) => {
|
||||
lib.sql.query("select count(`id`) as anzahl from `f0ck`.`items`", (err, rows, fields) => {
|
||||
var ret = "f0cked "+String(rows[0].anzahl);
|
||||
du('./b/', function (err, size) {
|
||||
ret += " f0cks ("+lib.formatSize(size)+")";
|
||||
e.reply(ret);
|
||||
})
|
||||
});
|
||||
},
|
||||
desc: 'stats'
|
||||
});
|
||||
};
|
Loading…
Reference in New Issue
Block a user