Compare commits

..
Author SHA1 Message Date
İspik 79943efdf7 Merge branch 'main' into fix/adjust-bit-manipulation 2026-05-31 10:20:17 +03:00
İspik bd987bf72a chore: update unicode emoji list (#781)
Signed-off-by: ispik <ispik@ispik.dev>
2026-05-28 14:55:49 -07:00
ispik abe3cf87a1 fix: adjust bit manipulation
Signed-off-by: ispik <ispik@ispik.dev>
2026-05-28 22:55:13 +03:00
3 changed files with 68 additions and 53 deletions
@@ -1,4 +1,3 @@
*️⃣
0️⃣
1️⃣
@@ -242,6 +241,7 @@
🆘
🆙
🆚
🇦
🇦🇨
🇦🇩
🇦🇪
@@ -259,6 +259,7 @@
🇦🇼
🇦🇽
🇦🇿
🇧
🇧🇦
🇧🇧
🇧🇩
@@ -280,6 +281,7 @@
🇧🇼
🇧🇾
🇧🇿
🇨
🇨🇦
🇨🇨
🇨🇩
@@ -301,6 +303,7 @@
🇨🇽
🇨🇾
🇨🇿
🇩
🇩🇪
🇩🇬
🇩🇯
@@ -308,6 +311,7 @@
🇩🇲
🇩🇴
🇩🇿
🇪
🇪🇦
🇪🇨
🇪🇪
@@ -317,12 +321,14 @@
🇪🇸
🇪🇹
🇪🇺
🇫
🇫🇮
🇫🇯
🇫🇰
🇫🇲
🇫🇴
🇫🇷
🇬
🇬🇦
🇬🇧
🇬🇩
@@ -342,12 +348,14 @@
🇬🇺
🇬🇼
🇬🇾
🇭
🇭🇰
🇭🇲
🇭🇳
🇭🇷
🇭🇹
🇭🇺
🇮
🇮🇨
🇮🇩
🇮🇪
@@ -359,10 +367,12 @@
🇮🇷
🇮🇸
🇮🇹
🇯
🇯🇪
🇯🇲
🇯🇴
🇯🇵
🇰
🇰🇪
🇰🇬
🇰🇭
@@ -374,6 +384,7 @@
🇰🇼
🇰🇾
🇰🇿
🇱
🇱🇦
🇱🇧
🇱🇨
@@ -385,6 +396,7 @@
🇱🇺
🇱🇻
🇱🇾
🇲
🇲🇦
🇲🇨
🇲🇩
@@ -408,6 +420,7 @@
🇲🇽
🇲🇾
🇲🇿
🇳
🇳🇦
🇳🇨
🇳🇪
@@ -420,7 +433,9 @@
🇳🇷
🇳🇺
🇳🇿
🇴
🇴🇲
🇵
🇵🇦
🇵🇪
🇵🇫
@@ -435,12 +450,15 @@
🇵🇹
🇵🇼
🇵🇾
🇶
🇶🇦
🇷
🇷🇪
🇷🇴
🇷🇸
🇷🇺
🇷🇼
🇸
🇸🇦
🇸🇧
🇸🇨
@@ -462,6 +480,7 @@
🇸🇽
🇸🇾
🇸🇿
🇹
🇹🇦
🇹🇨
🇹🇩
@@ -479,6 +498,7 @@
🇹🇻
🇹🇼
🇹🇿
🇺
🇺🇦
🇺🇬
🇺🇲
@@ -486,6 +506,7 @@
🇺🇸
🇺🇾
🇺🇿
🇻
🇻🇦
🇻🇨
🇻🇪
@@ -493,11 +514,15 @@
🇻🇮
🇻🇳
🇻🇺
🇼
🇼🇫
🇼🇸
🇽
🇽🇰
🇾
🇾🇪
🇾🇹
🇿
🇿🇦
🇿🇲
🇿🇼
@@ -219,7 +219,7 @@ impl MessageFlagsValue {
self.has_value(flag as u32)
}
pub fn has_value(&self, bit: u32) -> bool {
let mask = 1 << bit;
let mask = 1 << (bit - 1);
self.0 & mask == mask
}
@@ -227,10 +227,11 @@ impl MessageFlagsValue {
self.set_value(flag as u32, toggle)
}
pub fn set_value(&mut self, bit: u32, toggle: bool) -> &mut Self {
let mask = 1 << (bit - 1);
if toggle {
self.0 |= 1 << bit;
self.0 |= mask;
} else {
self.0 &= !(1 << bit);
self.0 &= !mask;
}
self
}
+38 -49
View File
@@ -10,7 +10,7 @@ use tokio::sync::RwLock;
pub mod types;
const TENOR_API_BASE_URL: &str = "https://compat.gifbox.me/v2";
const TENOR_API_BASE_URL: &str = "https://tenor.googleapis.com/v2";
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum TenorError {
@@ -59,11 +59,7 @@ impl Tenor {
}
}
pub async fn request<T: DeserializeOwned>(
&self,
path: &str,
query: &[Option<(&str, &str)>],
) -> Result<Arc<T>, TenorError> {
pub async fn request<T: DeserializeOwned>(&self, path: &str, query: &[Option<(&str, &str)>]) -> Result<Arc<T>, TenorError> {
let response = self
.client
.get(format!("{TENOR_API_BASE_URL}{path}"))
@@ -99,27 +95,24 @@ impl Tenor {
}
}
let res = self
.coalescion
.execute(unique_key.clone(), || async move {
self.request::<types::PaginatedMediaResponse>(
"/search",
&[
Some(("key", &self.key)),
Some(("q", query)),
Some(("client_key", "Gifbox")),
Some(("media_filter", "webm,tinywebm")),
Some(("locale", locale)),
Some(("contentfilter", "high")),
Some(("limit", &limit.to_string())),
position.is_empty().then_some(("pos", position)),
is_category.then_some(("component", "categories")),
],
)
.await
})
.await
.unwrap();
let res = self.coalescion.execute(unique_key.clone(), || async move {
self.request::<types::PaginatedMediaResponse>(
"/search",
&[
Some(("key", &self.key)),
Some(("q", query)),
Some(("client_key", "Gifbox")),
Some(("media_filter", "webm,tinywebm")),
Some(("locale", locale)),
Some(("contentfilter", "high")),
Some(("limit", &limit.to_string())),
position.is_empty().then_some(("pos", position)),
is_category.then_some(("component", "categories"))
]
).await
})
.await
.unwrap();
if let Ok(resp) = &*res {
self.cache.write().await.insert(unique_key, resp.clone());
@@ -150,9 +143,8 @@ impl Tenor {
Some(("client_key", "Gifbox")),
Some(("locale", locale)),
Some(("contentfilter", "high")),
],
)
.await
]
).await
})
.await
.unwrap();
@@ -181,25 +173,22 @@ impl Tenor {
}
}
let res = self
.coalescion
.execute(unique_key.clone(), || async move {
self.request::<types::PaginatedMediaResponse>(
"/featured",
&[
Some(("key", &self.key)),
Some(("client_key", "Gifbox")),
Some(("media_filter", "webm,tinywebm")),
Some(("locale", locale)),
Some(("contentfilter", "high")),
Some(("limit", &limit.to_string())),
position.is_empty().then_some(("pos", position)),
],
)
.await
})
.await
.unwrap();
let res = self.coalescion.execute(unique_key.clone(), || async move {
self.request::<types::PaginatedMediaResponse>(
"/featured",
&[
Some(("key", &self.key)),
Some(("client_key", "Gifbox")),
Some(("media_filter", "webm,tinywebm")),
Some(("locale", locale)),
Some(("contentfilter", "high")),
Some(("limit", &limit.to_string())),
position.is_empty().then_some(("pos", position)),
]
).await
})
.await
.unwrap();
if let Ok(resp) = &*res {
self.featured.write().await.insert(unique_key, resp.clone());