mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-06 15:35:35 +01:00
Fix
This commit is contained in:
@@ -2,6 +2,7 @@ use std::error::Error;
|
|||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use serde_json::json;
|
||||||
use teloxide::prelude::*;
|
use teloxide::prelude::*;
|
||||||
|
|
||||||
use crate::config;
|
use crate::config;
|
||||||
@@ -28,19 +29,19 @@ async fn get_bot_username(token: &str) -> Option<String> {
|
|||||||
async fn make_register_request(user_id: UserId, username: &str, token: &str) -> Result<(), Box<dyn Error + Send + Sync>> {
|
async fn make_register_request(user_id: UserId, username: &str, token: &str) -> Result<(), Box<dyn Error + Send + Sync>> {
|
||||||
let user_id = &user_id.to_string();
|
let user_id = &user_id.to_string();
|
||||||
|
|
||||||
let data = HashMap::from([
|
let body = json!({
|
||||||
("token", token),
|
"token": token,
|
||||||
("user", user_id),
|
"user": user_id,
|
||||||
("username", username),
|
"status": "approved",
|
||||||
("status", "approved"),
|
"cache": "no_cache",
|
||||||
("cache", "no_cache")
|
"username": username,
|
||||||
]);
|
});
|
||||||
|
|
||||||
reqwest::Client::new()
|
reqwest::Client::new()
|
||||||
.post(config::CONFIG.manager_url.clone())
|
.post(config::CONFIG.manager_url.clone())
|
||||||
|
.body(body.to_string())
|
||||||
.header("Authorization", config::CONFIG.manager_api_key.clone())
|
.header("Authorization", config::CONFIG.manager_api_key.clone())
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
.json(&data)
|
|
||||||
.send()
|
.send()
|
||||||
.await?
|
.await?
|
||||||
.error_for_status()?;
|
.error_for_status()?;
|
||||||
|
|||||||
Reference in New Issue
Block a user