Download Program.cs from Duelf/OSINT: direct link, hf CLI and curl.
- Browser
- Download file 3.63 kB
-
https://huggingface.co/spaces/Duelf/OSINT/resolve/main/Program.cs
- Command line
-
hf download hf://spaces/Duelf/OSINT/Program.cs
-
curl -L -o Program.cs https://huggingface.co/spaces/Duelf/OSINT/resolve/main/Program.cs
3.63 kB
| using System; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| using Telegram.Bot; | |
| using Telegram.Bot.Types; | |
| using Telegram.Bot.Polling; | |
| using Microsoft.Data.Sqlite; | |
| class Program | |
| { | |
| // Твой токен и ID админа | |
| private static ITelegramBotClient botClient = new TelegramBotClient("8225845285:AAEVa4-XihmcYnwbAhWON4oViC0sCSFqeHs"); | |
| private const long AdminId = 2032620613; | |
| static async Task Main(string[] args) | |
| { | |
| Console.WriteLine("Запуск бота..."); | |
| InitDB(); | |
| using var cts = new CancellationTokenSource(); | |
| botClient.StartReceiving(HandleUpdateAsync, HandleErrorAsync, new ReceiverOptions(), cts.Token); | |
| Console.WriteLine("Бот работает!"); | |
| await Task.Delay(-1); | |
| } | |
| static void InitDB() | |
| { | |
| using var connection = new SqliteConnection("Data Source=users.db"); | |
| connection.Open(); | |
| var command = connection.CreateCommand(); | |
| command.CommandText = "CREATE TABLE IF NOT EXISTS Users(Id INTEGER PRIMARY KEY, Rank TEXT)"; | |
| command.ExecuteNonQuery(); | |
| } | |
| static string GetUserRank(long id) | |
| { | |
| using var connection = new SqliteConnection("Data Source=users.db"); | |
| connection.Open(); | |
| var command = connection.CreateCommand(); | |
| command.CommandText = "SELECT Rank FROM Users WHERE Id = @id"; | |
| command.Parameters.AddWithValue("@id", id); | |
| var result = command.ExecuteScalar(); | |
| return result?.ToString() ?? "Free"; | |
| } | |
| static async Task HandleUpdateAsync(ITelegramBotClient bot, Update update, CancellationToken ct) | |
| { | |
| if (update.Message is not { Text: { } messageText } message) return; | |
| long chatId = message.Chat.Id; | |
| long userId = message.From.Id; | |
| string rank = GetUserRank(userId); | |
| // Команда /start | |
| if (messageText == "/start") | |
| { | |
| await bot.SendTextMessageAsync(chatId, $"🛡 **OSINT BRYX BOT**\n\nВаш ID: `{userId}`\nВаш статус: **{rank}**\n\nВведите запрос для поиска."); | |
| return; | |
| } | |
| // Админ-панель | |
| if (messageText == "/admin") | |
| { | |
| if (userId == AdminId) | |
| { | |
| await bot.SendTextMessageAsync(chatId, "👑 **Панель администратора**\nБот работает стабильно."); | |
| } | |
| else | |
| { | |
| await bot.SendTextMessageAsync(chatId, "❌ У вас нет прав доступа к этой команде."); | |
| } | |
| return; | |
| } | |
| // Логика поиска | |
| await bot.SendTextMessageAsync(chatId, "🔎 *Ищу в базах данных...*"); | |
| await Task.Delay(1000); | |
| if (rank == "Free" && userId != AdminId) | |
| { | |
| await bot.SendTextMessageAsync(chatId, "⚠️ **Результат скрыт!**\nНайдено совпадение в архивах. Для получения полных данных купите VIP.\n\n➡ По поводу покупки: @PTYR3"); | |
| } | |
| else | |
| { | |
| await bot.SendTextMessageAsync(chatId, $"✅ **Данные для {messageText}:**\n[Источник 1]: Найдено\n[Источник 2]: Приватная база\nСтатус: VIP доступ активен."); | |
| } | |
| } | |
| static Task HandleErrorAsync(ITelegramBotClient bot, Exception ex, CancellationToken ct) | |
| { | |
| Console.WriteLine("Ошибка: " + ex.Message); | |
| return Task.CompletedTask; | |
| } | |
| } | |