mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
implement show-embed flags
This commit is contained in:
parent
02a99025dc
commit
c00ff2f371
8 changed files with 24 additions and 20 deletions
|
|
@ -517,10 +517,10 @@ public class Groups
|
|||
return title.ToString();
|
||||
}
|
||||
|
||||
public async Task ShowGroupCard(Context ctx, PKGroup target)
|
||||
public async Task ShowGroupCard(Context ctx, PKGroup target, bool showEmbed = false)
|
||||
{
|
||||
var system = await GetGroupSystem(ctx, target);
|
||||
if (ctx.MatchFlag("show-embed", "se"))
|
||||
if (showEmbed)
|
||||
{
|
||||
await ctx.Reply(text: EmbedService.LEGACY_EMBED_WARNING, embed: await _embeds.CreateGroupEmbed(ctx, system, target));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ namespace PluralKit.Bot;
|
|||
|
||||
public class Help
|
||||
{
|
||||
public Task HelpRoot(Context ctx)
|
||||
public Task HelpRoot(Context ctx, bool showEmbed = false)
|
||||
{
|
||||
if (ctx.MatchFlag("show-embed", "se"))
|
||||
if (showEmbed)
|
||||
return HelpRootOld(ctx);
|
||||
|
||||
return ctx.Reply(BuildComponents(ctx.Author.Id, Help.Description.Replace("{prefix}", ctx.DefaultPrefix), -1));
|
||||
|
|
|
|||
|
|
@ -120,10 +120,10 @@ public class Member
|
|||
await ctx.Reply(replyStr);
|
||||
}
|
||||
|
||||
public async Task ViewMember(Context ctx, PKMember target)
|
||||
public async Task ViewMember(Context ctx, PKMember target, bool showEmbed = false)
|
||||
{
|
||||
var system = await ctx.Repository.GetSystem(target.System);
|
||||
if (ctx.MatchFlag("show-embed", "se"))
|
||||
if (showEmbed)
|
||||
{
|
||||
await ctx.Reply(
|
||||
text: EmbedService.LEGACY_EMBED_WARNING,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public class Random
|
|||
|
||||
// todo: get postgresql to return one random member/group instead of querying all members/groups
|
||||
|
||||
public async Task Member(Context ctx, PKSystem target)
|
||||
public async Task Member(Context ctx, PKSystem target, bool showEmbed = false)
|
||||
{
|
||||
if (target == null)
|
||||
throw Errors.NoSystemError(ctx.DefaultPrefix);
|
||||
|
|
@ -37,7 +37,7 @@ public class Random
|
|||
|
||||
var randInt = randGen.Next(members.Count);
|
||||
|
||||
if (ctx.MatchFlag("show-embed", "se"))
|
||||
if (showEmbed)
|
||||
{
|
||||
await ctx.Reply(
|
||||
text: EmbedService.LEGACY_EMBED_WARNING,
|
||||
|
|
@ -49,7 +49,7 @@ public class Random
|
|||
components: await _embeds.CreateMemberMessageComponents(target, members[randInt], ctx.Guild, ctx.Config, ctx.LookupContextFor(target.Id), ctx.Zone));
|
||||
}
|
||||
|
||||
public async Task Group(Context ctx, PKSystem target)
|
||||
public async Task Group(Context ctx, PKSystem target, bool showEmbed = false)
|
||||
{
|
||||
if (target == null)
|
||||
throw Errors.NoSystemError(ctx.DefaultPrefix);
|
||||
|
|
@ -70,7 +70,7 @@ public class Random
|
|||
|
||||
var randInt = randGen.Next(groups.Count());
|
||||
|
||||
if (ctx.MatchFlag("show-embed", "se"))
|
||||
if (showEmbed)
|
||||
{
|
||||
await ctx.Reply(
|
||||
text: EmbedService.LEGACY_EMBED_WARNING,
|
||||
|
|
@ -82,7 +82,7 @@ public class Random
|
|||
components: await _embeds.CreateGroupMessageComponents(ctx, target, groups.ToArray()[randInt]));
|
||||
}
|
||||
|
||||
public async Task GroupMember(Context ctx, PKGroup group)
|
||||
public async Task GroupMember(Context ctx, PKGroup group, bool showEmbed = false)
|
||||
{
|
||||
ctx.CheckSystemPrivacy(group.System, group.ListPrivacy);
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ public class Random
|
|||
|
||||
var randInt = randGen.Next(ms.Count);
|
||||
|
||||
if (ctx.MatchFlag("show-embed", "se"))
|
||||
if (showEmbed)
|
||||
{
|
||||
await ctx.Reply(
|
||||
text: EmbedService.LEGACY_EMBED_WARNING,
|
||||
|
|
|
|||
|
|
@ -14,16 +14,16 @@ public class System
|
|||
_embeds = embeds;
|
||||
}
|
||||
|
||||
public async Task Query(Context ctx, PKSystem system, bool all, bool @public, bool @private)
|
||||
public async Task Query(Context ctx, PKSystem system, bool all, bool @public, bool @private, bool showEmbed = false)
|
||||
{
|
||||
if (system == null) throw Errors.NoSystemError(ctx.DefaultPrefix);
|
||||
if (ctx.MatchFlag("show-embed", "se"))
|
||||
if (showEmbed)
|
||||
{
|
||||
await ctx.Reply(text: EmbedService.LEGACY_EMBED_WARNING, embed: await _embeds.CreateSystemEmbed(ctx, system, ctx.LookupContextFor(system.Id), all));
|
||||
return;
|
||||
}
|
||||
|
||||
await ctx.Reply(components: await _embeds.CreateSystemMessageComponents(ctx, system, ctx.LookupContextFor(system.Id)));
|
||||
await ctx.Reply(components: await _embeds.CreateSystemMessageComponents(ctx, system, ctx.LookupContextFor(system.Id), all));
|
||||
}
|
||||
|
||||
public async Task New(Context ctx, string? systemName)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue