+2
-1
src/event_handler/replace_link.rs
+2
-1
src/event_handler/replace_link.rs
···
7
7
8
8
pub async fn handle(ctx: &Context, event: &FullEvent, _data: &Data) -> Result<()> {
9
9
if let FullEvent::Message { new_message } = event {
10
-
let regex = Regex::new(r"(https?:\/\/(?:www\.)?(x\.com|twitter\.com|reddit\.com|instagram\.com|tiktok\.com)\/[^\s]+)").unwrap();
10
+
let regex = Regex::new(r"(https?:\/\/(?:(www|vm)\.)?(x\.com|twitter\.com|reddit\.com|instagram\.com|tiktok\.com)\/[^\s]+)").unwrap();
11
11
let mut links: Vec<String> = Vec::new();
12
12
13
13
for capture in regex.find_iter(&new_message.content) {
···
21
21
.replace("https://www.instagram.com", "https://ddinstagram.com")
22
22
.replace("https://instagram.com", "https://ddinstagram.com")
23
23
.replace("https://www.tiktok.com", "https://tfxktok.com")
24
+
.replace("https://vm.tiktok.com", "https://vm.vxtiktok.com")
24
25
.replace("https://tiktok.com", "https://tfxktok.com");
25
26
26
27
links.push(modified_url);