
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
A NodeJS package to help interacting with Facebook Messenger API (fca-unofficial)
A NodeJS package to interact with Facebook Messenger API (fca-unofficial)
Inspired by discord.js
npm install fca-utils
import { Client } from 'fca-utils'
const client = new Client({
prefix: "!", // Prefix for commands
ignoreMessageInCommandEvent: true, // Ignore message in command event
});
client.loginWithAppState(process.env.BASE64_ENCODED_APPSTATE);
client.on("ready", (api, curID) => {
console.log("LOGGED IN AS", curID);
console.log("Listening for messages...");
});
Login with username and password coming soon...
client.on(EVENT, (msg) => {
// Do something
});
error
- Account error (locked/expired, etc.)message
- When a message is receivedcommand
- When a command is executed (only if prefix is set)reaction
- When a reaction is added to a messageunsend
- When a message is unsentevent
- When an event is received, such as rename, kick/add users, etc.others
- Others events: typ
, read
, presence
, read_receipt
client.on("message", (msg) => {
console.log("Message received:", msg.body);
if (msg.type === "message") {
try {
if (msg.args[0]?.toLowerCase() === "hi") {
msg.reply("Hello!");
}
} catch (e) {
console.error(e);
}
}
});
Basic msg properties:
msg.body
- Message bodymsg.args
- Array of message body splitted by spaces/line breaksmsg.senderID
- ID of the sendermsg.threadID
- ID of the thread/groupmsg.attachments
- Array of attachmentsmsg.mentions
- Array of mentionsBasic msg methods:
msg.send("your message")
- Send a message back to the threadmsg.reply("your message")
- Reply to the messageclient.on("command", async (cmd) => {
console.log("Command received:", cmd.name);
try {
if (cmd.name === "ping") {
await cmd.message.reply("Pong!");
}
} catch (e) {
console.error(e);
}
})
cmd properties:
cmd.message
- same as the msg object in "message" eventcmd.name
- name of the commandcmd.commandArgs
- array of command arguments, for example:
!ping hello world
-> ["hello", "world"]
client.on("reaction", (msg) => {
// Do something
});
client.on("unsend", (msg) => {
// Do something
});
client.on("event", (msg) => {
// Do something
});
client.on("others", (msg) => {
// Do something
});
Comming soon...
FAQs
A NodeJS package to help interacting with Facebook Messenger API (fca-unofficial)
The npm package fca-utils receives a total of 4 weekly downloads. As such, fca-utils popularity was classified as not popular.
We found that fca-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.