mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
fix: check HasNext after matching message in EditMessage, use PKSyntaxError instead of PKError
This commit is contained in:
parent
4a739c2d61
commit
31a129dabf
1 changed files with 6 additions and 6 deletions
|
|
@ -46,14 +46,14 @@ public class ProxiedMessage
|
|||
|
||||
public async Task EditMessage(Context ctx)
|
||||
{
|
||||
if (!ctx.HasNext())
|
||||
throw new PKSyntaxError("You need to include the message to edit in.");
|
||||
|
||||
var msg = await GetMessageToEdit(ctx);
|
||||
|
||||
if (ctx.System.Id != msg.System?.Id)
|
||||
throw new PKError("Can't edit a message sent by a different system.");
|
||||
|
||||
if (!ctx.HasNext())
|
||||
throw new PKSyntaxError("You need to include the message to edit in.");
|
||||
|
||||
var newContent = ctx.RemainderOrNull().NormalizeLineEndSpacing();
|
||||
|
||||
var originalMsg = await _rest.GetMessageOrNull(msg.Message.Channel, msg.Message.Mid);
|
||||
|
|
@ -96,15 +96,15 @@ public class ProxiedMessage
|
|||
if (msg == null)
|
||||
{
|
||||
if (ctx.Guild == null)
|
||||
throw new PKError("You must use a message link to edit messages in DMs.");
|
||||
throw new PKSyntaxError("You must use a message link to edit messages in DMs.");
|
||||
|
||||
var recent = await FindRecentMessage(ctx);
|
||||
if (recent == null)
|
||||
throw new PKError("Could not find a recent message to edit.");
|
||||
throw new PKSyntaxError("Could not find a recent message to edit.");
|
||||
|
||||
msg = await _repo.GetMessage(conn, recent.Mid);
|
||||
if (msg == null)
|
||||
throw new PKError("Could not find a recent message to edit.");
|
||||
throw new PKSyntaxError("Could not find a recent message to edit.");
|
||||
}
|
||||
|
||||
if (msg.Message.Channel != ctx.Channel.Id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue