Skip to content

Commit

Permalink
Migrate util module to a separate crate for sharing
Browse files Browse the repository at this point in the history
  • Loading branch information
SpriteOvO committed Mar 22, 2023
1 parent 46caf42 commit 2838f2c
Show file tree
Hide file tree
Showing 20 changed files with 61 additions and 1,319 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "tgbot-utils"]
path = tgbot-utils
url = https://github.com/SpriteOvO/tgbot-utils.git
40 changes: 27 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ spdlog-rs = "0.3.8"
sqlx = { version = "0.6.2", features = ["runtime-tokio-rustls", "sqlite", "offline"] }
teloxide = { version = "0.12.0", features = ["macros"] }
tempfile = "3.3.0"
tgbot-utils = { path = "./tgbot-utils" }
thiserror = "1.0.38"
tokio = { version = "1.25.0", features = ["rt-multi-thread", "macros"] }
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ You have two ways to install the binary.
- Install from git repository.

```bash
git clone https://github.com/SpriteOvO/tgbot-mastodon-sync.git
git clone https://github.com/SpriteOvO/tgbot-mastodon-sync.git --recursive
cd tgbot-mastodon-sync
git checkout <latest-version>
cargo install --path .
Expand Down
28 changes: 0 additions & 28 deletions sqlx-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,34 +66,6 @@
},
"query": "\nSELECT mastodon_async_data\nFROM mastodon_login_user\nWHERE tg_user_id = ?1\n "
},
"c44b4f7267d46abfe8614de8c6b7754cf2fa657b43773396a37ee5038fe12d88": {
"describe": {
"columns": [
{
"name": "media_json",
"ordinal": 0,
"type_info": "Text"
}
],
"nullable": [
false
],
"parameters": {
"Right": 1
}
},
"query": "\nSELECT media_json\nFROM telegram_media_group\nWHERE group_id = ?1\nORDER BY msg_id\n "
},
"cabdeabbaec8a6204439bc3f1b860237cd669d5188c609105bd117655f57c0a6": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Right": 3
}
},
"query": "\nINSERT OR REPLACE INTO telegram_media_group ( group_id, msg_id, media_json )\nVALUES ( ?1, ?2, ?3 )\n "
},
"ea8aa9783db4438ed417482e31b463b4c17d3d32d1cc9661abf817fd39db5a0d": {
"describe": {
"columns": [
Expand Down
211 changes: 0 additions & 211 deletions src/cmd/arg.rs

This file was deleted.

3 changes: 0 additions & 3 deletions src/cmd/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
mod arg;

pub(crate) use arg::*;
use teloxide::utils::command::BotCommands;

#[derive(BotCommands, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion src/handler/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ use std::{borrow::Cow, collections::HashMap, sync::Arc};
use once_cell::sync::Lazy;
use spdlog::prelude::*;
use teloxide::types::UserId;
use tgbot_utils::text::*;
use tokio::sync::Mutex;

use crate::{
handler::{Request, Response},
mastodon,
util::text::*,
};

static AUTH_DOMAIN_CACHE: Lazy<Mutex<HashMap<UserId, String>>> =
Expand Down

0 comments on commit 2838f2c

Please sign in to comment.