diff --git a/PluralKit.Bot/CommandMeta/CommandHelp.cs b/PluralKit.Bot/CommandMeta/CommandHelp.cs index 7cbb4082..859c3c34 100644 --- a/PluralKit.Bot/CommandMeta/CommandHelp.cs +++ b/PluralKit.Bot/CommandMeta/CommandHelp.cs @@ -19,6 +19,7 @@ public partial class CommandTree public static Command SystemFronter = new Command("system fronter", "system [system] fronter", "Shows a system's fronter(s)"); public static Command SystemFrontHistory = new Command("system fronthistory", "system [system] fronthistory", "Shows a system's front history"); public static Command SystemFrontPercent = new Command("system frontpercent", "system [system] frontpercent [timespan]", "Shows a system's front breakdown"); + public static Command SystemId = new Command("system id", "system [system] id", "Prints your system's id."); public static Command SystemPrivacy = new Command("system privacy", "system [system] privacy ", "Changes your system's privacy settings"); public static Command ConfigTimezone = new Command("config timezone", "config timezone [timezone]", "Changes your system's time zone"); public static Command ConfigPing = new Command("config ping", "config ping [on|off]", "Changes your system's ping preferences"); @@ -52,6 +53,7 @@ public partial class CommandTree public static Command MemberAutoproxy = new Command("member autoproxy", "member autoproxy [on|off]", "Sets whether a member will be autoproxied when autoproxy is set to latch or front mode."); public static Command MemberKeepProxy = new Command("member keepproxy", "member keepproxy [on|off]", "Sets whether to include a member's proxy tags when proxying"); public static Command MemberRandom = new Command("system random", "system [system] random", "Shows the info card of a randomly selected member in a system."); + public static Command MemberId = new Command("member id", "member [member] id", "Prints a member's id."); public static Command MemberPrivacy = new Command("member privacy", "member privacy ", "Changes a members's privacy settings"); public static Command GroupInfo = new Command("group", "group ", "Looks up information about a group"); public static Command GroupNew = new Command("group new", "group new ", "Creates a new group"); @@ -63,6 +65,7 @@ public partial class CommandTree public static Command GroupColor = new Command("group color", "group color [color]", "Changes a group's color"); public static Command GroupAdd = new Command("group add", "group add [member 2] [member 3...]", "Adds one or more members to a group"); public static Command GroupRemove = new Command("group remove", "group remove [member 2] [member 3...]", "Removes one or more members from a group"); + public static Command GroupId = new Command("group id", "group [group] id", "Prints a group's id."); public static Command GroupPrivacy = new Command("group privacy", "group privacy ", "Changes a group's privacy settings"); public static Command GroupBannerImage = new Command("group banner", "group banner [url]", "Set the group's banner image"); public static Command GroupIcon = new Command("group icon", "group icon [url|@mention]", "Changes a group's icon"); diff --git a/PluralKit.Bot/CommandMeta/CommandTree.cs b/PluralKit.Bot/CommandMeta/CommandTree.cs index 233ec147..691b0828 100644 --- a/PluralKit.Bot/CommandMeta/CommandTree.cs +++ b/PluralKit.Bot/CommandMeta/CommandTree.cs @@ -250,6 +250,8 @@ public partial class CommandTree await ctx.CheckSystem(target).Execute(SystemPrivacy, m => m.SystemPrivacy(ctx, target)); else if (ctx.Match("delete", "remove", "destroy", "erase", "yeet")) await ctx.CheckSystem(target).Execute(SystemDelete, m => m.Delete(ctx, target)); + else if (ctx.Match("id")) + await ctx.CheckSystem(target).Execute(SystemId, m => m.DisplayId(ctx, target)); else if (ctx.Match("random", "r")) if (ctx.Match("group", "g") || ctx.MatchFlag("group", "g")) await ctx.CheckSystem(target).Execute(GroupRandom, r => r.Group(ctx, target)); @@ -317,6 +319,8 @@ public partial class CommandTree await ctx.Execute(MemberAutoproxy, m => m.MemberAutoproxy(ctx, target)); else if (ctx.Match("keepproxy", "keeptags", "showtags", "kp")) await ctx.Execute(MemberKeepProxy, m => m.KeepProxy(ctx, target)); + else if (ctx.Match("id")) + await ctx.Execute(MemberId, m => m.DisplayId(ctx, target)); else if (ctx.Match("privacy")) await ctx.Execute(MemberPrivacy, m => m.Privacy(ctx, target, null)); else if (ctx.Match("private", "hidden", "hide")) @@ -377,6 +381,8 @@ public partial class CommandTree await ctx.Execute(GroupFrontPercent, g => g.FrontPercent(ctx, group: target)); else if (ctx.Match("color", "colour")) await ctx.Execute(GroupColor, g => g.GroupColor(ctx, target)); + else if (ctx.Match("id")) + await ctx.Execute(GroupId, g => g.DisplayId(ctx, target)); else if (!ctx.HasNext()) await ctx.Execute(GroupInfo, g => g.ShowGroupCard(ctx, target)); else diff --git a/PluralKit.Bot/Commands/Groups.cs b/PluralKit.Bot/Commands/Groups.cs index 62bf5ffa..0567f1ef 100644 --- a/PluralKit.Bot/Commands/Groups.cs +++ b/PluralKit.Bot/Commands/Groups.cs @@ -577,6 +577,11 @@ public class Groups await ctx.Reply($"{Emojis.Success} Group deleted."); } + public async Task DisplayId(Context ctx, PKGroup target) + { + await ctx.Reply($"{target.Hid}"); + } + private async Task GetGroupSystem(Context ctx, PKGroup target) { var system = ctx.System; diff --git a/PluralKit.Bot/Commands/Member.cs b/PluralKit.Bot/Commands/Member.cs index c06fc24a..032afeef 100644 --- a/PluralKit.Bot/Commands/Member.cs +++ b/PluralKit.Bot/Commands/Member.cs @@ -140,4 +140,9 @@ public class Member .Description($"*{scream}*"); await ctx.Reply(embed: eb.Build()); } + + public async Task DisplayId(Context ctx, PKMember target) + { + await ctx.Reply($"{target.Hid}"); + } } \ No newline at end of file diff --git a/PluralKit.Bot/Commands/System.cs b/PluralKit.Bot/Commands/System.cs index 4046220d..5656a1e6 100644 --- a/PluralKit.Bot/Commands/System.cs +++ b/PluralKit.Bot/Commands/System.cs @@ -33,4 +33,12 @@ public class System await ctx.Reply( $"{Emojis.Success} Your system has been created. Type `pk;system` to view it, and type `pk;system help` for more information about commands you can use now. Now that you have that set up, check out the getting started guide on setting up members and proxies: "); } + + public async Task DisplayId(Context ctx, PKSystem target) + { + if (target == null) + throw Errors.NoSystemError; + + await ctx.Reply($"{target.Hid}"); + } } \ No newline at end of file diff --git a/docs/content/command-list.md b/docs/content/command-list.md index 2c47711e..be8d8423 100644 --- a/docs/content/command-list.md +++ b/docs/content/command-list.md @@ -54,6 +54,7 @@ Some arguments indicate the use of specific Discord features. These include: - `pk;find ` - Searches members by name. - `pk;system [system] find ` - (same as above, but for a specific system) - `pk;system [system] random [-group]` - Shows the info card of a randomly selected member [or group] in a system. +- `pk;system [system] id` - Prints a system's id. ## Member commands *Replace `` with a member's name, 5-character ID or display name. For most commands, adding `-clear` will clear/delete the field.* @@ -77,6 +78,7 @@ Some arguments indicate the use of specific Discord features. These include: - `pk;member color [color]` - Changes the color of a member. - `pk;member birthdate [birthdate|today]` - Changes the birthday of a member. - `pk;member delete` - Deletes a member. +- `pk;member id` - Prints a member's id. ## Group commands *Replace `` with a group's name, 5-character ID or display name. For most commands, adding `-clear` will clear/delete the field.* @@ -94,6 +96,7 @@ Some arguments indicate the use of specific Discord features. These include: - `pk;group icon [icon url|@mention|upload]` - Shows or changes a group's icon. - `pk;group banner [image url|upload]` - Shows or changes a group's banner image. - `pk;group delete` - Deletes a group. +- `pk;group id` - Prints a group's id. ## Switching commands - `pk;switch [member...]` - Registers a switch with the given members.