Report errors to server

This commit is contained in:
jude
2023-06-20 13:13:26 +01:00
parent 9d8622f418
commit 1519474f93
10 changed files with 92 additions and 18 deletions

View File

@ -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);