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 descriptionhandler(function) - Async function to handle commandoptions(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 parameterthis.getInteger(name) - Get integer parameterthis.getBoolean(name) - Get boolean parameterthis.getUser(name) - Get user parameterthis.getChannel(name) - Get channel parameterthis.getRole(name) - Get role parameterContext Properties
Discord Objects
this.userUser who ran command
this.guildCurrent server/guild
this.channelCurrent channel
this.clientDiscord.js client
Custom Data
this.emojiCustom emoji dictionary
this.valsGlobal values
this.randomRandom utilities
this.timeTime 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 componentrow(...components) - Create action rowonButton(id, handler) - Handle button clickEmbeds
embed(options) - Create embed with auto string conversionEvents
on(event, handler) - Listen to Discord eventonce(event, handler) - Listen to event onceLogging
log(message, options) - Log to Discord channellogInfo(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 channelfindChannel(name) - Find channel by namesendTo(channel, content) - Send message to channelCommand Option Types
Parameter types for command options:
type: 3Stringtype: 4Integertype: 5Booleantype: 6Usertype: 7Channeltype: 8Role