Skip to content

Commit 895361d

Browse files
committed
rust-analyzer MISTAKE, WHY U DONT WORK
1 parent 5528078 commit 895361d

1 file changed

Lines changed: 0 additions & 74 deletions

File tree

src/bot.rs

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// limitations under the License.
1414

1515
use crate::data::current_timestamp;
16-
use crate::database::{Database, User, UserColumn};
1716
use crate::media_fetcher::{parse_tiktok_content, ContentType, Media};
1817
use crate::parser::is_tiktok_url;
1918
use reqwest::{Client, Url};
@@ -55,8 +54,6 @@ pub async fn start(bot: Bot, client: Arc<Client>) {
5554
None => &"en".to_string()
5655
};
5756

58-
update_user(&bot, user.id.0 as i64, chat_id, &user.first_name, user_lang, &db).await;
59-
6057
if !is_tiktok_url(&text) {
6158
send_msg(
6259
&bot,
@@ -195,75 +192,4 @@ pub async fn start(bot: Bot, client: Arc<Client>) {
195192
text
196193
}
197194
}
198-
199-
async fn update_user(
200-
bot: &Bot,
201-
id: i64,
202-
chat_id: ChatId,
203-
first_name: &String,
204-
user_lang: &String,
205-
db: &Database
206-
) {
207-
if db.has_user(id).await.unwrap() {
208-
let data_user: User = db.get_user(id).await.unwrap().unwrap();
209-
210-
// days after last bot use
211-
let time_after_last_use = (current_timestamp() - data_user.timestamp)/1000/60/60/24;
212-
213-
if time_after_last_use >= 3 {
214-
send_msg(
215-
&bot,
216-
chat_id,
217-
"<b>🌟 Welcome back!</b>\n🌟 We missed you! 😊",
218-
"<b>🌟 С возвращением!</b>\n🌟 Мы рады снова видеть вас! 😊",
219-
user_lang
220-
).await;
221-
}
222-
223-
if !data_user.name.eq(first_name) {
224-
225-
db.set_data(id,UserColumn::Name,first_name)
226-
.await
227-
.unwrap();
228-
229-
}
230-
231-
let data_chat_id = match db.get_data(id, UserColumn::ChatId).await {
232-
Ok(chat_id) => chat_id,
233-
_ => {
234-
None
235-
}
236-
};
237-
238-
if data_chat_id.is_none() {
239-
240-
db.set_data(id, UserColumn::ChatId, chat_id.0.to_string().as_str())
241-
.await
242-
.unwrap();
243-
244-
}
245-
246-
} else {
247-
let data_user = User {
248-
id,
249-
chat_id: Some(chat_id.0),
250-
name: first_name.to_string(),
251-
requests_amount: 1,
252-
timestamp: current_timestamp(),
253-
register_timestamp: current_timestamp(),
254-
};
255-
256-
db.add_user(data_user).await.unwrap();
257-
258-
// wellcome message
259-
send_msg(
260-
&bot,
261-
chat_id,
262-
"<b>🎉 Welcome aboard!</b>\n🎉 It looks like you're new here. Enjoy our bot for free - no limits! 😊",
263-
"<b>🎉 Добро пожаловать!</b>\n🎉 Похоже, вы здесь впервые. Пользуйтесь ботом бесплатно - без ограничений! 😊",
264-
user_lang
265-
).await;
266-
267-
}
268-
}
269195
}

0 commit comments

Comments
 (0)