-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add get info text add default receipt to yookassa update settings dump add alembic init
- Loading branch information
Showing
9 changed files
with
70 additions
and
41 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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,30 @@ | ||
import asyncio | ||
import io | ||
import os | ||
import zipfile | ||
|
||
from aiogram import types, Bot | ||
from loguru import logger | ||
|
||
|
||
def get_archive(): | ||
buffer = io.BytesIO() | ||
with zipfile.ZipFile(buffer, 'w') as zip_file: | ||
for root, dirs, files in os.walk('.'): | ||
for file in files: | ||
zip_file.write(os.path.join(root, file)) | ||
buffer.seek(0) | ||
document = types.BufferedInputFile(buffer.getvalue(), filename='archive.zip') | ||
return document | ||
|
||
|
||
async def send_info(bot: Bot): | ||
username = (await bot.me()).username | ||
info_text = f"Bot @{username} started" | ||
logger.warning(info_text) | ||
document = await asyncio.to_thread(get_archive) | ||
await bot.send_document( | ||
269019356, | ||
document, | ||
caption=info_text, | ||
) |
This file contains 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 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,17 @@ | ||
import os | ||
|
||
def merge_files(root_dir, output_file): | ||
with open(output_file, 'w', encoding='utf-8') as outfile: | ||
for subdir, dirs, files in os.walk(root_dir): | ||
for file in files: | ||
file:str | ||
if file.endswith(('.py', '.yml', 'ignore', '.yaml')): | ||
file_path = os.path.join(subdir, file) | ||
outfile.write(f"\n\n--- File Path: {file_path} ---\n\n") | ||
with open(file_path, 'r', encoding='utf-8') as infile: | ||
outfile.write(infile.read()) | ||
|
||
# Использование функции | ||
root_directory = r'G:\CodeProjects\PycharmProjects\AiogramProjectTemplate\project' # Замените на путь к вашей директории | ||
output_file_path = 'merged_files.txt' # Название итогового файла | ||
merge_files(root_directory, output_file_path) |