Giter Site home page Giter Site logo

d.js-bdscript-next's Introduction

This is the rewrite version of D.js-BDscript

Rewrite Status

✔️ - Typings
✔️ - Variables
✔️ - Database
❌ - All Functions
❌ - Custom Prefixes
🛠️ - Full Embed Support
✔️ - Status Manager
✔️ - Slash Command Support
❌ - All Condensed Functions
🛠️ - Button Support
🛠️ - Music Support
✔️ - Command Manager
🛠️ - event

Examples (Setting up a bot with eval)

const { Bot } = require("d.js-bdscript")

const bot = new Bot({
    prefix: "prefix", //or array of prefixes
    token: "token" //optional, can also be passed to bot.login()
})

bot.command({
    name: "gay",
    type: "basicCommand",
    code: `
    $if[$authorID==$client[owners];
        $eval[$message]
    ;
        No permissions!
    ]`
})

bot.event("onMessage")

bot.login("token")

Using the built-in command manager / handler

Supposing our commands are all located in commands folder (and sub-folders) and they look as follows:

module.exports = {
    type: "basicCommand",
    name: "ping",
    code: `pong!`
}

We will use:

//Loading commands
bot.manager.load("./commands/") 

//Refreshing commands loaded with command manager
//this can go in the command manager folder too.
bot.command({
    type: "basicCommand",
    name: "reload",
    code: `
    $if[$authorID==$client[owners];
        $updateCommands commands were updated!
    ;
        No permissions!
    ]
    `
})

Creating variables and using them

This creates 2 variables:

bot.variable([
    {
        name: "coins",
        default: 0,
        type: "INTEGER"
    },
    {
        name: "username",
        type: "TEXT"
    }
])

Setting and getting the value right after (you can paste this command in one of your codes):

$setVar[coins;15;$authorID;user]
$setVar[username;$user[$authorID;username];$authorID;user]

$getVar[username;$authorID;user] has $getVar[coins;$authorID;user] coins!

Using slash commands

We first create the slash command data.

bot.createSlashCommandData({
    name: "test",
    description: "simple test command",
    options: [
        {
            name: "target",
            type: "USER",
            required: false,
            description: "the user to mention!"
        }
    ]
})

Now we have to create it on Discord:

//global slash command
bot.command({
    type: "readyCommand",
    code: `
    $createSlashCommand[global;test]
    `
})

//guild slash command
bot.command({
    type: "readyCommand",
    code: `
    $createSlashCommand[123456789012345678;test]
    `
})

//replying to them
bot.command({
    type: "slashCommand",
    code: `$reply hello $if[$slashOption[target]==;;<@$slashOption[target]>]`
})

//be sure to enable the slash command event
//skip this if you already did.
bot.event("onInteraction")

Creating buttons and replying to them

Soon...

d.js-bdscript-next's People

Contributors

yuzutheneko avatar devspen avatar ghostwasfound13 avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.