diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 2f146d8..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 6887202..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/welcome-webhook-bot.iml b/.idea/welcome-webhook-bot.iml deleted file mode 100644 index 5195124..0000000 --- a/.idea/welcome-webhook-bot.iml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/api/webhook.py b/api/webhook.py index 73d48fa..5583697 100644 --- a/api/webhook.py +++ b/api/webhook.py @@ -1,5 +1,3 @@ -from sanic import Sanic -from sanic.response import text from bot.handlers.handle_feedback import handle_feedback, handle_answer from bot.handlers.handle_members_change import handle_join, handle_left from bot.handlers.handle_join_request import handle_join_request @@ -13,10 +11,11 @@ from bot.handlers.handle_startup import handle_startup from bot.api import register_webhook, send_message from bot.config import FEEDBACK_CHAT_ID from bot.state import State +from sanic.app import Sanic app = Sanic(name="welcomecenter") +app.config.LOGGING = True app.config.REGISTERED = False - state = State() diff --git a/bot/api.py b/bot/api.py index 4097017..8392268 100644 --- a/bot/api.py +++ b/bot/api.py @@ -5,7 +5,7 @@ import os from bot.config import BOT_TOKEN, WEBHOOK -apiBase = f"https://api.telegram.org/bot{TOKEN}/" +apiBase = f"https://api.telegram.org/bot{BOT_TOKEN}/" def register_webhook(): diff --git a/bot/config.py b/bot/config.py index b884c81..46db746 100644 --- a/bot/config.py +++ b/bot/config.py @@ -1,6 +1,6 @@ import os -BOT_TOKEN = os.environ.get('BOT_TOKEN') or '' +BOT_TOKEN = os.environ.get('BOT_TOKEN') or '5543739069:AAHCKC7C8vhFERw1KN2nCbg9olQ5UFBQWfE' WEBHOOK = os.environ.get('VERCEL_URL') or 'http://localhost:8000' REDIS_URL = os.environ.get('REDIS_URL') or 'redis://localhost:6379' FEEDBACK_CHAT_ID = os.environ.get('FEEDBACK_CHAT_ID').replace("-", "-100") \ No newline at end of file diff --git a/bot/handlers/handle_startup.py b/bot/handlers/handle_startup.py index 3d70df0..6a89cea 100644 --- a/bot/handlers/handle_startup.py +++ b/bot/handlers/handle_startup.py @@ -1,4 +1,4 @@ -from storage import scan, Profile +from bot.storage import scan, Profile from bot.api import approve_chat_join_request, kick_member from bot.handlers.callback_vouch import update_button from bot.utils.mention import userdata_extract diff --git a/bot/storage/__init__.py b/bot/storage/__init__.py index 838d528..9caca15 100644 --- a/bot/storage/__init__.py +++ b/bot/storage/__init__.py @@ -1,11 +1,11 @@ -import redis -from profile import Profile as ProfileObj +from redis import Redis +from bot.storage.profile import Profile as ProfileObj from bot.config import REDIS_URL import json # сохраняет сессии, айди кнопок в чатах для удаления и пересылаемые сообщения между перезагрузками -storage = redis.from_url(REDIS_URL) +storage = Redis.from_url(REDIS_URL) # хранение необходимой информации о пользователях Profile = ProfileObj(storage) diff --git a/requirements.txt b/requirements.txt index 9d3ddd8..fad73fc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ sanic==19.6.0 requests redis +asyncio aiohttp \ No newline at end of file