summaryrefslogtreecommitdiff
path: root/src/utils.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.rs')
-rw-r--r--src/utils.rs22
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()
+ }
+ }
+}