Report errors to server
This commit is contained in:
		| @@ -2,6 +2,7 @@ pub(crate) mod pager; | ||||
|  | ||||
| use std::io::Cursor; | ||||
|  | ||||
| use base64::{engine::general_purpose, Engine}; | ||||
| use chrono_tz::Tz; | ||||
| use log::warn; | ||||
| use poise::{ | ||||
| @@ -51,11 +52,12 @@ impl ComponentDataModel { | ||||
|     pub fn to_custom_id(&self) -> String { | ||||
|         let mut buf = Vec::new(); | ||||
|         self.serialize(&mut Serializer::new(&mut buf)).unwrap(); | ||||
|         base64::encode(buf) | ||||
|         general_purpose::STANDARD.encode(buf) | ||||
|     } | ||||
|  | ||||
|     pub fn from_custom_id(data: &String) -> Self { | ||||
|         let buf = base64::decode(data) | ||||
|         let buf = general_purpose::STANDARD | ||||
|             .decode(data) | ||||
|             .map_err(|e| format!("Could not decode `custom_id' {}: {:?}", data, e)) | ||||
|             .unwrap(); | ||||
|         let cur = Cursor::new(buf); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user