Sign In

messageCreate

This event is fired when someone sends a message

v1.0.1+

Register the event

Enable messageCreate in events and include the required gateway intents in your ForgeClient options in index.js:

const { ForgeClient } = require("@tryforge/forgescript")

const client = new ForgeClient({
  events: [
    "messageCreate"
  ],
  intents: [
    "GuildMessages",
    "DirectMessages",
    "MessageContent"
  ]
})

Handle the event

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

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

Required Intents

Listening to this event requires:
GuildMessages DirectMessages MessageContent

Was this page helpful?