summaryrefslogtreecommitdiff
path: root/src/emotes.rs
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-04-04 01:26:09 +0500
committerilotterytea <iltsu@alright.party>2025-04-04 01:26:09 +0500
commitb8ee90bac9d004022c4da0216c6462a627c90756 (patch)
tree5b868495481a05944a832d1d791be14402f42e70 /src/emotes.rs
parent89b2b38f9c9cbc1419676de055bad93a2ef1c428 (diff)
feat: emote base
Diffstat (limited to 'src/emotes.rs')
-rw-r--r--src/emotes.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/emotes.rs b/src/emotes.rs
index 7242f82..c602f84 100644
--- a/src/emotes.rs
+++ b/src/emotes.rs
@@ -1,6 +1,12 @@
use reqwest::Error;
use serde::{Deserialize, Serialize};
+pub trait EmoteBase {
+ fn get_id(&self) -> &String;
+ fn get_code(&self) -> &String;
+ fn get_original_code(&self) -> &Option<String>;
+}
+
#[derive(Deserialize, Serialize, Clone, Debug)]
pub struct Emote {
pub id: String,
@@ -8,6 +14,20 @@ pub struct Emote {
pub original_code: Option<String>,
}
+impl EmoteBase for Emote {
+ fn get_id(&self) -> &String {
+ &self.id
+ }
+
+ fn get_code(&self) -> &String {
+ &self.code
+ }
+
+ fn get_original_code(&self) -> &Option<String> {
+ &self.original_code
+ }
+}
+
pub trait RetrieveEmoteAPI<T> {
async fn get_channel_emotes(&self, channel_login: &str) -> Result<Vec<T>, Error>;
async fn get_global_emotes(&self) -> Result<Vec<T>, Error>;