shell-bash.js
v1.0.8
Published
Create Your Own Terminal With Custom Commands!
Downloads
3
Maintainers
Readme
▶ Bash.js
Create Your Own Terminal/Shell With bash.js
🔨 CREATORS
@FilipinoAko
@Cassy
⚠ WARNING
This is a beta version... so it has some bugs that we dont know
📁 DEPENDENCIES
• discord.js- I Use Discord.JS For The Collection
• readline- To make the custom shell
• EventEmitter- To Create Events
❔ DOCUMENTATION
• Creating Client:
const { Client } = require('shell-bash.js')
const terminal = new Client()
Using new Client()
you can create a new client but... it will show errors...
Thats Because We Dont Define The Options
const { Client } = require('shell-bash.js')
const terminal = new Client({
id: "docs",
prefix: ">>>"
})
The id option will be the name of your terminal
The prefix option is your terminal prefix
Heres all the options:
• prefix- <string>
: The prefix for the terminal
• id- <string>
: The name of the terminal
• messages- <json>
Terminal Messages
Heres how you can make custom messages for your terminal
const { Client } = require('shell-bash.js')
const terminal = new Client({
id: "docs",
prefix: ">>>",
messages: {
commandNotFound: "Terminal: [COMMAND] Not Found",
bashErr: "Terminal: [ERROR]"
}
})
With messages options you can add custom messages
Messages Options:
• commandNotFound- <string>
: When Command Is Not Found! (You can add [COMMAND] to see what command is runned)
• bashErr- <string>
: When system receives error (You can add [ERROR] to see what error is received)
Creating Commands:
const { Client } = require('shell-bash.js')
const terminal = new Client({
id: "docs",
prefix: ">>>",
messages: {
commandNotFound: "Terminal: [COMMAND] Not Found",
bashErr: "Terminal: [ERROR]"
}
})
terminal.registerCommand()
Heres how you can make commands! but just like creating client without options you will receive errors...
So Lets Add The Options!
const { Client } = require('shell-bash.js')
const terminal = new Client({
id: "docs",
prefix: ">>>",
messages: {
commandNotFound: "Terminal: [COMMAND] Not Found",
bashErr: "Terminal: [ERROR]"
}
})
terminal.registerCommand({
name: "name",
description: "description", // default value: description
category: "category", // default value: BashJS
aliases: ["aliases1", "aliases2"], // Default Array: []
run: async(client, args) => {
// args is an array of the arguments
console.log(args[0]) // if you know how array works... your good
// client is an json of you client data
console.log(client)
} // the code that will run if you execute the command you create, (params: client, args)
})
For Creating Command Easily You Can Also Use The Creator We Made
const { Client, Command } = require('shell-bash.js')
const terminal = new Client({
id: "docs",
prefix: ">>>",
messages: {
commandNotFound: "Terminal: [COMMAND] Not Found",
bashErr: "Terminal: [ERROR]"
}
})
// Create The Command
const cmd = new Command()
// Set things
cmd.setName('name')
cmd.setDescription('description') // default value: No Description
cmd.setCategory('category') // default value: BashJS
cmd.setAliases(["aliases1", "aliases2"]) // default array: BashJS
cmd.execute(async(client, args) => {
// args is an array of the arguments
console.log(args[0]) // if you know how array works... your good
// client is an json of you client data
console.log(client)
}) // the code that will run if you execute the command you create, (params: client, args)
terminal.registerCommand(cmd.toInfo()) // convert the data to json
Params:
• args- arguments or string you type after the command (e.g: name bruh<- This is the argument number 1)
• client- Your client data but on JSON
Starting Terminal:
Now We Setup All!! We can now start our terminal
const { Client } = require('shell-bash.js')
const terminal = new Client({
id: "docs",
prefix: ">>>",
messages: {
commandNotFound: "Terminal: [COMMAND] Not Found",
bashErr: "Terminal: [ERROR]"
}
})
terminal.registerCommand({
name: "name",
description: "description",
category: "category",
aliases: ["aliases1", "aliases2"],
run: async(client, args) => {
console.log(args[0])
console.log(client)
}
})
terminal.start()
Using terminal.start()
you can run your terminal
And If You use terminal.destroy()
you can stop your terminal
Your done you have your own terminal!! 😃
🔧 EVENTS
• command - params(client, args)
• ready - params(client)
• stop - params(client)
• error - params(error)
const { Client } = require('shell-bash.js')
const terminal = new Client({
id: "docs",
prefix: ">>>",
messages: {
commandNotFound: "Terminal: [COMMAND] Not Found",
bashErr: "Terminal: [ERROR]"
}
})
terminal.registerCommand({
name: "name",
description: "description",
category: "category",
aliases: ["aliases1", "aliases2"],
run: async(client, args) => {
console.log(args[0])
console.log(client)
}
})
terminal.on('command', async(client, args) => {
console.log(args)
})
terminal.on('ready', async(client) => {
console.log('Terminal Running...')
})
terminal.on('stop', async(client) => {
console.log('Stopped')
})
terminal.on('error', async(error) => {
console.log(error)
terminal.destroy()
})
// Use All Events In the top of terminal.start() or it will not work
terminal.start()
Example Project: https://replit.com/@FilipinoAko/bashJSExample/
🔗 LINKS
• Youtube Channel: Filipino Ako
• Twitch Channel: FilipinoAkoLive
• Discord Server: FilipinoAko Discord
😀 THANK YOU
Enjoy Using Our Package