mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-05 21:37:55 +00:00
make random commands consistent by adding missing ones
This commit is contained in:
parent
5c2c2dceff
commit
d4c80aed00
4 changed files with 31 additions and 27 deletions
|
|
@ -223,11 +223,15 @@ public partial class CommandTree
|
|||
flags.group
|
||||
? ctx.Execute<Random>(GroupRandom, m => m.Group(ctx, ctx.System, flags.all, flags.show_embed))
|
||||
: ctx.Execute<Random>(MemberRandom, m => m.Member(ctx, ctx.System, flags.all, flags.show_embed)),
|
||||
Commands.RandomGroupSelf(_, var flags) => ctx.Execute<Random>(GroupRandom, m => m.Group(ctx, ctx.System, flags.all, flags.show_embed)),
|
||||
Commands.RandomGroupMemberSelf(var param, var flags) => ctx.Execute<Random>(GroupMemberRandom, m => m.GroupMember(ctx, param.target, flags.all, flags.show_embed, flags)),
|
||||
Commands.SystemRandom(var param, var flags) =>
|
||||
flags.group
|
||||
? ctx.Execute<Random>(GroupRandom, m => m.Group(ctx, param.target, flags.all, flags.show_embed))
|
||||
: ctx.Execute<Random>(MemberRandom, m => m.Member(ctx, param.target, flags.all, flags.show_embed)),
|
||||
Commands.GroupRandomMember(var param, var flags) => ctx.Execute<Random>(GroupMemberRandom, m => m.GroupMember(ctx, param.target, flags)),
|
||||
Commands.SystemRandomGroup(var param, var flags) =>
|
||||
ctx.Execute<Random>(GroupRandom, m => m.Group(ctx, param.target, flags.all, flags.show_embed)),
|
||||
Commands.GroupRandomMember(var param, var flags) => ctx.Execute<Random>(GroupMemberRandom, m => m.GroupMember(ctx, param.target, flags.all, flags.show_embed, flags)),
|
||||
Commands.SystemLink(var param, _) => ctx.Execute<SystemLink>(Link, m => m.LinkSystem(ctx, param.account)),
|
||||
Commands.SystemUnlink(var param, var flags) => ctx.Execute<SystemLink>(Unlink, m => m.UnlinkAccount(ctx, param.account, flags.yes)),
|
||||
Commands.SystemMembersListSelf(var param, var flags) => ctx.Execute<SystemList>(SystemList, m => m.MemberList(ctx, ctx.System, null, flags)),
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public class Random
|
|||
components: await _embeds.CreateGroupMessageComponents(ctx, target, groups.ToArray()[randInt], all));
|
||||
}
|
||||
|
||||
public async Task GroupMember(Context ctx, PKGroup group, GroupRandomMemberFlags flags)
|
||||
public async Task GroupMember(Context ctx, PKGroup group, bool all, bool show_embed, IHasListOptions flags)
|
||||
{
|
||||
ctx.CheckSystemPrivacy(group.System, group.ListPrivacy);
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ public class Random
|
|||
"This group has no members!"
|
||||
+ (ctx.System?.Id == group.System ? " Please add at least one member to this group before using this command." : ""));
|
||||
|
||||
if (!flags.all)
|
||||
if (!all)
|
||||
members = members.Where(g => g.MemberVisibility == PrivacyLevel.Public);
|
||||
else
|
||||
ctx.CheckOwnGroup(group);
|
||||
|
|
@ -112,7 +112,7 @@ public class Random
|
|||
|
||||
var randInt = randGen.Next(ms.Count);
|
||||
|
||||
if (flags.show_embed)
|
||||
if (show_embed)
|
||||
{
|
||||
await ctx.Reply(
|
||||
text: EmbedService.LEGACY_EMBED_WARNING,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,10 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
|||
|
||||
[
|
||||
command!(random => "random_self").flag(group),
|
||||
command!(random, group => "random_group_self"),
|
||||
command!(random, group::targeted() => "random_group_member_self").flags(get_list_flags()),
|
||||
command!(system::targeted(), random => "system_random").flag(group),
|
||||
command!(system::targeted(), random, group => "system_random_group"),
|
||||
command!(group::targeted(), random => "group_random_member").flags(get_list_flags()),
|
||||
]
|
||||
.into_iter()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
use std::iter::once;
|
||||
|
||||
use command_parser::token::TokensIterator;
|
||||
|
||||
use crate::utils::get_list_flags;
|
||||
|
|
@ -44,17 +46,17 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
|||
.flag(("private", ["priv"]))
|
||||
.flag(ALL)
|
||||
};
|
||||
let system_info_cmd_self = std::iter::once(add_info_flags(
|
||||
let system_info_cmd_self = once(add_info_flags(
|
||||
command!(system => "system_info_self").help("Shows information about your system"),
|
||||
));
|
||||
let system_info_cmd = std::iter::once(add_info_flags(
|
||||
let system_info_cmd = once(add_info_flags(
|
||||
command!(system_target, ("info", ["show", "view"]) => "system_info")
|
||||
.help("Shows information about your system"),
|
||||
));
|
||||
|
||||
let system_name = tokens!(system_target, "name");
|
||||
let system_name_cmd =
|
||||
std::iter::once(command!(system_name => "system_show_name").help("Shows the systems name"));
|
||||
once(command!(system_name => "system_show_name").help("Shows the systems name"));
|
||||
|
||||
let system_name_self = tokens!(system, "name");
|
||||
let system_name_self_cmd = [
|
||||
|
|
@ -68,7 +70,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
|||
.into_iter();
|
||||
|
||||
let system_server_name = tokens!(system_target, ("servername", ["sn", "guildname"]));
|
||||
let system_server_name_cmd = std::iter::once(
|
||||
let system_server_name_cmd = once(
|
||||
command!(system_server_name => "system_show_server_name")
|
||||
.help("Shows the system's server name"),
|
||||
);
|
||||
|
|
@ -86,7 +88,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
|||
.into_iter();
|
||||
|
||||
let system_description = tokens!(system_target, ("description", ["desc", "d"]));
|
||||
let system_description_cmd = std::iter::once(
|
||||
let system_description_cmd = once(
|
||||
command!(system_description => "system_show_description")
|
||||
.help("Shows the system's description"),
|
||||
);
|
||||
|
|
@ -103,9 +105,8 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
|||
.into_iter();
|
||||
|
||||
let system_color = tokens!(system_target, ("color", ["colour"]));
|
||||
let system_color_cmd = std::iter::once(
|
||||
command!(system_color => "system_show_color").help("Shows the system's color"),
|
||||
);
|
||||
let system_color_cmd =
|
||||
once(command!(system_color => "system_show_color").help("Shows the system's color"));
|
||||
|
||||
let system_color_self = tokens!(system, ("color", ["colour"]));
|
||||
let system_color_self_cmd = [
|
||||
|
|
@ -120,7 +121,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
|||
|
||||
let system_tag = tokens!(system_target, ("tag", ["suffix"]));
|
||||
let system_tag_cmd =
|
||||
std::iter::once(command!(system_tag => "system_show_tag").help("Shows the system's tag"));
|
||||
once(command!(system_tag => "system_show_tag").help("Shows the system's tag"));
|
||||
|
||||
let system_tag_self = tokens!(system, ("tag", ["suffix"]));
|
||||
let system_tag_self_cmd = [
|
||||
|
|
@ -134,7 +135,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
|||
.into_iter();
|
||||
|
||||
let system_server_tag = tokens!(system_target, ("servertag", ["st", "guildtag"]));
|
||||
let system_server_tag_cmd = std::iter::once(
|
||||
let system_server_tag_cmd = once(
|
||||
command!(system_server_tag => "system_show_server_tag")
|
||||
.help("Shows the system's server tag"),
|
||||
);
|
||||
|
|
@ -152,7 +153,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
|||
.into_iter();
|
||||
|
||||
let system_pronouns = tokens!(system_target, ("pronouns", ["prns"]));
|
||||
let system_pronouns_cmd = std::iter::once(
|
||||
let system_pronouns_cmd = once(
|
||||
command!(system_pronouns => "system_show_pronouns").help("Shows the system's pronouns"),
|
||||
);
|
||||
|
||||
|
|
@ -169,9 +170,8 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
|||
.into_iter();
|
||||
|
||||
let system_avatar = tokens!(system_target, ("avatar", ["pfp"]));
|
||||
let system_avatar_cmd = std::iter::once(
|
||||
command!(system_avatar => "system_show_avatar").help("Shows the system's avatar"),
|
||||
);
|
||||
let system_avatar_cmd =
|
||||
once(command!(system_avatar => "system_show_avatar").help("Shows the system's avatar"));
|
||||
|
||||
let system_avatar_self = tokens!(system, ("avatar", ["pfp"]));
|
||||
let system_avatar_self_cmd = [
|
||||
|
|
@ -186,7 +186,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
|||
.into_iter();
|
||||
|
||||
let system_server_avatar = tokens!(system_target, ("serveravatar", ["spfp"]));
|
||||
let system_server_avatar_cmd = std::iter::once(
|
||||
let system_server_avatar_cmd = once(
|
||||
command!(system_server_avatar => "system_show_server_avatar")
|
||||
.help("Shows the system's server avatar"),
|
||||
);
|
||||
|
|
@ -204,9 +204,8 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
|||
.into_iter();
|
||||
|
||||
let system_banner = tokens!(system_target, ("banner", ["cover"]));
|
||||
let system_banner_cmd = std::iter::once(
|
||||
command!(system_banner => "system_show_banner").help("Shows the system's banner"),
|
||||
);
|
||||
let system_banner_cmd =
|
||||
once(command!(system_banner => "system_show_banner").help("Shows the system's banner"));
|
||||
|
||||
let system_banner_self = tokens!(system, ("banner", ["cover"]));
|
||||
let system_banner_self_cmd = [
|
||||
|
|
@ -220,7 +219,7 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
|||
]
|
||||
.into_iter();
|
||||
|
||||
let system_delete = std::iter::once(
|
||||
let system_delete = once(
|
||||
command!(system, ("delete", ["erase", "remove", "yeet"]) => "system_delete")
|
||||
.flag(("no-export", ["ne"]))
|
||||
.help("Deletes the system"),
|
||||
|
|
@ -300,10 +299,8 @@ pub fn edit() -> impl Iterator<Item = Command> {
|
|||
.into_iter()
|
||||
.map(add_list_flags);
|
||||
|
||||
let system_display_id_self_cmd =
|
||||
std::iter::once(command!(system, "id" => "system_display_id_self"));
|
||||
let system_display_id_cmd =
|
||||
std::iter::once(command!(system_target, "id" => "system_display_id"));
|
||||
let system_display_id_self_cmd = once(command!(system, "id" => "system_display_id_self"));
|
||||
let system_display_id_cmd = once(command!(system_target, "id" => "system_display_id"));
|
||||
|
||||
system_info_cmd_self
|
||||
.chain(system_new_cmd)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue