add: emojis is_animated
This commit is contained in:
parent
8e88cbbc6f
commit
570a290954
4 changed files with 19 additions and 5 deletions
|
@ -1148,7 +1148,10 @@ secondary=false) -%}
|
|||
.querySelector("emoji-picker")
|
||||
.addEventListener("emoji-click", (event) => {
|
||||
function gemoji() {
|
||||
const use_first_shortcode = ["grinning squinting face"];
|
||||
const use_first_shortcode = [
|
||||
"grinning squinting face",
|
||||
"smiling_face_with_heart_eyes",
|
||||
];
|
||||
|
||||
if (
|
||||
use_first_shortcode.includes(
|
||||
|
|
|
@ -4,5 +4,6 @@ CREATE TABLE IF NOT EXISTS emojis (
|
|||
owner BIGINT NOT NULL,
|
||||
community BIGINT NOT NULL,
|
||||
upload_id BIGINT NOT NULL,
|
||||
name TEXT NOT NULL
|
||||
name TEXT NOT NULL,
|
||||
is_animated INT NOT NULL
|
||||
)
|
||||
|
|
|
@ -25,6 +25,7 @@ impl DataManager {
|
|||
community: get!(x->3(i64)) as usize,
|
||||
upload_id: get!(x->4(i64)) as usize,
|
||||
name: get!(x->5(String)),
|
||||
is_animated: get!(x->6(i32)) as i8 == 1,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,14 +126,15 @@ impl DataManager {
|
|||
|
||||
let res = execute!(
|
||||
&conn,
|
||||
"INSERT INTO emojis VALUES ($1, $2, $3, $4, $5, $6)",
|
||||
"INSERT INTO emojis VALUES ($1, $2, $3, $4, $5, $6, $7)",
|
||||
params![
|
||||
&(data.id as i64),
|
||||
&(data.owner as i64),
|
||||
&(data.created as i64),
|
||||
&(data.community as i64),
|
||||
&(data.upload_id as i64),
|
||||
&data.name
|
||||
&data.name,
|
||||
&{ if data.is_animated { 1 } else { 0 } },
|
||||
]
|
||||
);
|
||||
|
||||
|
|
|
@ -46,13 +46,20 @@ pub struct CustomEmoji {
|
|||
pub community: usize,
|
||||
pub upload_id: usize,
|
||||
pub name: String,
|
||||
pub is_animated: bool,
|
||||
}
|
||||
|
||||
pub type EmojiParserResult = Vec<(String, usize, String)>;
|
||||
|
||||
impl CustomEmoji {
|
||||
/// Create a new [`CustomEmoji`].
|
||||
pub fn new(owner: usize, community: usize, upload_id: usize, name: String) -> Self {
|
||||
pub fn new(
|
||||
owner: usize,
|
||||
community: usize,
|
||||
upload_id: usize,
|
||||
name: String,
|
||||
is_animated: bool,
|
||||
) -> Self {
|
||||
Self {
|
||||
id: AlmostSnowflake::new(1234567890)
|
||||
.to_string()
|
||||
|
@ -63,6 +70,7 @@ impl CustomEmoji {
|
|||
community,
|
||||
upload_id,
|
||||
name,
|
||||
is_animated,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue