All current work

This commit is contained in:
2026-09-26 01:17:10 +03:00
commit 6f0139aae6
51 changed files with 9327 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
use teloxide::prelude::*;
use std::fs;
use chrono::Local;
use std::path::Path;
#[tokio::main]
async fn main() {
let bot = Bot::from_env();
teloxide::repl(bot, |bot: Bot, msg: Message| async move {
if let Some(text) = msg.text() {
let timestamp = Local::now().format("%Y-%m-%d_%H-%M-%S").to_string();
let file_name = format!("TNotes/{}.md", timestamp);
// Здесь асинхронная запись через tokio::fs
if let Err(e) = tokio::fs::write(&file_name, text).await {
bot.send_message(msg.chat.id, format!("Ошибка записи: {}", e)).await?;
} else {
bot.send_message(msg.chat.id, "Заметка создана!").await?;
}
}
respond(())
}).await;
}