diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..bb23e66
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+.idea
+.vscode
+.env
+env
+venv
+__pycache__
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 81884d3..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 933052a..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/ocab.iml b/.idea/ocab.iml
deleted file mode 100644
index 74d515a..0000000
--- a/.idea/ocab.iml
+++ /dev/null
@@ -1,10 +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/src/bot/config.ini b/src/bot/config.ini
new file mode 100644
index 0000000..229bfe0
--- /dev/null
+++ b/src/bot/config.ini
@@ -0,0 +1,43 @@
+[Telegram]
+token=****
+admin_password="Test_pass"
+# Пока не используется
+
+# Массивы заполнять через запятую. Пример: test|test2 |test3,
+bot_trigger_front=
+# Живой пример: Арма |Армат |Арма, |
+bot_trigger_all=
+# Живой пример: @arma_ai_bot |помогите |
+private_answer=
+# Живой пример: Я не понимаю тебя, но я могу поговорить с тобой в группе [название группы](https://t.me/) и ещё в некоторых других группах
+reply_ignore=0
+# По умолчанию: 0
+# Содержит в себе все id топиков чата для чатов с форумным типом, если не заполнить контекст бота СЛОМАЕТСЯ!
+# Пример заполнения для одного из чатов: 0| 643885| 476959| 1| 476977| 633077| 630664| 476966| 634567
+start_answer= Привет! Я OCAB, открытый чат бот с ИИ для вашего чата!
+top10_answer= Вот топ 10 самых разговорчивых пользователей чата:
+
+[Roles]
+user= Пользователь
+moderator= Модератор
+admin= Администратор
+default_for_admin= 2
+
+
+[Openai]
+api_key=****
+chat_model=gpt-3.5-turbo
+story_model=
+# Тут должен быть текст истории бота, но я его не показываю)))
+max_token_count=4000
+# максимальное количество токенов в сообщении
+min_token_for_answer=800
+# минимальное количество токенов в сообщении ответа бота (чем больше, тем более длинный ответ ГАРАНТИРОВАН)
+
+[DataBase]
+message_limit=3000
+# Максимальное количество сообщений в базе данных
+
+[AI_Dungeon]
+use=openai
+# "openai" or "YaGPT" Пока не используется
\ No newline at end of file
diff --git a/src/bot/config.yaml b/src/bot/config.yaml
new file mode 100644
index 0000000..3392efe
--- /dev/null
+++ b/src/bot/config.yaml
@@ -0,0 +1,23 @@
+TELEGRAM:
+ TOKEN: 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
+ PRIVATE_ANSWER:
+
+BOT:
+ ANSWER:
+ HELP_ANSWER:
+ START_ANSWER:
+ ABOUT_ANSWER:
+
+ROLES:
+ ADMIN:
+ MODERATOR:
+ USER:
+ DEFAULT_FOR_ADMIN:
+
+DATABASE:
+ MESSAGE_LIMIT:
+
+GPT_MODULE:
+ TRIGGER_FRONT:
+ TRIGGER_ALL:
+ REPLY_IGNORE:
diff --git a/src/bot/core/__init__.py b/src/bot/core/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/bot/core/database/__init__.py b/src/bot/core/database/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/bot/core/database/methods/__init__.py b/src/bot/core/database/methods/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/bot/core/database/models/__init__.py b/src/bot/core/database/models/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/bot/core/filters/__init__.py b/src/bot/core/filters/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/bot/core/filters/basic.py b/src/bot/core/filters/basic.py
new file mode 100644
index 0000000..afb25e6
--- /dev/null
+++ b/src/bot/core/filters/basic.py
@@ -0,0 +1,5 @@
+from aiogram.filters import BaseFilter
+from aiogram.fsm.context import FSMContext
+from aiogram.types import Message
+
+# You filters
diff --git a/src/bot/core/handlers/__init__.py b/src/bot/core/handlers/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/bot/core/handlers/basic.py b/src/bot/core/handlers/basic.py
new file mode 100644
index 0000000..8ae747f
--- /dev/null
+++ b/src/bot/core/handlers/basic.py
@@ -0,0 +1,4 @@
+from aiogram.fsm.context import FSMContext
+from aiogram.types import Message
+
+# Your handlers
diff --git a/src/bot/core/keyboards/__init__.py b/src/bot/core/keyboards/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/bot/core/keyboards/basic.py b/src/bot/core/keyboards/basic.py
new file mode 100644
index 0000000..b36ba01
--- /dev/null
+++ b/src/bot/core/keyboards/basic.py
@@ -0,0 +1,3 @@
+from aiogram.types import KeyboardButton, ReplyKeyboardMarkup
+
+# Your keyboards
diff --git a/src/bot/core/middlewares/__init__.py b/src/bot/core/middlewares/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/bot/core/states/__init__.py b/src/bot/core/states/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/bot/core/states/api.py b/src/bot/core/states/api.py
new file mode 100644
index 0000000..bb802fd
--- /dev/null
+++ b/src/bot/core/states/api.py
@@ -0,0 +1,3 @@
+from aiogram.fsm.context import FSMContext
+
+# Your funcs
diff --git a/src/bot/core/states/states.py b/src/bot/core/states/states.py
new file mode 100644
index 0000000..62f0536
--- /dev/null
+++ b/src/bot/core/states/states.py
@@ -0,0 +1,5 @@
+from aiogram.fsm.state import State, StatesGroup
+
+
+class MyState(StatesGroup):
+ state1 = State()
diff --git a/src/bot/core/text_of_buttons.py b/src/bot/core/text_of_buttons.py
new file mode 100644
index 0000000..7945727
--- /dev/null
+++ b/src/bot/core/text_of_buttons.py
@@ -0,0 +1 @@
+# Here text of buttons
diff --git a/src/bot/core/utils/__init__.py b/src/bot/core/utils/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/bot/core/utils/registry.py b/src/bot/core/utils/registry.py
new file mode 100644
index 0000000..752362d
--- /dev/null
+++ b/src/bot/core/utils/registry.py
@@ -0,0 +1,14 @@
+from aiogram import Dispatcher
+
+
+def registry_middlewares(dp: Dispatcher):
+ pass
+
+
+def registry_handlers(dp: Dispatcher):
+ pass
+
+
+def registry(dp: Dispatcher):
+ registry_middlewares(dp)
+ registry_handlers(dp)
diff --git a/src/bot/core/utils/settings.py b/src/bot/core/utils/settings.py
new file mode 100644
index 0000000..bd4eb6f
--- /dev/null
+++ b/src/bot/core/utils/settings.py
@@ -0,0 +1,62 @@
+import openai
+
+import configparser
+from dataclasses import dataclass
+
+
+
+@dataclass
+class App:
+ telegram_token: str
+ openai_key: str
+ bot_trigger_front: list[str]
+ bot_trigger_all: list[str]
+
+
+@dataclass
+class Database:
+ path: str
+ message_limit: int
+
+
+@dataclass
+class Config:
+ app: App
+ database: Database
+
+def _clean_bot_trigger(bot_trigger_front, bot_trigger_all):
+ """удаление лишних элементов массивов"""
+ bot_trigger_front.remove('')
+ bot_trigger_all.remove('')
+
+
+def get_settings():
+ # Импорт переменных из файла .ini
+ config = configparser.ConfigParser()
+ config.read('core/config.ini')
+
+ bot_trigger_front = (config['Telegram']['bot_trigger_front']).split('|')
+ bot_trigger_all = (config['Telegram']['bot_trigger_all']).split('|')
+
+ _clean_bot_trigger(bot_trigger_front, bot_trigger_all)
+
+
+ return Config(
+ app=App(
+ telegram_token=config['Telegram']['token'],
+ openai_key=config['Openai']['api_key'],
+ bot_trigger_front = bot_trigger_front,
+ bot_trigger_all = bot_trigger_all,
+ ),
+ database=Database(
+ path="core/database/data.db",
+ message_limit=int(config['DataBase']['message_limit']),
+ ),
+ )
+
+def _openai_init(settings: Config):
+ openai.api_key = settings.app.openai_key
+
+
+settings = get_settings()
+_openai_init(settings)
\ No newline at end of file
diff --git a/src/bot/main.py b/src/bot/main.py
new file mode 100644
index 0000000..d3f832b
--- /dev/null
+++ b/src/bot/main.py
@@ -0,0 +1,28 @@
+from asyncio import run
+
+from aiogram import Bot, Dispatcher
+
+from core.utils.registry import registry
+from core.utils.settings import settings
+
+
+async def start(bot: Bot, dp: Dispatcher):
+ try:
+ await dp.start_polling(bot)
+ finally:
+ await bot.session.close()
+ # close db connection here
+
+
+def main():
+ bot = Bot(token=settings.app.telegram_token)
+
+ dp = Dispatcher()
+
+ registry(dp)
+
+ run(start(bot, dp))
+
+
+if __name__ == "__main__":
+ main()