rename AWB to Bot and enhance captcha handling logic
This commit is contained in:
@@ -4,10 +4,10 @@ A Telegram bot designed for secure message forwarding with captcha verification.
|
||||
|
||||
## Features
|
||||
|
||||
- **Captcha Verification**: Users must solve an image-based captcha before their messages are forwarded.
|
||||
- **Captcha Verification**: Users have to solve an image-based captcha before their messages are forwarded (can be disabled).
|
||||
- **Support for All Media**: Forwarding works for text, photos, videos, documents, audio, and voice messages.
|
||||
- **Message Redirection**: Verified messages are automatically redirected to a configured group chat.
|
||||
- **Anonymized Forwarding**: Messages are forwarded with a custom prefix `Forwarding, ID [MSG_ID]:`, maintaining privacy while allowing for message tracking.
|
||||
- **Message Redirection**: Verified messages are automatically redirected to the admins.
|
||||
- **Anonymized Forwarding**: Messages are forwarded with a custom prefix `Forwarding, ID [MSG_ID]:`, maintaining privacy while allowing admins to track messages.
|
||||
- **Locale Support**: Built-in support for multiple languages (defaulting to English).
|
||||
- **Admin Panel**: Authorized admins can access usage statistics and message logs.
|
||||
|
||||
@@ -46,7 +46,7 @@ A Telegram bot designed for secure message forwarding with captcha verification.
|
||||
1. Start the bot with `/start`.
|
||||
2. Send any message or media.
|
||||
3. Solve the image captcha by typing the characters shown.
|
||||
4. Once solved, your message is redirected to the destination group.
|
||||
4. Once solved, your message is redirected to the admins.
|
||||
|
||||
### For Admins
|
||||
- `/stats`: View total user count.
|
||||
|
||||
@@ -17,7 +17,8 @@ class CaptchaStates(StatesGroup):
|
||||
@router.message(CommandStart())
|
||||
async def cmd_start(message: Message, locale: str):
|
||||
db.log_user(message.from_user)
|
||||
await message.answer(_("welcome", locale=locale))
|
||||
welcome_key = "welcome_no_captcha" if settings.disable_captcha else "welcome"
|
||||
await message.answer(_(welcome_key, locale=locale))
|
||||
|
||||
@router.message(CaptchaStates.waiting_for_captcha)
|
||||
async def process_captcha(message: Message, state: FSMContext, bot: Bot, locale: str):
|
||||
|
||||
+3
-2
@@ -1,8 +1,9 @@
|
||||
{
|
||||
"welcome": "Welcome! Send me any message (text, image, video, etc.) and I will redirect it after you solve a simple captcha.",
|
||||
"welcome": "Welcome! Send me any message (text, image, video, etc.) and I will redirect it to the admins after you solve a simple captcha.",
|
||||
"welcome_no_captcha": "Welcome! Send me any message (text, image, video, etc.) and I will redirect it to the admins",
|
||||
"solve_captcha": "Please type the letters/numbers you see on the image to verify you're human.",
|
||||
"redirecting": "Redirecting your message...",
|
||||
"captcha_solved": "Captcha solved! Your message has been redirected.",
|
||||
"captcha_solved": "Captcha solved! Your message has been redirected to the admins.",
|
||||
"captcha_error": "Captcha solved, but there was an error redirecting your message.",
|
||||
"incorrect_captcha": "Incorrect captcha. Please try again with this new image:",
|
||||
"stats_title": "Bot Stats:",
|
||||
|
||||
+3
-2
@@ -1,8 +1,9 @@
|
||||
{
|
||||
"welcome": "Вітаю! Надішліть мені будь-яке повідомлення (текст, зображення, відео тощо), і я перенаправлю його після того, як ви пройдете просту капчу.",
|
||||
"welcome": "Вітаю! Надішліть мені будь-яке повідомлення (текст, зображення, відео тощо), і я перешлю його до адмінів після того, як ви пройдете просту капчу.",
|
||||
"welcome_no_captcha": "Вітаю! Надішліть мені будь-яке повідомлення (текст, зображення, відео тощо), і я перешлю його до адмінів.",
|
||||
"solve_captcha": "Будь ласка, введіть літери/цифри, які ви бачите на зображенні, щоб підтвердити, що ви людина.",
|
||||
"redirecting": "Перенаправляю ваше повідомлення...",
|
||||
"captcha_solved": "Капчу пройдено! Ваше повідомлення було перенаправлено.",
|
||||
"captcha_solved": "Капчу пройдено! Ваше повідомлення було переслано до адмінів.",
|
||||
"captcha_error": "Капчу пройдено, але сталася помилка під час перенаправлення вашого повідомлення.",
|
||||
"incorrect_captcha": "Неправильна капча. Будь ласка, спробуйте ще раз із цим новим зображенням:",
|
||||
"stats_title": "Статистика бота:",
|
||||
|
||||
@@ -24,7 +24,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def main():
|
||||
logger.info("Initializing AWB...")
|
||||
logger.info("Initializing Bot...")
|
||||
|
||||
# Initialize Bot instance with default HTML parsing mode
|
||||
bot = Bot(
|
||||
@@ -75,4 +75,4 @@ if __name__ == "__main__":
|
||||
try:
|
||||
asyncio.run(main())
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
logger.info("AWB execution stopped.")
|
||||
logger.info("Bot execution stopped.")
|
||||
|
||||
+5
-5
@@ -7,7 +7,7 @@ aiofiles==25.1.0 \
|
||||
aiogram==3.29.1 \
|
||||
--hash=sha256:63cd0123e8ab065f78974ad58ff57c1a5c8c35aac1055761859c4a5ad27eaf04 \
|
||||
--hash=sha256:7ac92c64b71d33eb8e3656de4517a1533a88b61728e5dd00b1e11393b669b521
|
||||
# via awb
|
||||
# via bot
|
||||
aiohappyeyeballs==2.7.1 \
|
||||
--hash=sha256:065665c041c42a5938ed220bdcd7230f22527fbec085e1853d2402c8a3615d9d \
|
||||
--hash=sha256:9243213661e29250eb41368e5daa826fc017156c3b8a11440826b2e3ed376472
|
||||
@@ -63,7 +63,7 @@ aiosignal==1.4.0 \
|
||||
aiosqlite==0.22.1 \
|
||||
--hash=sha256:043e0bd78d32888c0a9ca90fc788b38796843360c855a7262a532813133a0650 \
|
||||
--hash=sha256:21c002eb13823fad740196c5a2e9d8e62f6243bd9e7e4a1f87fb5e44ecb4fceb
|
||||
# via awb
|
||||
# via bot
|
||||
annotated-types==0.7.0 \
|
||||
--hash=sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53 \
|
||||
--hash=sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89
|
||||
@@ -75,7 +75,7 @@ attrs==26.1.0 \
|
||||
captcha==0.7.1 \
|
||||
--hash=sha256:8b73b5aba841ad1e5bdb856205bf5f09560b728ee890eb9dae42901219c8c599 \
|
||||
--hash=sha256:a1b462bcc633a64d8db5efa7754548a877c698d98f87716c620a707364cabd6b
|
||||
# via awb
|
||||
# via bot
|
||||
certifi==2026.6.17 \
|
||||
--hash=sha256:024c88eeec92ca068db80f02b8b07c9cef7b9fe261d1d535abfd5abd6f6af432 \
|
||||
--hash=sha256:2227dcbaafe0d2f59279d1762ddddc37783ed4354594f194ffc31d20f41fc3db
|
||||
@@ -258,7 +258,7 @@ pydantic==2.13.4 \
|
||||
--hash=sha256:c40756b57adaa8b1efeeced5c196f3f3b7c435f90e84ea7f443901bec8099ef6
|
||||
# via
|
||||
# aiogram
|
||||
# awb
|
||||
# bot
|
||||
# pydantic-settings
|
||||
pydantic-core==2.46.4 \
|
||||
--hash=sha256:0cbe8b01f948de4286c74cdd6c667aceb38f5c1e26f0693b3983d9d74887c65e \
|
||||
@@ -296,7 +296,7 @@ pydantic-core==2.46.4 \
|
||||
pydantic-settings==2.14.2 \
|
||||
--hash=sha256:a20c97b37910b6550d5ea50fbcc2d4187defe58cd57070b73863d069419c9440 \
|
||||
--hash=sha256:c19dd64b19097f1de80184f0cc7b0272a13ae6e170cbf240a3e27e381ed14a5f
|
||||
# via awb
|
||||
# via bot
|
||||
python-dotenv==1.2.2 \
|
||||
--hash=sha256:1d8214789a24de455a8b8bd8ae6fe3c6b69a5e3d64aa8a8e5d68e694bbcb285a \
|
||||
--hash=sha256:2c371a91fbd7ba082c2c1dc1f8bf89ca22564a087c2c287cd9b662adde799cf3
|
||||
|
||||
Reference in New Issue
Block a user