Merge remote-tracking branch 'upstream/main' into rust-command-parser

This commit is contained in:
dusk 2025-08-09 17:38:44 +03:00
commit f721b850d4
No known key found for this signature in database
183 changed files with 5121 additions and 1909 deletions

View file

@ -443,10 +443,11 @@ public class Groups
await ctx.Reply(embed: new EmbedBuilder()
.Title("Group color")
.Color(target.Color.ToDiscordColor())
.Thumbnail(new Embed.EmbedThumbnail($"https://fakeimg.pl/256x256/{target.Color}/?text=%20"))
.Thumbnail(new Embed.EmbedThumbnail($"attachment://color.gif"))
.Description($"This group's color is **#{target.Color}**."
+ (isOwnSystem ? $" To clear it, type `{ctx.DefaultPrefix}group {target.Reference(ctx)} color -clear`." : ""))
.Build());
.Build(),
files: [MiscUtils.GenerateColorPreview(target.Color)]);
return;
}
@ -471,8 +472,9 @@ public class Groups
await ctx.Reply(embed: new EmbedBuilder()
.Title($"{Emojis.Success} Group color changed.")
.Color(color.ToDiscordColor())
.Thumbnail(new Embed.EmbedThumbnail($"https://fakeimg.pl/256x256/{color}/?text=%20"))
.Build());
.Thumbnail(new Embed.EmbedThumbnail($"attachment://color.gif"))
.Build(),
files: [MiscUtils.GenerateColorPreview(color)]);
}
}

View file

@ -308,10 +308,11 @@ public class MemberEdit
await ctx.Reply(embed: new EmbedBuilder()
.Title("Member color")
.Color(target.Color.ToDiscordColor())
.Thumbnail(new Embed.EmbedThumbnail($"https://fakeimg.pl/256x256/{target.Color}/?text=%20"))
.Thumbnail(new Embed.EmbedThumbnail($"attachment://color.gif"))
.Description($"This member's color is **#{target.Color}**."
+ (isOwnSystem ? $" To clear it, type `{ctx.DefaultPrefix}member {target.Reference(ctx)} color -clear`." : ""))
.Build());
.Build(),
files: [MiscUtils.GenerateColorPreview(target.Color)]);
return;
}
@ -336,8 +337,9 @@ public class MemberEdit
await ctx.Reply(embed: new EmbedBuilder()
.Title($"{Emojis.Success} Member color changed.")
.Color(color.ToDiscordColor())
.Thumbnail(new Embed.EmbedThumbnail($"https://fakeimg.pl/256x256/{color}/?text=%20"))
.Build());
.Thumbnail(new Embed.EmbedThumbnail($"attachment://color.gif"))
.Build(),
files: [MiscUtils.GenerateColorPreview(color)]);
}
}

View file

@ -305,7 +305,7 @@ public class ProxiedMessage
throw new PKError(error);
}
var lastMessage = _lastMessageCache.GetLastMessage(ctx.Message.ChannelId);
var lastMessage = await _lastMessageCache.GetLastMessage(ctx.Message.GuildId ?? 0, ctx.Message.ChannelId);
var isLatestMessage = lastMessage?.Current.Id == ctx.Message.Id
? lastMessage?.Previous?.Id == msg.Mid
@ -347,13 +347,8 @@ public class ProxiedMessage
var message = await ctx.Repository.GetFullMessage(messageId.Value);
if (message == null)
{
if (isDelete)
{
await DeleteCommandMessage(ctx, messageId.Value);
return;
}
throw Errors.MessageNotFound(messageId.Value);
await GetCommandMessage(ctx, messageId.Value, isDelete);
return;
}
var showContent = true;
@ -448,20 +443,35 @@ public class ProxiedMessage
await ctx.Reply(embed: await _embeds.CreateMessageInfoEmbed(message, showContent, ctx.Config));
}
private async Task DeleteCommandMessage(Context ctx, ulong messageId)
private async Task GetCommandMessage(Context ctx, ulong messageId, bool isDelete)
{
var cmessage = await ctx.Services.Resolve<CommandMessageService>().GetCommandMessage(messageId);
if (cmessage == null)
var msg = await _repo.GetCommandMessage(messageId);
if (msg == null)
throw Errors.MessageNotFound(messageId);
if (cmessage!.AuthorId != ctx.Author.Id)
throw new PKError("You can only delete command messages queried by this account.");
if (isDelete)
{
if (msg.Sender != ctx.Author.Id)
throw new PKError("You can only delete command messages queried by this account.");
await ctx.Rest.DeleteMessage(cmessage.ChannelId, messageId);
await ctx.Rest.DeleteMessage(msg.Channel, messageId);
if (ctx.Guild != null)
await ctx.Rest.DeleteMessage(ctx.Message);
else
await ctx.Rest.CreateReaction(ctx.Message.ChannelId, ctx.Message.Id, new Emoji { Name = Emojis.Success });
if (ctx.Guild != null)
await ctx.Rest.DeleteMessage(ctx.Message);
else
await ctx.Rest.CreateReaction(ctx.Message.ChannelId, ctx.Message.Id, new Emoji { Name = Emojis.Success });
return;
}
var showContent = true;
var channel = await _rest.GetChannelOrNull(msg.Channel);
if (channel == null)
showContent = false;
else if (!await ctx.CheckPermissionsInGuildChannel(channel, PermissionSet.ViewChannel))
showContent = false;
await ctx.Reply(embed: await _embeds.CreateCommandMessageInfoEmbed(msg, showContent));
}
}

View file

@ -37,10 +37,13 @@ public class System
.Field(new Embed.Field("Getting Started",
"New to PK? Check out our Getting Started guide on setting up members and proxies: https://pluralkit.me/start\n" +
$"Otherwise, type `{ctx.DefaultPrefix}system` to view your system and `{ctx.DefaultPrefix}system help` for more information about commands you can use."))
.Field(new Embed.Field($"{Emojis.Warn} Notice {Emojis.Warn}", "PluralKit is a bot meant to help you share information about your system. " +
.Field(new Embed.Field($"{Emojis.Warn} Notice: Public By Default {Emojis.Warn}", "PluralKit is a bot meant to help you share information about your system. " +
"Member descriptions are meant to be the equivalent to a Discord About Me. Because of this, any info you put in PK is **public by default**.\n" +
"Note that this does **not** include message content, only member fields. For more information, check out " +
"[the privacy section of the user guide](https://pluralkit.me/guide/#privacy). "))
.Field(new Embed.Field($"{Emojis.Warn} Notice: Implicit Acceptance of ToS {Emojis.Warn}", "By using the PluralKit bot you implicitly agree to our " +
"[Terms of Service](https://pluralkit.me/terms-of-service/). For questions please ask in our [support server](<https://discord.gg/PczBt78>) or " +
"email legal@pluralkit.me"))
.Field(new Embed.Field("System Recovery", "In the case of your Discord account getting lost or deleted, the PluralKit staff can help you recover your system. " +
"In order to do so, we will need your **PluralKit token**. This is the *only* way you can prove ownership so we can help you recover your system. " +
$"To get it, run `{ctx.DefaultPrefix}token` and then store it in a safe place.\n\n" +

View file

@ -233,8 +233,9 @@ public class SystemEdit
await ctx.Reply(embed: new EmbedBuilder()
.Title($"{Emojis.Success} System color changed.")
.Color(newColor.ToDiscordColor())
.Thumbnail(new Embed.EmbedThumbnail($"https://fakeimg.pl/256x256/{newColor}/?text=%20"))
.Build());
.Thumbnail(new Embed.EmbedThumbnail($"attachment://color.gif"))
.Build(),
files: [MiscUtils.GenerateColorPreview(color)]););
}
public async Task ClearColor(Context ctx, PKSystem target, bool flagConfirmYes)
@ -274,10 +275,11 @@ public class SystemEdit
await ctx.Reply(embed: new EmbedBuilder()
.Title("System color")
.Color(target.Color.ToDiscordColor())
.Thumbnail(new Embed.EmbedThumbnail($"https://fakeimg.pl/256x256/{target.Color}/?text=%20"))
.Thumbnail(new Embed.EmbedThumbnail($"attachment://color.gif"))
.Description(
$"This system's color is **#{target.Color}**." + (isOwnSystem ? $" To clear it, type `{ctx.DefaultPrefix}s color -clear`." : ""))
.Build());
.Build(),
files: [MiscUtils.GenerateColorPreview(target.Color)]);
}
public async Task ClearTag(Context ctx, PKSystem target, bool flagConfirmYes)
@ -475,7 +477,7 @@ public class SystemEdit
else
str +=
" Member names will now use the global system tag when proxied in the current server, if there is one set."
+ "\n\nTo check or change where your tag appears in your name use the command `{ctx.DefaultPrefix}cfg name format`.";
+ $"\n\nTo check or change where your tag appears in your name use the command `{ctx.DefaultPrefix}cfg name format`.";
}
}