Socket
Book a DemoInstallSign in
Socket

fca-dung-bot

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

fca-dung-bot

Simple chat bot with nodejs

1.0.0
unpublished
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

NOTE

  • Lười nên chưa có documents, thắc mắc ibox: https://www.facebook.com/dunndunneee/
  • Get appState dùng: https://github.com/c3cbot/c3c-fbstate
  • Video (Comming soon)

INSTALL

npm install fca-dung-bot

GETTING STARTED

  • Cấu trúc thư mục
project
|   node_modules
|   index.js
|   appState.json
|   SayHello.js
|   MyController.js
  • index.js
const {Deploy, utils} = require('fca-dung-bot')
const {Fs} = utils
const MyController = require('./MyController')
class MyDeploy extends Deploy {
  constructor() {
    super();
    const appState = Fs.getJSON(__dirname + "/appState.json");
    this.setConfig({
      config: {
        name: "Dunn Bot", // Tên của bot,
        own: "100000000000000", // ID facebook admin
        prefix: "!", // Prefix mặc định của bot
        subAdmins: ["100000000000000"], // ID facebook của sub admins
      },
    });
    this.setController(new MyController());
    this.facebook(appState)
      .then((client) => {
        // write your code here
      })
      .catch(console.log);
  }
}

new MyDeploy();
  • MyController.js
const {Controller} = requrie('fca-dung-bot')
const SayHello = require('./SayHello')
class MyController extends Controller {
  constructor() {
    super();
    this.commands.add(null, new SayHello());
  }
}
module.exports = MyController
  • SayHello.js
const {Command} = require('fca-dung-bot')
class SayHello extends Command {
  name = "sayhello"; // Tên của command (bắt buộc) là tên người dùng gọi
  description = "Say hello to you";
  guide = "sayhello";

  /**
   *
   * @param {import('fca-dung-bot/lib/types').CommandPs} params
   */
  async onCall(params) {
    const { event, message, api } = params;
    // https://github.com/Schmavery/facebook-chat-api
    api.sendMessage(
      "Hello world!",
      event.threadID,
      (err, info) => {
        if (err) return console.log(err);
      },
      event.messageID
    );
    // hàm reply của dunn-bot
    message.reply("Hello world!", event.threadID, event.messageID);

    // return string để bot tự động reply
    return "Hello world!";
  }
}
module.exports = SayHello

Comming Soon

Keywords

dunn

FAQs

Package last updated on 21 Mar 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.