Sign In

connect

This event is triggered when ForgeDB is connected with ForgeScript

v2.0.0+

Register the event

Enable connect in events in your ForgeDB options in index.js:

const { ForgeClient } = require("@tryforge/forgescript")
const { ForgeDB } = require("@tryforge/forge.db")

const db = new ForgeDB({
  events: [
    "connect"
  ]
})

const client = new ForgeClient({
  events: [
    "clientReady"
  ],
  intents: [
    "Guilds"
  ],
  extensions: [
    db
  ]
})

Handle the event

Listen and react when connect is triggered using an inline command or an external handler file:

db.commands.add({
  type: "connect",
  code: `$log[connect event was triggered!]`
})

Was this page helpful?