Add group name/description/list commands

This commit is contained in:
Ske
2020-07-06 19:50:39 +02:00
parent 253ae43c7f
commit 6c5cb8cea7
7 changed files with 152 additions and 6 deletions

View File

@@ -25,6 +25,13 @@ namespace PluralKit.Bot
return ctx;
}
public static Context CheckOwnGroup(this Context ctx, PKGroup group)
{
if (group.System != ctx.System?.Id)
throw Errors.NotOwnMemberError;
return ctx;
}
public static Context CheckSystem(this Context ctx)
{
if (ctx.System == null)

View File

@@ -133,6 +133,21 @@ namespace PluralKit.Bot
return $"Member not found. Note that a member ID is 5 characters long.";
}
public static string CreateGroupNotFoundError(this Context ctx, string input)
{
// TODO: does this belong here?
if (input.Length == 5)
{
if (ctx.System != null)
return $"Group with ID or name \"{input}\" not found.";
return $"Group with ID \"{input}\" not found."; // Accounts without systems can't query by name
}
if (ctx.System != null)
return $"Group with name \"{input}\" not found. Note that a group ID is 5 characters long.";
return $"Group not found. Note that a group ID is 5 characters long.";
}
public static async Task<DiscordChannel> MatchChannel(this Context ctx)
{
if (!MentionUtils.TryParseChannel(ctx.PeekArgument(), out var id))