Update Program.cs
Browse files- Program.cs +42 -4
Program.cs
CHANGED
|
@@ -8,7 +8,9 @@ using Microsoft.Data.Sqlite;
|
|
| 8 |
|
| 9 |
class Program
|
| 10 |
{
|
|
|
|
| 11 |
private static ITelegramBotClient botClient = new TelegramBotClient("8225845285:AAEVa4-XihmcYnwbAhWON4oViC0sCSFqeHs");
|
|
|
|
| 12 |
|
| 13 |
static async Task Main(string[] args)
|
| 14 |
{
|
|
@@ -19,7 +21,7 @@ class Program
|
|
| 19 |
botClient.StartReceiving(HandleUpdateAsync, HandleErrorAsync, new ReceiverOptions(), cts.Token);
|
| 20 |
|
| 21 |
Console.WriteLine("Бот работает!");
|
| 22 |
-
await Task.Delay(-1);
|
| 23 |
}
|
| 24 |
|
| 25 |
static void InitDB()
|
|
@@ -31,22 +33,58 @@ class Program
|
|
| 31 |
command.ExecuteNonQuery();
|
| 32 |
}
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
static async Task HandleUpdateAsync(ITelegramBotClient bot, Update update, CancellationToken ct)
|
| 35 |
{
|
| 36 |
if (update.Message is not { Text: { } messageText } message) return;
|
| 37 |
|
| 38 |
long chatId = message.Chat.Id;
|
|
|
|
|
|
|
| 39 |
|
|
|
|
| 40 |
if (messageText == "/start")
|
| 41 |
{
|
| 42 |
-
await bot.SendTextMessageAsync(chatId, "🛡 **OSINT BOT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
return;
|
| 44 |
}
|
| 45 |
|
| 46 |
// Логика поиска
|
| 47 |
-
await bot.SendTextMessageAsync(chatId, "🔎 Ищу данны
|
| 48 |
await Task.Delay(1000);
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
}
|
| 51 |
|
| 52 |
static Task HandleErrorAsync(ITelegramBotClient bot, Exception ex, CancellationToken ct)
|
|
|
|
| 8 |
|
| 9 |
class Program
|
| 10 |
{
|
| 11 |
+
// Твой токен и ID админа
|
| 12 |
private static ITelegramBotClient botClient = new TelegramBotClient("8225845285:AAEVa4-XihmcYnwbAhWON4oViC0sCSFqeHs");
|
| 13 |
+
private const long AdminId = 2032620613;
|
| 14 |
|
| 15 |
static async Task Main(string[] args)
|
| 16 |
{
|
|
|
|
| 21 |
botClient.StartReceiving(HandleUpdateAsync, HandleErrorAsync, new ReceiverOptions(), cts.Token);
|
| 22 |
|
| 23 |
Console.WriteLine("Бот работает!");
|
| 24 |
+
await Task.Delay(-1);
|
| 25 |
}
|
| 26 |
|
| 27 |
static void InitDB()
|
|
|
|
| 33 |
command.ExecuteNonQuery();
|
| 34 |
}
|
| 35 |
|
| 36 |
+
static string GetUserRank(long id)
|
| 37 |
+
{
|
| 38 |
+
using var connection = new SqliteConnection("Data Source=users.db");
|
| 39 |
+
connection.Open();
|
| 40 |
+
var command = connection.CreateCommand();
|
| 41 |
+
command.CommandText = "SELECT Rank FROM Users WHERE Id = @id";
|
| 42 |
+
command.Parameters.AddWithValue("@id", id);
|
| 43 |
+
var result = command.ExecuteScalar();
|
| 44 |
+
return result?.ToString() ?? "Free";
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
static async Task HandleUpdateAsync(ITelegramBotClient bot, Update update, CancellationToken ct)
|
| 48 |
{
|
| 49 |
if (update.Message is not { Text: { } messageText } message) return;
|
| 50 |
|
| 51 |
long chatId = message.Chat.Id;
|
| 52 |
+
long userId = message.From.Id;
|
| 53 |
+
string rank = GetUserRank(userId);
|
| 54 |
|
| 55 |
+
// Команда /start
|
| 56 |
if (messageText == "/start")
|
| 57 |
{
|
| 58 |
+
await bot.SendTextMessageAsync(chatId, $"🛡 **OSINT BRYX BOT**\n\nВаш ID: `{userId}`\nВаш статус: **{rank}**\n\nВведите запрос для поиска.");
|
| 59 |
+
return;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
// Админ-панель
|
| 63 |
+
if (messageText == "/admin")
|
| 64 |
+
{
|
| 65 |
+
if (userId == AdminId)
|
| 66 |
+
{
|
| 67 |
+
await bot.SendTextMessageAsync(chatId, "👑 **Панель администратора**\nБот работает стабильно.");
|
| 68 |
+
}
|
| 69 |
+
else
|
| 70 |
+
{
|
| 71 |
+
await bot.SendTextMessageAsync(chatId, "❌ У вас нет прав доступа к этой команде.");
|
| 72 |
+
}
|
| 73 |
return;
|
| 74 |
}
|
| 75 |
|
| 76 |
// Логика поиска
|
| 77 |
+
await bot.SendTextMessageAsync(chatId, "🔎 *Ищу в базах данных...*");
|
| 78 |
await Task.Delay(1000);
|
| 79 |
+
|
| 80 |
+
if (rank == "Free" && userId != AdminId)
|
| 81 |
+
{
|
| 82 |
+
await bot.SendTextMessageAsync(chatId, "⚠️ **Результат скрыт!**\nНайдено совпадение в архивах. Для получения полных данных купите VIP.\n\n➡ По поводу покупки: @PTYR3");
|
| 83 |
+
}
|
| 84 |
+
else
|
| 85 |
+
{
|
| 86 |
+
await bot.SendTextMessageAsync(chatId, $"✅ **Данные для {messageText}:**\n[Источник 1]: Найдено\n[Источник 2]: Приватная база\nСтатус: VIP доступ активен.");
|
| 87 |
+
}
|
| 88 |
}
|
| 89 |
|
| 90 |
static Task HandleErrorAsync(ITelegramBotClient bot, Exception ex, CancellationToken ct)
|