Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bd-js2-0

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bd-js2-0 - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

.bash_history

20

functions.js
const functions = {
$replyIn: {
name: "$replyIn",
entity: "$replyIn[time]",
description: "delays the command for give time."
} ,
$cooldown: {
name: "$cooldown",
entity: "$cooldown[time;error message]",
description: "sets a command cool down.",
},
$onlyIf: {
name: "$onlyIf",
description: "checks if the condition is true or or false. If false, it'll return the error message.",
entity: "$onlyIf[value==value2;error message] or $onlyIf[value!=value2;error message] or $onlyIf[value>value2;error message] or $onlyIf[value<value2;error message]"
},
$userID: {

@@ -87,2 +102,7 @@ name: "$userID",

},
$image: {
name: "$image",
entity: "$image[url]",
description: "adds image to the embed."
},
$footer: {

@@ -89,0 +109,0 @@ name: "$footer",

2

helper.js

@@ -5,3 +5,3 @@ const Discord = require('discord.js')

client.login("Njc0MzM2MjcxNDYzODc0NTgw.XnkBlQ.aw2x0kxdBtFElUrZ8FZTHJ4KbIA")
client.login("Njc0MzM2MjcxNDYzODc0NTgw.Xnkvzg.pU3BzS8MXyCddbsOWA3CgvepdeY") //"Njc0MzM2MjcxNDYzODc0NTgw.XnkBlQ.aw2x0kxdBtFElUrZ8FZTHJ4KbIA")

@@ -8,0 +8,0 @@ client.commands = new Discord.Collection()

const Discord = require('discord.js')
const client = new Discord.Client()
client.spaceCommands = new Discord.Collection()
client.commands = new Discord.Collection()

@@ -32,2 +33,24 @@ client.vars = {}

if (client.spaceCommands.size) {
client.spaceCommands.map(async command => {
client.embed = new Discord.RichEmbed()
let args = message.content.slice(0).trim().split(/ +/g)
let y = args.shift().toLowerCase()
let cmd = command.name
command = command.code
command = await require('./loader.js').execute(command, message, client, args, cmd)
if (command.length && typeof command === "string" && client.embed.title === undefined) message.channel.send(command)
else if (command === undefined && client.embed.title !== undefined) message.channel.send(client.embed)
else if (typeof command === "string" && command.length) message.channel.send(command, client.embed)
})
}
client.embed = new Discord.RichEmbed()

@@ -44,5 +67,7 @@

let cmd = command.name
command = command.code
command = await require('./loader.js').execute(command, message, client, args)
command = await require('./loader.js').execute(command, message, client, args, cmd)

@@ -61,4 +86,10 @@

SpaceCommand(object) {
if (!object.code) return console.error(`Options.code is not defined!`)
if (!object.name) return console.error(`Options.name is undefined!`)
client.spaceCommands.set(object.name, object)
}
}
module.exports = interpreter
const db = require('quick.db')
const ms = require('ms')
const parse = require('parse-ms')
module.exports = {
execute: async(command, message, client, args) => {
execute: async(command, message, client, args, cmd) => {

@@ -30,6 +32,109 @@ let code = command.split("$")

setUserVar: text.split("setUserVar[").length - 1,
userID: text.split("userID[").length - 1
userID: text.split("userID[").length - 1,
onlyIf: text.split("onlyIf[").length - 1
}
for (let i = code.length - 1;i > 0;i--) {
//$cooldown[time;error]
if (code[i].startsWith("cooldown[")) {
let inside = text.split("cooldown[")[1].split("]")[0]
let fields = inside.split(";")
let error = fields[1]
let time = ms(fields[0])
let item = await db.fetch(`${cmd}_${message.guild.id}_${message.author.id}`)
if (item !== null && time - (Date.now() - item) > 999) {
let content = []
Object.entries(parse(time - (Date.now() - item))).map((x, y) => {
if (x[1] > 0 && y < 4) content.push(`${x[1]} ${x[0]}`)
})
if (error) return message.channel.send(error.replace("{time}", content.join(", ")))
return;
} else {
db.set(`${cmd}_${message.guild.id}_${message.author.id}`, Date.now())
text = text.replace(`cooldown[${inside}]`, "")
}
}
//$replyIn[time]
if (code[i].startsWith("replyIn[")) {
let inside = text.split("replyIn[")[1].split("]")[0]
let time = inside
if (isNaN(inside)) inside = ms(inside)
await new Promise(resolve => setTimeout(resolve, inside))
text = text.replace(`replyIn[${time}]`, "")
}
//$onlyIf[]
if (code[i].startsWith("onlyIf[") && text.includes("onlyIf[")) {
let inside = text.split("onlyIf[")[func.onlyIf].split("]")[0]
let fields = inside.split(";")
let error = fields[1]
let condition = fields[0]
let options = ["==", ">", "<", "!="]
if (!options.some(x => condition.includes(x))) return message.channel.send(`❌ Invalid condition in \`$onlyIf[${inside}]\`!`)
if (condition.includes("==")) {
let separator = condition.split("==")
if (separator[0] != separator[1]) {
if (error) return message.channel.send(error)
return
}
} else if (condition.includes("!=")) {
let separator = condition.split("!=")
if (separator[0] == separator[1]) {
if (error) return message.channel.send(error)
return
}
} else if (condition.includes(">")) {
let separator = condition.split(">")
if (isNaN(separator[0]) || isNaN(separator[1])) return message.channel.send(`❌ Invalid number in \`$onlyIf[${inside}]\`!`)
if (Number(separator[0]) < Number(separator[1])) {
if (error) return message.channel.send(error)
return
} else if (condition.includes("<")) {
let separator = condition.split("<")
if (isNaN(separator[1]) || isNaN(separator[0])) return message.channel.send(`❌ Invalid number in \`$onlyIf[${inside}]\`!`)
if (Number(separator[0]) > Number(separator[1])) {
if (error) return message.channel.send(error)
return
}
}
}
text = text.replace(`onlyIf[${inside}]`, "")
func.onlyIf--
}
//userID[user name]

@@ -397,2 +502,11 @@ if (code[i].startsWith("userID[") && text.includes("userID[")) {

if (code[i].startsWith("image[")) {
let inside = text.split("image[")[1].split("]")[0]
client.embed.setImage(inside)
text = text.replace(`image[${inside}]`, "")
}
//$userAvatar[] && $userAvatar[userid]

@@ -399,0 +513,0 @@

@@ -6,3 +6,3 @@ {

"name": "bd-js2-0",
"version": "0.2.0",
"version": "0.2.1",
"description": "Version 2.0 of BDjavascript! Much better than the older one.",

@@ -16,3 +16,5 @@ "main": "index.js",

"discord.js": "^11.5.1",
"quick.db": "^6.3.2"
"quick.db": "^6.3.2",
"ms": "^2.1.2",
"parse-ms": "^2.0.0"
},

@@ -19,0 +21,0 @@ "engines": {

const script = require('./interpreter.js')
const bd = new script({
token: "Njc0MzM2MjcxNDYzODc0NTgw.XnkBlQ.aw2x0kxdBtFElUrZ8FZTHJ4KbIA", //"NjkwNjAyNDkyNDk2NzA3NjU0.Xnj84Q.seIY-OHxAAYhgvWdWY4Ar3EFft0", //"NjkwNjAyNDkyNDk2NzA3NjU0.Xni8wg.N6EnSTxk1dp-C84L2xslXX1KGuE", //"NjkwNjAyNDkyNDk2NzA3NjU0.XnYogQ.p60oGo3a327NIavQD0oNI0F06qU",
token: "Njc0MzM2MjcxNDYzODc0NTgw.Xnkvzg.pU3BzS8MXyCddbsOWA3CgvepdeY", //"Njc0MzM2MjcxNDYzODc0NTgw.XnkBlQ.aw2x0kxdBtFElUrZ8FZTHJ4KbIA", //"NjkwNjAyNDkyNDk2NzA3NjU0.Xnj84Q.seIY-OHxAAYhgvWdWY4Ar3EFft0", //"NjkwNjAyNDkyNDk2NzA3NjU0.Xni8wg.N6EnSTxk1dp-C84L2xslXX1KGuE", //"NjkwNjAyNDkyNDk2NzA3NjU0.XnYogQ.p60oGo3a327NIavQD0oNI0F06qU",
prefix: "?"

@@ -10,3 +10,3 @@ })

name: "eval",
code: "$userID[$message[]]"//"$mentioned[1;yes] $thumbnail[$userAvatar[$mentioned[1;yes]]] $footer[$randomText[Fisherman;gay;helol;lol;iisi;kwk2k]] $description[$randomText[Fisherman;gay;helol;lol;iisi;kwk2k] this is a description xd] $color[$message[]] $title[$username[] heu,? I'm working ')]"//"$color[$message[1]] $title[And this is a title, $username[$authorID]!] $description[And this is an embed description, $username[$authorID]!] $username reeee"
code: `Test $cooldown[30s;Wait {time}.]`//"$mentioned[1;yes] $thumbnail[$userAvatar[$mentioned[1;yes]]] $footer[$randomText[Fisherman;gay;helol;lol;iisi;kwk2k]] $description[$randomText[Fisherman;gay;helol;lol;iisi;kwk2k] this is a description xd] $color[$message[]] $title[$username[] heu,? I'm working ')]"//"$color[$message[1]] $title[And this is a title, $username[$authorID]!] $description[And this is an embed description, $username[$authorID]!] $username reeee"
})

@@ -18,2 +18,7 @@

/*bd.SpaceCommand({
code: "<@$authorID>",
name: "meh"
})*/
bd.MessageEvent()

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc