5GMFIHRT6Z5LASHQ47GUFZKE5MY5DEXJEZCXCWTXYG6NKPIUIGEQC
MT5UYGH2CAJLYJ2C2FTT3N3YUHPWHTP26DNANVN62GLWELC73JWAC
KCUGRTO54BZLPQJPUZNJGKM3TZOR2K3Z7SZN5SR7IZQAEOYWL4WQC
YMW2RSKMODRBEHP5ZGBQQ3ZKZQCKLGUT3F6MXSI73AK446LRNFKAC
4GKYK7JDUKAOG2D2EXGNV2SMRGL3FOTG3ADLKQKM6476GATQ4BAAC
UZPHCOWN2JISRBGCFGADNEFIHEXEOL4P3GO4QCDVR5GVTVSJPJCQC
HJACI3FHGMBIF4AEVNNI2FBAZUYLNTIQUQXVXCAZZA7DX3FWBJSQC
HFHOMADVK6SIRUFUUZOQC3XGNSOETNRELZ3RDMZFY3RIBVAYCKIAC
JLRU6XLFRAA7IVLF2GRU6UF5HJIKE3MCN566TIG7UQGIY7MZSCMQC
let mut images = vec![];
for attachment in message
.media_attachments
.iter()
.filter(|x| matches!(x.r#type, AttachmentType::Image))
// Discord accepts up to 10 embeds
.take(10)
{
images.push(json!({
"url": attachment.url,
}));
}
let mut embeds = vec![];
// Create an embed containing the message's content
embeds.push(json!({
"description": parse_html(&message.content).replace("[https://", "[").replace("\\#", "#").replace("\\_", "_"), // Workarounds for Discord's stupid Markdown parser
"url": message.uri,
"timestamp": message.created_at.to_rfc3339(),
"author": {
"name": message.uri,
"url": message.uri,
},
// Set first image if exist, leave empty if not
"image": images.get(0).unwrap_or(&json!({})),
}));
// Create an embed for each remaining images
for image in images.into_iter().skip(1) {
embeds.push(json!({
"url": message.uri,
"image": image,
}));
}
]
[[package]]
name = "fast_html2md"
version = "0.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbfeb805e97290b9f4c50dd97796604ec031993f211a70b1f6741405b2950656"
dependencies = [
"html5ever",
"jni",
"lazy_static",
"markup5ever_rcdom",
"percent-encoding",
"regex",
[[package]]
name = "mac"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
[[package]]
name = "markup5ever"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016"
dependencies = [
"log",
"phf",
"phf_codegen",
"string_cache",
"string_cache_codegen",
"tendril",
]
name = "phf"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259"
dependencies = [
"phf_shared",
]
[[package]]
name = "phf_codegen"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd"
dependencies = [
"phf_generator",
"phf_shared",
]
[[package]]
name = "phf_generator"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6"
dependencies = [
"phf_shared",
"rand",
]
[[package]]
name = "phf_shared"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096"
dependencies = [
"siphasher",
]
[[package]]
name = "string_cache"
version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b"
dependencies = [
"new_debug_unreachable",
"once_cell",
"parking_lot",
"phf_shared",
"precomputed-hash",
"serde",
]
[[package]]
name = "string_cache_codegen"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988"
dependencies = [
"phf_generator",
"phf_shared",
"proc-macro2",
"quote",
]
[[package]]