main.cpp
Browse files
main.cpp
CHANGED
|
@@ -9,22 +9,14 @@
|
|
| 9 |
using namespace std;
|
| 10 |
using namespace TgBot;
|
| 11 |
|
| 12 |
-
// --- КОНФИГУРАЦИЯ ---
|
| 13 |
const string BOT_TOKEN = "8225845285:AAEVa4-XihmcYnwbAhWON4oViC0sCSFqeHs";
|
| 14 |
const int64_t ADMIN_ID = 2032620613;
|
| 15 |
-
const string BOT_NAME = "OSINT-BRYX-BOT";
|
| 16 |
|
| 17 |
sqlite3* db;
|
| 18 |
|
| 19 |
void initDB() {
|
| 20 |
sqlite3_open("users.db", &db);
|
| 21 |
-
|
| 22 |
-
sqlite3_exec(db, sql.c_str(), 0, 0, 0);
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
void setUserRank(int64_t id, string rank) {
|
| 26 |
-
string sql = "INSERT OR REPLACE INTO USERS (ID, RANK, STARS) VALUES (" + to_string(id) + ", '" + rank + "', 0);";
|
| 27 |
-
sqlite3_exec(db, sql.c_str(), 0, 0, 0);
|
| 28 |
}
|
| 29 |
|
| 30 |
string getUserRank(int64_t id) {
|
|
@@ -38,75 +30,48 @@ string getUserRank(int64_t id) {
|
|
| 38 |
return res;
|
| 39 |
}
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp) {
|
| 42 |
((string*)userp)->append((char*)contents, size * nmemb);
|
| 43 |
return size * nmemb;
|
| 44 |
}
|
| 45 |
|
| 46 |
-
string runOsintSearch(string query, string rank) {
|
| 47 |
-
if (rank == "Free") return "⚠️ **Результат скрыт!**\nНайдено совпадение. Для полных данных купите VIP.\n➡ /vip — купить доступ.";
|
| 48 |
-
CURL* curl = curl_easy_init();
|
| 49 |
-
string readBuffer;
|
| 50 |
-
if(curl) {
|
| 51 |
-
string url = "https://api.leakcheck.net/public?check=" + query;
|
| 52 |
-
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
| 53 |
-
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
|
| 54 |
-
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
|
| 55 |
-
curl_easy_perform(curl);
|
| 56 |
-
curl_easy_cleanup(curl);
|
| 57 |
-
}
|
| 58 |
-
return "✅ **Результат:**\n" + (readBuffer.empty() ? "Нет данных." : readBuffer);
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
int main() {
|
| 62 |
initDB();
|
| 63 |
Bot bot(BOT_TOKEN);
|
| 64 |
|
| 65 |
bot.getEvents().onCommand("start", [&](Message::Ptr message) {
|
| 66 |
string rank = getUserRank(message->from->id);
|
| 67 |
-
bot.getApi().sendMessage(message->chat->id, "🛡
|
| 68 |
-
});
|
| 69 |
-
|
| 70 |
-
bot.getEvents().onCommand("vip", [&](Message::Ptr message) {
|
| 71 |
-
vector<LabeledPrice::Ptr> prices;
|
| 72 |
-
auto price = make_shared<LabeledPrice>();
|
| 73 |
-
price->label = "VIP OSINT";
|
| 74 |
-
price->amount = 100;
|
| 75 |
-
prices.push_back(price);
|
| 76 |
-
// Упрощенный вызов счета
|
| 77 |
-
bot.getApi().sendInvoice(message->chat->id, "VIP", "Доступ к базам", "payload_vip", "", "XTR", prices);
|
| 78 |
-
});
|
| 79 |
-
|
| 80 |
-
bot.getEvents().onSuccessfulPayment([&](Message::Ptr message) {
|
| 81 |
-
setUserRank(message->from->id, "VIP");
|
| 82 |
-
bot.getApi().sendMessage(message->chat->id, "🌟 VIP активирован!");
|
| 83 |
});
|
| 84 |
|
| 85 |
bot.getEvents().onCommand("admin", [&](Message::Ptr message) {
|
| 86 |
if (message->from->id == ADMIN_ID) {
|
| 87 |
-
bot.getApi().sendMessage(message->chat->id, "👑 Админ
|
| 88 |
}
|
| 89 |
});
|
| 90 |
|
| 91 |
-
bot.getEvents().onCommand("stats", [&](Message::Ptr message) {
|
| 92 |
-
if (message->from->id != ADMIN_ID) return;
|
| 93 |
-
sqlite3_stmt* stmt;
|
| 94 |
-
sqlite3_prepare_v2(db, "SELECT COUNT(*) FROM USERS", -1, &stmt, 0);
|
| 95 |
-
sqlite3_step(stmt);
|
| 96 |
-
bot.getApi().sendMessage(message->chat->id, "📊 Юзеров: " + to_string(sqlite3_column_int(stmt, 0)));
|
| 97 |
-
sqlite3_finalize(stmt);
|
| 98 |
-
});
|
| 99 |
-
|
| 100 |
bot.getEvents().onAnyMessage([&](Message::Ptr message) {
|
| 101 |
if (message->text.empty() || message->text[0] == '/') return;
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
});
|
| 105 |
|
| 106 |
try {
|
| 107 |
-
|
| 108 |
TgLongPoll longPoll(bot);
|
| 109 |
-
while (true) longPoll.start();
|
| 110 |
-
} catch (exception& e) {
|
|
|
|
| 111 |
return 0;
|
| 112 |
}
|
|
|
|
|
|
| 9 |
using namespace std;
|
| 10 |
using namespace TgBot;
|
| 11 |
|
|
|
|
| 12 |
const string BOT_TOKEN = "8225845285:AAEVa4-XihmcYnwbAhWON4oViC0sCSFqeHs";
|
| 13 |
const int64_t ADMIN_ID = 2032620613;
|
|
|
|
| 14 |
|
| 15 |
sqlite3* db;
|
| 16 |
|
| 17 |
void initDB() {
|
| 18 |
sqlite3_open("users.db", &db);
|
| 19 |
+
sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS USERS(ID INT PRIMARY KEY, RANK TEXT);", 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
}
|
| 21 |
|
| 22 |
string getUserRank(int64_t id) {
|
|
|
|
| 30 |
return res;
|
| 31 |
}
|
| 32 |
|
| 33 |
+
void setUserRank(int64_t id, string rank) {
|
| 34 |
+
string sql = "INSERT OR REPLACE INTO USERS (ID, RANK) VALUES (" + to_string(id) + ", '" + rank + "');";
|
| 35 |
+
sqlite3_exec(db, sql.c_str(), 0, 0, 0);
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp) {
|
| 39 |
((string*)userp)->append((char*)contents, size * nmemb);
|
| 40 |
return size * nmemb;
|
| 41 |
}
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
int main() {
|
| 44 |
initDB();
|
| 45 |
Bot bot(BOT_TOKEN);
|
| 46 |
|
| 47 |
bot.getEvents().onCommand("start", [&](Message::Ptr message) {
|
| 48 |
string rank = getUserRank(message->from->id);
|
| 49 |
+
bot.getApi().sendMessage(message->chat->id, "🛡 OSINT BOT\nВаш статус: " + rank + "\nВведите запрос для поиска.");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
});
|
| 51 |
|
| 52 |
bot.getEvents().onCommand("admin", [&](Message::Ptr message) {
|
| 53 |
if (message->from->id == ADMIN_ID) {
|
| 54 |
+
bot.getApi().sendMessage(message->chat->id, "👑 Админ: используйте /give ID");
|
| 55 |
}
|
| 56 |
});
|
| 57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
bot.getEvents().onAnyMessage([&](Message::Ptr message) {
|
| 59 |
if (message->text.empty() || message->text[0] == '/') return;
|
| 60 |
+
|
| 61 |
+
string rank = getUserRank(message->from->id);
|
| 62 |
+
if (rank == "Free") {
|
| 63 |
+
bot.getApi().sendMessage(message->chat->id, "⚠️ Результат скрыт! Купите VIP у @Duelf");
|
| 64 |
+
} else {
|
| 65 |
+
bot.getApi().sendMessage(message->chat->id, "✅ VIP Данные для: " + message->text + "\n[База 1]: Найдено\n[База 2]: Найдено");
|
| 66 |
+
}
|
| 67 |
});
|
| 68 |
|
| 69 |
try {
|
| 70 |
+
printf("Bot started!\n");
|
| 71 |
TgLongPoll longPoll(bot);
|
| 72 |
+
while (true) { longPoll.start(); }
|
| 73 |
+
} catch (exception& e) { printf("Error: %s\n", e.what()); }
|
| 74 |
+
|
| 75 |
return 0;
|
| 76 |
}
|
| 77 |
+
|