API Reference

Complete API documentation for Disflow framework.

bot.command.new()

Define a new slash command:

bot.command.new(name, description, handler, [options])

Parameters

  • name (string) - Command name (lowercase, no spaces)
  • description (string) - Command description
  • handler (function) - Async function to handle command
  • options (array) - Optional command parameters

Context Methods (this)

Interaction Methods

this.reply(content)

Reply to the interaction (first response)

this.edit(content)

Edit the previous reply

this.defer(ephemeral?)

Defer reply for long operations (3+ seconds)

this.followUp(content)

Send additional follow-up message

this.update(content)

Update button interaction message

Parameter Getters

this.getString(name) - Get string parameter
this.getInteger(name) - Get integer parameter
this.getBoolean(name) - Get boolean parameter
this.getUser(name) - Get user parameter
this.getChannel(name) - Get channel parameter
this.getRole(name) - Get role parameter

Context Properties

Discord Objects

this.user

User who ran command

this.guild

Current server/guild

this.channel

Current channel

this.client

Discord.js client

Custom Data

this.emoji

Custom emoji dictionary

this.vals

Global values

this.random

Random utilities

this.time

Time utilities

Random Utilities

this.random.number(min, max)

Random integer between min and max (inclusive)

this.random.bool()

Random true or false

this.random.pick(array)

Random element from array

this.random.string(pattern)

Random string from pattern ("A to Z" or "a,b,c")

Time Utilities

this.time.parse(string)

Parse "+5" (relative) or "17.30" (absolute) to Date

this.time.now()

Current Date object

this.time.unix(date)

Convert Date to Unix timestamp (seconds)

this.time.format(date)

Format Date to readable string

Global Functions

Buttons

button(id, label, style) - Create button component
row(...components) - Create action row
onButton(id, handler) - Handle button click

Embeds

embed(options) - Create embed with auto string conversion

Events

on(event, handler) - Listen to Discord event
once(event, handler) - Listen to event once

Logging

log(message, options) - Log to Discord channel
logInfo(message, title) - Info log (blue)
logWarning(message) - Warning log (yellow)
logError(error, context) - Error log (red)
logSuccess(message) - Success log (green)

Channels

createChannel(name, options) - Create new channel
findChannel(name) - Find channel by name
sendTo(channel, content) - Send message to channel

Command Option Types

Parameter types for command options:

type: 3String
type: 4Integer
type: 5Boolean
type: 6User
type: 7Channel
type: 8Role