mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-15 18:20:11 +00:00
fix user ref regex, system ref parsing and add s <id>
This commit is contained in:
parent
74e7af0ee1
commit
b9fb453c73
2 changed files with 10 additions and 9 deletions
|
|
@ -46,13 +46,16 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
||||||
.flag(("private", ["priv"]))
|
.flag(("private", ["priv"]))
|
||||||
.flag(ALL)
|
.flag(ALL)
|
||||||
};
|
};
|
||||||
let system_info_cmd_self = once(add_info_flags(
|
let system_info_cmd_self =
|
||||||
command!(system => "system_info_self").help("Shows information about your system"),
|
once(command!(system => "system_info_self").help("Shows information about your system"))
|
||||||
));
|
.map(add_info_flags);
|
||||||
let system_info_cmd = once(add_info_flags(
|
let system_info_cmd = [
|
||||||
|
command!(system_target => "system_info").help("Shows information about your system"),
|
||||||
command!(system_target, ("info", ["show", "view"]) => "system_info")
|
command!(system_target, ("info", ["show", "view"]) => "system_info")
|
||||||
.help("Shows information about your system"),
|
.help("Shows information about your system"),
|
||||||
));
|
]
|
||||||
|
.into_iter()
|
||||||
|
.map(add_info_flags);
|
||||||
|
|
||||||
let system_name = tokens!(system_target, "name");
|
let system_name = tokens!(system_target, "name");
|
||||||
let system_name_cmd =
|
let system_name_cmd =
|
||||||
|
|
|
||||||
|
|
@ -139,9 +139,7 @@ impl Parameter {
|
||||||
ParameterKind::MemberRefs => Ok(ParameterValue::MemberRefs(
|
ParameterKind::MemberRefs => Ok(ParameterValue::MemberRefs(
|
||||||
input.split(' ').map(|s| s.trim().to_string()).collect(),
|
input.split(' ').map(|s| s.trim().to_string()).collect(),
|
||||||
)),
|
)),
|
||||||
ParameterKind::SystemRef => {
|
ParameterKind::SystemRef => Ok(ParameterValue::SystemRef(input.into())),
|
||||||
Ok(parse_user_ref(input).unwrap_or(ParameterValue::SystemRef(input.into())))
|
|
||||||
}
|
|
||||||
ParameterKind::UserRef => parse_user_ref(input),
|
ParameterKind::UserRef => parse_user_ref(input),
|
||||||
ParameterKind::MemberPrivacyTarget => MemberPrivacyTargetKind::from_str(input)
|
ParameterKind::MemberPrivacyTarget => MemberPrivacyTargetKind::from_str(input)
|
||||||
.map(|target| ParameterValue::MemberPrivacyTarget(target.as_ref().into())),
|
.map(|target| ParameterValue::MemberPrivacyTarget(target.as_ref().into())),
|
||||||
|
|
@ -321,7 +319,7 @@ fn parse_user_ref(input: &str) -> Result<ParameterValue, SmolStr> {
|
||||||
}
|
}
|
||||||
|
|
||||||
static RE: std::sync::LazyLock<Regex> =
|
static RE: std::sync::LazyLock<Regex> =
|
||||||
std::sync::LazyLock::new(|| Regex::new(r"<@!?(\\d{17,19})>").unwrap());
|
std::sync::LazyLock::new(|| Regex::new(r"<@!?(\d{17,19})>").unwrap());
|
||||||
if let Some(captures) = RE.captures(&input) {
|
if let Some(captures) = RE.captures(&input) {
|
||||||
return captures[1]
|
return captures[1]
|
||||||
.parse::<u64>()
|
.parse::<u64>()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue