Lightweight native Discord client for Windows, Linux and macOS, written in Rust. No Electron, no browser engine.
Rust desktop-appdiscorddiscord-clienteguielectron-alternativelightweightlinuxmacosnative-apprustwindows
//! MessageSelect: hold Ctrl + Shift to get a circle beside every message,
//! click messages to check them off, then Ctrl + C copies them all.
//!
//! Picking is UI state, so the client does the work (it looks this plugin up
//! by [`ID`]); the plugin carries the toggle, the settings and the format.
use crate::{Plugin, PluginMeta, PluginSettings, SettingDef};
pub struct MessageSelect;
pub const ID: &str = "MessageSelect";
impl Plugin for MessageSelect {
fn meta(&self) -> PluginMeta {
PluginMeta {
id: ID,
name: "MessageSelect",
description: "Hold Ctrl + Shift and click messages to check them off, then press Ctrl + C to copy them all. Esc clears the selection.",
authors: &["RustCord"],
vencord_equivalent: None,
default_enabled: false,
}
}
fn settings(&self) -> Vec<SettingDef> {
vec![SettingDef::bool(
"authors",
"Include author names",
"Copy each message as \"Name: text\" instead of just its text.",
false,
)]
}
}
/// The clipboard text for the picked messages: (author, text) pairs, oldest first.
pub fn format<'a>(settings: &PluginSettings, messages: impl Iterator<Item = (&'a str, &'a str)>) -> String {
let authors = settings.bool("authors");
messages
.map(|(author, text)| if authors { format!("{author}: {text}") } else { text.to_string() })
.collect::<Vec<_>>()
.join("\n")
}