fix: unbreak error reporting for @mention prefix
This commit is contained in:
parent
47e15e3acb
commit
d58cc216c0
@ -220,7 +220,8 @@ public class Bot
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Once we've sent it to Sentry, report it to the user (if we have permission to)
|
// Once we've sent it to Sentry, report it to the user (if we have permission to)
|
||||||
var reportChannel = handler.ErrorChannelFor(evt);
|
var ourUserId = await _cache.GetOwnUser();
|
||||||
|
var reportChannel = handler.ErrorChannelFor(evt, ourUserId);
|
||||||
if (reportChannel == null)
|
if (reportChannel == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -6,5 +6,5 @@ public interface IEventHandler<in T> where T : IGatewayEvent
|
|||||||
{
|
{
|
||||||
Task Handle(Shard shard, T evt);
|
Task Handle(Shard shard, T evt);
|
||||||
|
|
||||||
ulong? ErrorChannelFor(T evt) => null;
|
ulong? ErrorChannelFor(T evt, ulong userId) => null;
|
||||||
}
|
}
|
@ -51,11 +51,9 @@ public class MessageCreated: IEventHandler<MessageCreateEvent>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// for now, only return error messages for explicit commands
|
// 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
|
if (!HasCommandPrefix(evt.Content, userId, out var cmdStart) || cmdStart == evt.Content.Length)
|
||||||
// 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)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return evt.ChannelId;
|
return evt.ChannelId;
|
||||||
|
Loading…
Reference in New Issue
Block a user