diff --git a/app/games.py b/app/games.py index 385b640..09420bc 100644 --- a/app/games.py +++ b/app/games.py @@ -112,7 +112,7 @@ def load_proxies_from_file(file_path): 'name': 'Pin Out Master', 'app_token': 'd2378baf-d617-417a-9d99-d685824335f0', 'promo_id': 'd2378baf-d617-417a-9d99-d685824335f0', - 'base_delay': 30, + 'base_delay': 20, 'attempts': 35, 'copies': 90, }, @@ -121,7 +121,7 @@ def load_proxies_from_file(file_path): 'app_token': '4bdc17da-2601-449b-948e-f8c7bd376553', 'promo_id': '4bdc17da-2601-449b-948e-f8c7bd376553', 'base_delay': 30, - 'attempts': 35, + 'attempts': 40, 'copies': 90, } ] diff --git a/bot/common/__init__.py b/bot/common/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bot/common/referals.py b/bot/common/referals.py new file mode 100644 index 0000000..47ef014 --- /dev/null +++ b/bot/common/referals.py @@ -0,0 +1,19 @@ +REFERRAL_LINKS = { + 'Cats πŸˆβ€β¬›': 'https://t.me/catsgang_bot/join?startapp=Lv39AXNhcBvwK6ZWcoGpD', + 'πŸ…§ X Empire': 't.me/empirebot/game?startapp=hero452792586', + 'Binance Moonbix 🟠': 'https://t.me/Binance_Moonbix_bot/start?startapp=ref_452792586&startApp=ref_452792586', + 'πŸ₯  Hrum': 't.me/hrummebot/game?startapp=ref452792586', + '🏠 CITY Holder': 'https://t.me/cityholder/game?startapp=452792586', + 'πŸ€– TapSwap': 'https://t.me/tapswap_mirror_2_bot?start=r_452792586', + '⚫️ DotCoin': 'https://t.me/dotcoin_bot?start=r_452792586', + 'πŸ–²οΈ CEX.IO Power Tap': 'https://t.me/cexio_tap_bot?start=1716399236183636', + '⭐ Major': 'https://t.me/major/start?startapp=452792586', + '😺 Catizen': 'https://t.me/catizenbot/gameapp?startapp=r_2779_5703457', + 'πŸͺ™ Blum': 'https://t.me/blum/app?startapp=ref_8U6nYohQav', + 'πŸ‘Ύ Not Pixel': 'https://t.me/notpixel/app?startapp=f452792586', + '🐸 Frog Trader': 'https://t.me/xkucoinbot/kucoinminiapp?startapp' + '=cm91dGU9JTJGdGFwLWdhbWUlM0ZpbnZpdGVyVXNlcklkJTNENDUyNzkyNTg2JTI2cmNvZGUlM0Q=', + 'πŸ”₯ HOT Wallet': 'https://t.me/herewalletbot/app?startapp=9477477', + 'Binance πŸ”Ά': 'https://www.binance.com/activity/referral-entry/CPA?ref=CPA_009SJLVSMT', + 'Bybit ⚫️': 'https://www.bybit.com/invite?ref=ZYJQX3B', +} diff --git a/bot/common/static_data.py b/bot/common/static_data.py new file mode 100644 index 0000000..cc889cc --- /dev/null +++ b/bot/common/static_data.py @@ -0,0 +1,36 @@ +# Supported languages +SUPPORTED_LANGUAGES = ['en', 'ru', 'uk', 'sk', 'es', 'fr', 'tr', 'ar', 'de', 'fa', 'ur', 'hi'] + +ACHIEVEMENTS = [ + "newcomer", "key_seeker", + "bonus_hunter", "code_expert", + "key_master", "elite_player", + "game_legend", "absolute_leader" +] + + +GAMES = [ + 'Pin Out Master', + 'Count Masters', + 'Hide Ball', + 'Bouncemasters', + 'Merge Away', + 'Stone Age', + 'Train Miner', + 'Mow and Trim', + 'Chain Cube 2048', + 'Fluff Crusade', + 'Polysphere', + 'Twerk Race 3D', + 'Zoopolis', + 'Tile Trio' +] + +STATUS_LIMITS = { + 'free': {'daily_limit': 2, 'interval_minutes': 10}, + 'friend': {'daily_limit': 5, 'interval_minutes': 10}, + 'premium': { + 'daily_limit': 4, 'interval_minutes': 10, + 'safety_daily_limit': 2, 'safety_interval_minutes': 240 + } +} diff --git a/bot/config.py b/bot/config.py index c30e793..ca53585 100644 --- a/bot/config.py +++ b/bot/config.py @@ -13,63 +13,6 @@ storage = MemoryStorage() dp = Dispatcher(storage=storage) -# Supported languages -SUPPORTED_LANGUAGES = ['en', 'ru', 'uk', 'sk', 'es', 'fr', 'tr', 'ar', 'de', 'fa', 'ur', 'hi'] - -REFERRAL_LINKS = { - 'Cats πŸˆβ€β¬›': 'https://t.me/catsgang_bot/join?startapp=Lv39AXNhcBvwK6ZWcoGpD', - 'πŸ…§ X Empire': 't.me/empirebot/game?startapp=hero452792586', - 'Binance Moonbix 🟠': 'https://t.me/Binance_Moonbix_bot/start?startapp=ref_452792586&startApp=ref_452792586', - 'πŸ₯  Hrum': 't.me/hrummebot/game?startapp=ref452792586', - '🏠 CITY Holder': 'https://t.me/cityholder/game?startapp=452792586', - 'πŸ€– TapSwap': 'https://t.me/tapswap_mirror_2_bot?start=r_452792586', - '⚫️ DotCoin': 'https://t.me/dotcoin_bot?start=r_452792586', - 'πŸ–²οΈ CEX.IO Power Tap': 'https://t.me/cexio_tap_bot?start=1716399236183636', - '⭐ Major': 'https://t.me/major/start?startapp=452792586', - '😺 Catizen': 'https://t.me/catizenbot/gameapp?startapp=r_2779_5703457', - 'πŸͺ™ Blum': 'https://t.me/blum/app?startapp=ref_8U6nYohQav', - 'πŸ‘Ύ Not Pixel': 'https://t.me/notpixel/app?startapp=f452792586', - '🐸 Frog Trader': 'https://t.me/xkucoinbot/kucoinminiapp?startapp' - '=cm91dGU9JTJGdGFwLWdhbWUlM0ZpbnZpdGVyVXNlcklkJTNENDUyNzkyNTg2JTI2cmNvZGUlM0Q=', - 'πŸ”₯ HOT Wallet': 'https://t.me/herewalletbot/app?startapp=9477477', - 'Binance πŸ”Ά': 'https://www.binance.com/activity/referral-entry/CPA?ref=CPA_009SJLVSMT', - 'Bybit ⚫️': 'https://www.bybit.com/invite?ref=ZYJQX3B', -} - - -ACHIEVEMENTS = [ - "newcomer", "key_seeker", - "bonus_hunter", "code_expert", - "key_master", "elite_player", - "game_legend", "absolute_leader" -] - - -GAMES = [ - 'Pin Out Master', - 'Count Masters', - 'Hide Ball', - 'Bouncemasters', - 'Merge Away', - 'Stone Age', - 'Train Miner', - 'Mow and Trim', - 'Chain Cube 2048', - 'Fluff Crusade', - 'Polysphere', - 'Twerk Race 3D', - 'Zoopolis', - 'Tile Trio' -] - -STATUS_LIMITS = { - 'free': {'daily_limit': 2, 'interval_minutes': 10}, - 'friend': {'daily_limit': 5, 'interval_minutes': 10}, - 'premium': { - 'daily_limit': 4, 'interval_minutes': 10, - 'safety_daily_limit': 2, 'safety_interval_minutes': 240 - } -} # Forwarding message to groupΒ§ GROUP_CHAT_ID = int(os.getenv("GROUP_CHAT_ID", 0)) diff --git a/bot/handlers/admin_handlers.py b/bot/handlers/admin_handlers.py index b3c88af..356195e 100644 --- a/bot/handlers/admin_handlers.py +++ b/bot/handlers/admin_handlers.py @@ -3,7 +3,8 @@ from aiogram import types, F, Router from aiogram.fsm.context import FSMContext from aiogram.types import InlineKeyboardMarkup, Message -from config import bot, BOT_ID, GAMES, GROUP_CHAT_ID +from config import bot, BOT_ID, GROUP_CHAT_ID +from common.static_data import GAMES from database.database import (get_session, log_user_action, get_admin_chat_ids, get_keys_count_for_games, get_users_list_admin_panel, get_user_details, get_subscribed_users) from keyboards.inline import (get_admin_panel_keyboard, get_main_in_admin, get_detail_info_in_admin, diff --git a/bot/handlers/handlers.py b/bot/handlers/handlers.py index 5572594..2a105e5 100644 --- a/bot/handlers/handlers.py +++ b/bot/handlers/handlers.py @@ -2,7 +2,8 @@ import logging from aiogram import types, F, Router from aiogram.fsm.context import FSMContext -from config import bot, BOT_ID, GAMES, STATUS_LIMITS, SUPPORTED_LANGUAGES +from config import bot, BOT_ID +from common.static_data import GAMES, STATUS_LIMITS, SUPPORTED_LANGUAGES from database.database import ( get_session, get_or_create_user, update_user_language, log_user_action, get_user_language, get_oldest_keys, update_keys_generated, diff --git a/bot/keyboards/referral_links_kb.py b/bot/keyboards/referral_links_kb.py index a2dceb2..ca13e61 100644 --- a/bot/keyboards/referral_links_kb.py +++ b/bot/keyboards/referral_links_kb.py @@ -1,5 +1,5 @@ from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton -from config import REFERRAL_LINKS +from common.referals import REFERRAL_LINKS from .back_to_main_kb import get_back_to_main_menu_button diff --git a/bot/redis_client.py b/bot/redis_client.py index 145922a..3f438e6 100644 --- a/bot/redis_client.py +++ b/bot/redis_client.py @@ -1,13 +1,13 @@ -import redis +import os +from dotenv import load_dotenv +import redis.asyncio as redis + +load_dotenv() + +# Configuring the Redis client redis_client = redis.StrictRedis( - host='localhost', - port=6379, + host=os.getenv('REDIS_HOST', 'localhost'), + port=os.getenv('REDIS_PORT', 6379), decode_responses=True ) - -try: - redis_client.ping() - print("Successfully connected to Redis!") -except redis.ConnectionError: - print("Could not connect to Redis.") diff --git a/bot/utils/services.py b/bot/utils/services.py index 5d61a66..fa106b7 100644 --- a/bot/utils/services.py +++ b/bot/utils/services.py @@ -1,6 +1,6 @@ from datetime import datetime, timezone -from config import ACHIEVEMENTS +from common.static_data import ACHIEVEMENTS def calculate_achievement(total_keys: int, total_premium_keys: int, days_in_bot: int) -> str: diff --git a/requirements.txt b/requirements.txt index 38010e4..ec9a2be 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ alembic==1.13.2 asyncpg==0.29.0 coloredlogs==15.0.1 flake8==7.1.1 +greenlet==3.1.0 redis==5.0.8 python-dotenv==1.0.1 psycopg2-binary==2.9.9