commit
032aad5bb9
|
@ -6,10 +6,26 @@ module.exports = (lib) => {
|
||||||
active: 1,
|
active: 1,
|
||||||
func: (e) => {
|
func: (e) => {
|
||||||
let args = lib.sql.escape(e.message).split(" ").slice(2);
|
let args = lib.sql.escape(e.message).split(" ").slice(2);
|
||||||
|
let params = {
|
||||||
|
"in": [],
|
||||||
|
"not": []
|
||||||
|
};
|
||||||
|
|
||||||
|
for(let i = 0; i < args.length; i++) {
|
||||||
|
params[(args[0].charAt(0) === "!"?"not":"in")].push(args[0]);
|
||||||
|
}
|
||||||
|
|
||||||
let query = "select `id`,`username` from `f0ck`.`items` ";
|
let query = "select `id`,`username` from `f0ck`.`items` ";
|
||||||
|
//if(args.length > 0)
|
||||||
|
// query += "where `username` like '" + args.join("' || `username` like '");
|
||||||
|
|
||||||
if(args.length > 0)
|
if(args.length > 0)
|
||||||
query += "where `username` like '" + args.join("' || `username` like '");
|
query += "where ";
|
||||||
|
if(params.in.length > 0)
|
||||||
|
query += "`username` like '" + args.join("' || `username` like '");
|
||||||
|
if(params.not.length > 0)
|
||||||
|
query += "`username` not like '" + args.join("' || `username` not like '");
|
||||||
|
|
||||||
query += " order by rand() limit 1";
|
query += " order by rand() limit 1";
|
||||||
|
|
||||||
console.log( query );
|
console.log( query );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user