diff options
| author | seth <[email protected]> | 2023-04-07 19:39:22 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-04-07 20:00:57 -0400 |
| commit | 83f885ee8d762551a6c5d8ea5ab3719cde76464a (patch) | |
| tree | b81ee4ed2b6c935023b51be22de7591bf654c1c5 /src/utils.rs | |
| parent | 4ee540028b3bbc9671db597e761033865c7ed6d1 (diff) | |
add bottom encode/decode
Diffstat (limited to 'src/utils.rs')
| -rw-r--r-- | src/utils.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/utils.rs b/src/utils.rs index db5a5c4..4157e3b 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,4 +1,5 @@ use crate::consts::*; +use bottomify::bottom::{decode_string, encode_string}; use include_dir::{include_dir, Dir}; use rand::seq::SliceRandom; use std::collections::HashMap; @@ -65,3 +66,24 @@ pub async fn get_copypasta(name: &str) -> Vec<String> { let err = format!("couldn't find {:?} in files", name); vec![err] } + +/* + * encodes a string into bottom 🥺 + */ +pub async fn bottom_encode(string: &str) -> String { + encode_string(&string) +} + +/* + * decodes a bottom string into english 🥸 + */ +pub async fn bottom_decode(string: &str) -> String { + let decoded = decode_string(&string); + match decoded { + Ok(ret) => ret, + Err(why) => { + println!("couldn't decode {:?}! ({:?})", string, why); + "couldn't decode that! sowwy 🥺".to_string() + } + } +} |
