Merge branch 'f0ckdev' into 'master'
rand by user See merge request !91
This commit is contained in:
commit
5f0e05dc75
|
@ -1,11 +1,21 @@
|
|||
module.exports = (lib) => {
|
||||
lib.trigger.add({
|
||||
name: 'f0ckrand',
|
||||
call: /^gib f0ck$/i,
|
||||
call: /^gib f0ck/i,
|
||||
level: 0,
|
||||
active: 1,
|
||||
func: (e) => {
|
||||
lib.sql.query("select `id`,`username` from `f0ck`.`items` order by rand() limit 1", (err, rows, fields) => {
|
||||
let args = lib.sql.escape(e.message).split(" ");
|
||||
args.shift();
|
||||
args.shift();
|
||||
|
||||
let query = "select `id`,`username` from `f0ck`.`items` ";
|
||||
if(args.length > 0)
|
||||
query += "where `username` like '" + args.join("' || `username` like '");
|
||||
query += "order by rand() limit 1";
|
||||
|
||||
console.log( query );
|
||||
lib.sql.query(query, (err, rows, fields) => {
|
||||
if(!err)
|
||||
e.reply("f0ckrnd: "+lib.cfg.main.url+"/"+rows[0].id+" by: "+rows[0].username);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user