1.0.1-readmesucks-addedbadges • Published 2 years ago

bdfd2js v1.0.1-readmesucks-addedbadges

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

npm.io npm.io npm.io

BDFD2DJS

BDFD2DJS is an npm package that allows you to use Bot Designer for Discord's functions in normal discord.js.

The package exposes the following:

BDFD#message()
BDFD#functions

The former can be called in your message event to set up your message object, while the latter shows you which functions you can use.

BDFD#message()

Parameters:

message (type: Discord.Message)

// client initalization above
const BDFD = require('bdfd2js')

// I recommend you do it like this so you don't overwrite the original message object
client.on('message', (_) => {
    const message = BDFD.message(_) // Return value is a new message object, read below
})

BDFD#message() return value

The return value is the original message object, but with a new function: Message#code
It will execute any BDFD code and replace anything that is in BDFD#functions.

// client initalization above
const BDFD = require('bdfd2js')

client.on('message', (_) => {
    const message = BDFD.message(_)

    const args = message.content.split(/ +/g)
    const command = args.shift();

    if (command == "!hi") {
        message.channel.send(message.code("Hi <@$authorID>! 👋"))
    }
})

To read more on BDFD's functions, I recommend you read the function help in their app, which I have kindly linked here for Google Play and for the App Store.