feat: add command for calling up ids

This commit is contained in:
Jake Fulmine 2022-08-27 13:52:50 +02:00
parent ccac0a9203
commit cd14e6409b
6 changed files with 30 additions and 0 deletions

View File

@ -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 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 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 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 <description|members|fronter|fronthistory|all> <public|private>", "Changes your system's privacy settings"); public static Command SystemPrivacy = new Command("system privacy", "system [system] privacy <description|members|fronter|fronthistory|all> <public|private>", "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 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"); 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 <member> autoproxy [on|off]", "Sets whether a member will be autoproxied when autoproxy is set to latch or front mode."); public static Command MemberAutoproxy = new Command("member autoproxy", "member <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 <member> keepproxy [on|off]", "Sets whether to include a member's proxy tags when proxying"); public static Command MemberKeepProxy = new Command("member keepproxy", "member <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 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 <member> privacy <name|description|birthday|pronouns|metadata|visibility|all> <public|private>", "Changes a members's privacy settings"); public static Command MemberPrivacy = new Command("member privacy", "member <member> privacy <name|description|birthday|pronouns|metadata|visibility|all> <public|private>", "Changes a members's privacy settings");
public static Command GroupInfo = new Command("group", "group <name>", "Looks up information about a group"); public static Command GroupInfo = new Command("group", "group <name>", "Looks up information about a group");
public static Command GroupNew = new Command("group new", "group new <name>", "Creates a new group"); public static Command GroupNew = new Command("group new", "group new <name>", "Creates a new group");
@ -63,6 +65,7 @@ public partial class CommandTree
public static Command GroupColor = new Command("group color", "group <group> color [color]", "Changes a group's color"); public static Command GroupColor = new Command("group color", "group <group> color [color]", "Changes a group's color");
public static Command GroupAdd = new Command("group add", "group <group> add <member> [member 2] [member 3...]", "Adds one or more members to a group"); public static Command GroupAdd = new Command("group add", "group <group> add <member> [member 2] [member 3...]", "Adds one or more members to a group");
public static Command GroupRemove = new Command("group remove", "group <group> remove <member> [member 2] [member 3...]", "Removes one or more members from a group"); public static Command GroupRemove = new Command("group remove", "group <group> remove <member> [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 <group> privacy <name|description|icon|metadata|visibility|all> <public|private>", "Changes a group's privacy settings"); public static Command GroupPrivacy = new Command("group privacy", "group <group> privacy <name|description|icon|metadata|visibility|all> <public|private>", "Changes a group's privacy settings");
public static Command GroupBannerImage = new Command("group banner", "group <group> banner [url]", "Set the group's banner image"); public static Command GroupBannerImage = new Command("group banner", "group <group> banner [url]", "Set the group's banner image");
public static Command GroupIcon = new Command("group icon", "group <group> icon [url|@mention]", "Changes a group's icon"); public static Command GroupIcon = new Command("group icon", "group <group> icon [url|@mention]", "Changes a group's icon");

View File

@ -250,6 +250,8 @@ public partial class CommandTree
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemPrivacy, m => m.SystemPrivacy(ctx, target)); await ctx.CheckSystem(target).Execute<SystemEdit>(SystemPrivacy, m => m.SystemPrivacy(ctx, target));
else if (ctx.Match("delete", "remove", "destroy", "erase", "yeet")) else if (ctx.Match("delete", "remove", "destroy", "erase", "yeet"))
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemDelete, m => m.Delete(ctx, target)); await ctx.CheckSystem(target).Execute<SystemEdit>(SystemDelete, m => m.Delete(ctx, target));
else if (ctx.Match("id"))
await ctx.CheckSystem(target).Execute<System>(SystemId, m => m.DisplayId(ctx, target));
else if (ctx.Match("random", "r")) else if (ctx.Match("random", "r"))
if (ctx.Match("group", "g") || ctx.MatchFlag("group", "g")) if (ctx.Match("group", "g") || ctx.MatchFlag("group", "g"))
await ctx.CheckSystem(target).Execute<Random>(GroupRandom, r => r.Group(ctx, target)); await ctx.CheckSystem(target).Execute<Random>(GroupRandom, r => r.Group(ctx, target));
@ -317,6 +319,8 @@ public partial class CommandTree
await ctx.Execute<MemberEdit>(MemberAutoproxy, m => m.MemberAutoproxy(ctx, target)); await ctx.Execute<MemberEdit>(MemberAutoproxy, m => m.MemberAutoproxy(ctx, target));
else if (ctx.Match("keepproxy", "keeptags", "showtags", "kp")) else if (ctx.Match("keepproxy", "keeptags", "showtags", "kp"))
await ctx.Execute<MemberEdit>(MemberKeepProxy, m => m.KeepProxy(ctx, target)); await ctx.Execute<MemberEdit>(MemberKeepProxy, m => m.KeepProxy(ctx, target));
else if (ctx.Match("id"))
await ctx.Execute<Member>(MemberId, m => m.DisplayId(ctx, target));
else if (ctx.Match("privacy")) else if (ctx.Match("privacy"))
await ctx.Execute<MemberEdit>(MemberPrivacy, m => m.Privacy(ctx, target, null)); await ctx.Execute<MemberEdit>(MemberPrivacy, m => m.Privacy(ctx, target, null));
else if (ctx.Match("private", "hidden", "hide")) else if (ctx.Match("private", "hidden", "hide"))
@ -377,6 +381,8 @@ public partial class CommandTree
await ctx.Execute<SystemFront>(GroupFrontPercent, g => g.FrontPercent(ctx, group: target)); await ctx.Execute<SystemFront>(GroupFrontPercent, g => g.FrontPercent(ctx, group: target));
else if (ctx.Match("color", "colour")) else if (ctx.Match("color", "colour"))
await ctx.Execute<Groups>(GroupColor, g => g.GroupColor(ctx, target)); await ctx.Execute<Groups>(GroupColor, g => g.GroupColor(ctx, target));
else if (ctx.Match("id"))
await ctx.Execute<Groups>(GroupId, g => g.DisplayId(ctx, target));
else if (!ctx.HasNext()) else if (!ctx.HasNext())
await ctx.Execute<Groups>(GroupInfo, g => g.ShowGroupCard(ctx, target)); await ctx.Execute<Groups>(GroupInfo, g => g.ShowGroupCard(ctx, target));
else else

View File

@ -577,6 +577,11 @@ public class Groups
await ctx.Reply($"{Emojis.Success} Group deleted."); await ctx.Reply($"{Emojis.Success} Group deleted.");
} }
public async Task DisplayId(Context ctx, PKGroup target)
{
await ctx.Reply($"{target.Hid}");
}
private async Task<PKSystem> GetGroupSystem(Context ctx, PKGroup target) private async Task<PKSystem> GetGroupSystem(Context ctx, PKGroup target)
{ {
var system = ctx.System; var system = ctx.System;

View File

@ -140,4 +140,9 @@ public class Member
.Description($"*{scream}*"); .Description($"*{scream}*");
await ctx.Reply(embed: eb.Build()); await ctx.Reply(embed: eb.Build());
} }
public async Task DisplayId(Context ctx, PKMember target)
{
await ctx.Reply($"{target.Hid}");
}
} }

View File

@ -33,4 +33,12 @@ public class System
await ctx.Reply( 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: <https://pluralkit.me/start>"); $"{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: <https://pluralkit.me/start>");
} }
public async Task DisplayId(Context ctx, PKSystem target)
{
if (target == null)
throw Errors.NoSystemError;
await ctx.Reply($"{target.Hid}");
}
} }

View File

@ -54,6 +54,7 @@ Some arguments indicate the use of specific Discord features. These include:
- `pk;find <search term>` - Searches members by name. - `pk;find <search term>` - Searches members by name.
- `pk;system [system] find <search term>` - (same as above, but for a specific system) - `pk;system [system] find <search term>` - (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] 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 ## Member commands
*Replace `<member>` with a member's name, 5-character ID or display name. For most commands, adding `-clear` will clear/delete the field.* *Replace `<member>` 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 <member> color [color]` - Changes the color of a member. - `pk;member <member> color [color]` - Changes the color of a member.
- `pk;member <member> birthdate [birthdate|today]` - Changes the birthday of a member. - `pk;member <member> birthdate [birthdate|today]` - Changes the birthday of a member.
- `pk;member <member> delete` - Deletes a member. - `pk;member <member> delete` - Deletes a member.
- `pk;member <member> id` - Prints a member's id.
## Group commands ## Group commands
*Replace `<group>` with a group's name, 5-character ID or display name. For most commands, adding `-clear` will clear/delete the field.* *Replace `<group>` 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 <group> icon [icon url|@mention|upload]` - Shows or changes a group's icon. - `pk;group <group> icon [icon url|@mention|upload]` - Shows or changes a group's icon.
- `pk;group <group> banner [image url|upload]` - Shows or changes a group's banner image. - `pk;group <group> banner [image url|upload]` - Shows or changes a group's banner image.
- `pk;group <group> delete` - Deletes a group. - `pk;group <group> delete` - Deletes a group.
- `pk;group <group> id` - Prints a group's id.
## Switching commands ## Switching commands
- `pk;switch [member...]` - Registers a switch with the given members. - `pk;switch [member...]` - Registers a switch with the given members.