fix: unbreak error reporting for @mention prefix

This commit is contained in:
spiral
2022-01-14 15:05:46 -05:00
parent 47e15e3acb
commit d58cc216c0
3 changed files with 5 additions and 6 deletions

View File

@@ -6,5 +6,5 @@ public interface IEventHandler<in T> where T : IGatewayEvent
{
Task Handle(Shard shard, T evt);
ulong? ErrorChannelFor(T evt) => null;
ulong? ErrorChannelFor(T evt, ulong userId) => null;
}

View File

@@ -51,11 +51,9 @@ public class MessageCreated: IEventHandler<MessageCreateEvent>
}
// for now, only return error messages for explicit commands
public ulong? ErrorChannelFor(MessageCreateEvent evt)
public ulong? ErrorChannelFor(MessageCreateEvent evt, ulong userId)
{
// todo: fix @mention prefix
// it only breaks error reporting so I'm not *too* worried about it, but should be fixed eventually
if (!HasCommandPrefix(evt.Content, default, out var cmdStart) || cmdStart == evt.Content.Length)
if (!HasCommandPrefix(evt.Content, userId, out var cmdStart) || cmdStart == evt.Content.Length)
return null;
return evt.ChannelId;