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
+1
View File
@@ -0,0 +1 @@
/target
+2007
View File
File diff suppressed because it is too large Load Diff
+10
View File
@@ -0,0 +1,10 @@
[package]
name = "Rust-Telegram-Obsidian"
version = "0.1.0"
edition = "2024"
[dependencies]
teloxide = { version = "0.17", features = ["macros"] }
tokio = { version = "1.0", features = ["full"] }
chrono = "0.4" # Для генерации дат
anyhow = "1.0"
+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;
}