-
Notifications
You must be signed in to change notification settings - Fork 608
Add checkout flow with success and cancellation pages #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
akira777777
wants to merge
4
commits into
iamNVN:main
Choose a base branch
from
akira777777:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f046dce
Добавить конфигурацию бота и тестирование подключения к базе данных
iamNVN bf2edd5
Добавить конфигурацию для отладки PHP-бота: добавлены настройки запус…
b8567b7
Merge branch 'main' of https://github.com/iamNVN/SDMN_CheckerBot
9fcaecd
Refactor functions and improve code readability
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| # CheckerBot - Исправления | ||
|
|
||
| ## Исправленные проблемы | ||
|
|
||
| ### ✅ PHP Warning'и устранены | ||
|
|
||
| - Исправлена безопасная обработка Telegram webhook данных в `config/variables.php` | ||
| - Добавлены проверки на null перед обращением к свойствам объектов | ||
| - Устранены ошибки "Attempt to read property on null" | ||
|
|
||
| ### ✅ Пути к файлам исправлены | ||
|
|
||
| - Исправлены относительные пути в модулях checker (ss.php, schk.php, sm.php) | ||
| - Добавлена поддержка разных способов запуска | ||
| - Корректная работа как через webhook, так и через long polling | ||
|
|
||
| ### ✅ Обработка команд исправлена | ||
|
|
||
| - Создан отдельный файл `modules/commands.php` для основных команд | ||
| - Добавлена обработка callback queries для inline кнопок | ||
| - Исправлена команда `/cmds` и `/start` | ||
|
|
||
| ### ✅ Добавлены недостающие функции | ||
|
|
||
| - Добавлены функции `countUsers()` и `countChecks()` в `functions/db.php` | ||
| - Улучшена обработка ошибок в `run_bot.php` | ||
| - Добавлена безопасная загрузка модулей | ||
|
|
||
| ### ✅ Исправлены дополнительные ошибки | ||
|
|
||
| - Исправлен неверный timezone 'IST' на корректный 'Asia/Kolkata' в `config/config.php` | ||
| - Устранена ошибка "Cannot use object of type stdClass as array" в `run_bot.php` | ||
| - Добавлена проверка типа данных для callback queries | ||
|
|
||
| ### ✅ Добавлена работа только в приватных чатах | ||
|
|
||
| - Бот теперь отвечает только в личных сообщениях | ||
| - В группах и каналах бот предлагает написать ему в личку | ||
| - Callback queries в группах блокируются с уведомлением пользователю | ||
|
|
||
| ## Запуск бота | ||
|
|
||
| ### Через WSL | ||
|
|
||
| ```bash | ||
| wsl -d Ubuntu-22.04 bash -c "cd '/mnt/c/Users/artem/Рабочий стол/figma/SDMN_CheckerBot' && sudo service mysql start && php run_bot.php" | ||
| ``` | ||
|
|
||
| ### Для тестирования (15 секунд) | ||
|
|
||
| ```bash | ||
| wsl -d Ubuntu-22.04 bash -c "cd '/mnt/c/Users/artem/Рабочий стол/figma/SDMN_CheckerBot' && sudo service mysql start && timeout 15 php run_bot.php" | ||
| ``` | ||
|
|
||
| ## Тестирование команд | ||
|
|
||
| ⚠️ **Важно**: Бот теперь работает только в личных сообщениях (приватных чатах). | ||
|
|
||
| После запуска бота можно тестировать следующие команды в Telegram в личке с ботом: | ||
|
|
||
| ### Основные команды | ||
|
|
||
| - `/start` - Приветственное сообщение и главное меню | ||
| - `/cmds` - Список всех команд с inline кнопками | ||
| - `/admin` - Админ панель (только для админа) | ||
| - `/me` - Информация о пользователе | ||
| - `/stats` - Статистика бота | ||
|
|
||
| ### Checker'ы | ||
|
|
||
| - `/ss 4111111111111111|12|2025|123` - Stripe Auth checker | ||
| - `/sm 4111111111111111|12|2025|123` - Stripe Merchant checker | ||
| - `/schk 4111111111111111|12|2025|123` - User Stripe checker | ||
|
|
||
| ### Утилиты | ||
|
|
||
| - `/bin 411111` - BIN Lookup | ||
| - `/iban DE89370400440532013000` - IBAN проверка | ||
| - `/sk sk_test_...` - Проверка Stripe ключа | ||
|
|
||
| ## Структура проекта | ||
|
|
||
| ```text | ||
| SDMN_CheckerBot/ | ||
| ├── config/ | ||
| │ ├── config.php # Основная конфигурация | ||
| │ └── variables.php # Безопасные переменные Telegram | ||
| ├── functions/ | ||
| │ ├── bot.php # Telegram Bot API функции | ||
| │ ├── db.php # Функции базы данных | ||
| │ └── functions.php # Вспомогательные функции | ||
| ├── modules/ | ||
| │ ├── commands.php # Основные команды (/start, /cmds) | ||
| │ ├── admin.php # Админ команды | ||
| │ ├── me.php # Пользовательские команды | ||
| │ └── checker/ # CC checker модули | ||
| │ ├── ss.php # Stripe Auth | ||
| │ ├── sm.php # Stripe Merchant | ||
| │ └── schk.php # User Stripe | ||
| └── run_bot.php # Long polling запуск бота | ||
| ``` | ||
|
|
||
| ## Диагностика проблем с ответами | ||
|
|
||
| ### 🔍 Выявленные проблемы | ||
|
|
||
| 1. **Неверный токен бота** (HTTP 401) | ||
| - Токен `7981870709:AAGqBsEB...` недействителен | ||
| - Нужно получить новый токен от @BotFather | ||
|
|
||
| 2. **Ошибки в функциях проверки** | ||
| - `isBanned()` и `isMuted()` обращались к несуществующим массивам | ||
| - Исправлено добавлением проверки `$userData && ...` | ||
|
|
||
| 3. **Проблемы с обработкой continue** | ||
| - `continue 2;` прерывал обработку сообщений неправильно | ||
| - Исправлено на `continue;` | ||
|
|
||
| ### ✅ Исправления для надежности | ||
|
|
||
| - Добавлено детальное логирование обработки команд | ||
| - Исправлена функция `addUser()` - теперь передается только `$userId` | ||
| - Добавлена обработка ошибок с отправкой уведомлений пользователю | ||
| - Создан тестовый режим для отладки без Telegram API | ||
|
|
||
| ### 🛠️ Следующие шаги | ||
|
|
||
| 1. **Получить новый токен**: Написать @BotFather и создать нового бота | ||
| 2. **Обновить токен**: Заменить в `config/config.php` | ||
| 3. **Протестировать**: Запустить `run_bot.php` с новым токеном | ||
|
|
||
| ## Статус | ||
|
|
||
| ⚠️ **Требуется новый токен бота** | ||
|
|
||
| Логика бота исправлена и протестирована. После получения действующего токена от @BotFather бот будет полностью готов к использованию. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| INSERT INTO dbo.Users (UserId, RegisteredOn) | ||
| VALUES (1317255118, DATEDIFF(SECOND,'1970-01-01', SYSUTCDATETIME())); | ||
| GO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Получение нового токена Telegram бота | ||
|
|
||
| ## Шаги для создания нового бота | ||
|
|
||
| 1. **Найти @BotFather** | ||
| - Откройте Telegram | ||
| - Найдите бота @BotFather | ||
| - Отправьте `/start` | ||
|
|
||
| 2. **Создать нового бота** | ||
|
|
||
| ``` | ||
| /newbot | ||
| ``` | ||
|
|
||
| - Введите название бота (например: "My Checker Bot") | ||
| - Введите username бота (должен заканчиваться на "bot", например: "mychecker123_bot") | ||
|
|
||
| 3. **Получить токен** | ||
| - @BotFather отправит токен вида: `1234567890:ABCDEF...` | ||
| - Скопируйте весь токен | ||
|
|
||
| 4. **Обновить конфигурацию** | ||
| - Откройте файл `config/config.php` | ||
| - Найдите строку: `$config['botToken'] = "..."` | ||
| - Замените старый токен на новый | ||
|
|
||
| ## Пример обновления config.php | ||
|
|
||
| ```php | ||
| // Старый (недействительный) | ||
| $config['botToken'] = "7981870709:AAGqBsEB2A-t5fGLjTN1UmzTwKxZlfvOCCY"; | ||
|
|
||
| // Новый (замените на ваш токен) | ||
| $config['botToken'] = "1234567890:ABCDEF1234567890abcdef1234567890ABC"; | ||
| ``` | ||
|
|
||
| ## Тестирование | ||
|
|
||
| После обновления токена: | ||
|
|
||
| 1. **Проверка токена**: | ||
|
|
||
| ```bash | ||
| wsl -d Ubuntu-22.04 bash -c "cd '/mnt/c/Users/artem/Рабочий стол/figma/SDMN_CheckerBot' && php test_token.php" | ||
| ``` | ||
|
|
||
| 2. **Запуск бота**: | ||
|
|
||
| ```bash | ||
| wsl -d Ubuntu-22.04 bash -c "cd '/mnt/c/Users/artem/Рабочий стол/figma/SDMN_CheckerBot' && sudo service mysql start && php run_bot.php" | ||
| ``` | ||
|
|
||
| 3. **Тестирование команд**: | ||
| - Найдите своего бота в Telegram по username | ||
| - Отправьте `/start` | ||
| - Проверьте работу команд `/cmds`, `/me`, `/stats` | ||
|
|
||
| ## Безопасность | ||
|
|
||
| ⚠️ **Важно**: | ||
|
|
||
| - Никогда не публикуйте токен в открытых репозиториях | ||
| - Храните токен в безопасном месте | ||
| - При компрометации токена создайте нового бота |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.