Skip to content
This repository was archived by the owner on Sep 25, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ scripts/cmds/assets/guide
scripts/events/tmp/*
scripts/events/data/leaveAttachment
scripts/events/data/welcomeAttachment
!scripts/events/tmp/.gitkeep
!scripts/events/tmp/.gitkeep

Fca_Database
92 changes: 7 additions & 85 deletions Goat.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
* Cảm ơn bạn đã sử dụng
*/

/*
* original author : @ntkhang03
* refactor for nexus-fca, cleaned garbage and simplified by : @tas33n
*/

process.on('unhandledRejection', error => console.log(error));
process.on('uncaughtException', error => console.log(error));

const axios = require("axios");
const fs = require("fs-extra");
const google = require("googleapis").google;
const nodemailer = require("nodemailer");
const { execSync } = require('child_process');
const log = require('./logger/log.js');
const path = require("path");
Expand Down Expand Up @@ -217,86 +219,6 @@ if (config.autoRestart) {
}

(async () => {
// ———————————————— SETUP MAIL ———————————————— //
const { gmailAccount } = config.credentials;
const { email, clientId, clientSecret, refreshToken } = gmailAccount;
const OAuth2 = google.auth.OAuth2;
const OAuth2_client = new OAuth2(clientId, clientSecret);
OAuth2_client.setCredentials({ refresh_token: refreshToken });
let accessToken;
try {
accessToken = await OAuth2_client.getAccessToken();
}
catch (err) {
throw new Error(getText("Goat", "googleApiTokenExpired"));
}
const transporter = nodemailer.createTransport({
host: 'smtp.gmail.com',
service: 'Gmail',
auth: {
type: 'OAuth2',
user: email,
clientId,
clientSecret,
refreshToken,
accessToken
}
});

async function sendMail({ to, subject, text, html, attachments }) {
const transporter = nodemailer.createTransport({
host: 'smtp.gmail.com',
service: 'Gmail',
auth: {
type: 'OAuth2',
user: email,
clientId,
clientSecret,
refreshToken,
accessToken
}
});
const mailOptions = {
from: email,
to,
subject,
text,
html,
attachments
};
const info = await transporter.sendMail(mailOptions);
return info;
}

global.utils.sendMail = sendMail;
global.utils.transporter = transporter;

// ———————————————— CHECK VERSION ———————————————— //
const { data: { version } } = await axios.get("https://raw.githubusercontent.com/ntkhang03/Goat-Bot-V2/main/package.json");
const currentVersion = require("./package.json").version;
if (compareVersion(version, currentVersion) === 1)
utils.log.master("NEW VERSION", getText(
"Goat",
"newVersionDetected",
colors.gray(currentVersion),
colors.hex("#eb6a07", version),
colors.hex("#eb6a07", "node update")
));
// —————————— CHECK FOLDER GOOGLE DRIVE —————————— //
const parentIdGoogleDrive = await utils.drive.checkAndCreateParentFolder("GoatBot");
utils.drive.parentID = parentIdGoogleDrive;
// ———————————————————— LOGIN ———————————————————— //
// ———————————————— START BOT INTANCE ———————————————— //
require(`./bot/login/login${NODE_ENV === 'development' ? '.dev.js' : '.js'}`);
})();

function compareVersion(version1, version2) {
const v1 = version1.split(".");
const v2 = version2.split(".");
for (let i = 0; i < 3; i++) {
if (parseInt(v1[i]) > parseInt(v2[i]))
return 1; // version1 > version2
if (parseInt(v1[i]) < parseInt(v2[i]))
return -1; // version1 < version2
}
return 0; // version1 = version2
}
})();
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,63 @@

## 🦾 Fork Version: What’s Different?

This fork is a lightweight, modernized version of Goat-Bot-V2:

- Removed all verification, Google APIs, and dashboard features—only `/uptime` API remains.
- Uses [nexus-fca](https://github.com/tas33n/nexus-fca) for Facebook integration.
- Cleaned up config files and dependencies for simplicity.
- Codebase is easier to read and extend.

---

## 🚀 Running the Bot

You only need to provide **login info** — either via a **cookie file** or **email/password** — and you’re good to go.

### 1. Clone & Install

```bash
git clone https://github.com/tas33n/Goat-Bot-V2.git
cd Goat-Bot-V2
npm install
```

### 2. Choose your login method

#### 🔑 Option A: Using `cookiex.txt`

* Place your **Facebook cookies or appstate** inside a file named `account.txt` at the root of the project.
* The bot will automatically load it.

#### 📧 Option B: Using `config.json`

Edit the `config.json` file and fill in your Facebook account info:

```json
{
"facebookAccount": {
"email": "your_fb_email",
"password": "your_fb_password",
"twofactor": "123456",
...
}
}
```

* `email` + `password` are required.
* `twofactor` is optional — add if your account has 2FA enabled.

### 3. Start the bot

```bash
npm start
```

That’s it 🎉 The bot should now be running.

---
unquote readme
---
<img src="https://i.ibb.co/RQ28H2p/banner.png" alt="banner">
<h1 align="center"><img src="./dashboard/images/logo-non-bg.png" width="22px"> Goat Bot - Bot Chat Messenger</h1>

Expand Down
Loading