fix: re-enable error messages for explicit commands
This commit is contained in:
parent
b998636cbe
commit
f897ce5a45
@ -253,16 +253,12 @@ namespace PluralKit.Bot
|
|||||||
|
|
||||||
// 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 reportChannel = handler.ErrorChannelFor(evt);
|
||||||
if (reportChannel != null)
|
if (reportChannel == null)
|
||||||
{
|
return;
|
||||||
var botPerms = PermissionsIn(reportChannel.Value);
|
|
||||||
if (botPerms.HasFlag(PermissionSet.SendMessages | PermissionSet.EmbedLinks))
|
var botPerms = PermissionsIn(reportChannel.Value);
|
||||||
{
|
if (botPerms.HasFlag(PermissionSet.SendMessages | PermissionSet.EmbedLinks))
|
||||||
// i'm just going to disable this for now we need to find something nicer
|
await _errorMessageService.SendErrorMessage(reportChannel.Value, sentryEvent.EventId.ToString());
|
||||||
// await _errorMessageService.SendErrorMessage(reportChannel.Value,
|
|
||||||
// sentryEvent.EventId.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ namespace PluralKit.Bot
|
|||||||
public class MessageCreated: IEventHandler<MessageCreateEvent>
|
public class MessageCreated: IEventHandler<MessageCreateEvent>
|
||||||
{
|
{
|
||||||
private readonly Bot _bot;
|
private readonly Bot _bot;
|
||||||
|
private readonly Cluster _cluster;
|
||||||
private readonly CommandTree _tree;
|
private readonly CommandTree _tree;
|
||||||
private readonly IDiscordCache _cache;
|
private readonly IDiscordCache _cache;
|
||||||
private readonly LastMessageCacheService _lastMessageCache;
|
private readonly LastMessageCacheService _lastMessageCache;
|
||||||
@ -31,9 +32,9 @@ namespace PluralKit.Bot
|
|||||||
private readonly BotConfig _config;
|
private readonly BotConfig _config;
|
||||||
private readonly DiscordApiClient _rest;
|
private readonly DiscordApiClient _rest;
|
||||||
|
|
||||||
public MessageCreated(LastMessageCacheService lastMessageCache, LoggerCleanService loggerClean,
|
public MessageCreated(LastMessageCacheService lastMessageCache, LoggerCleanService loggerClean, IMetrics metrics, ProxyService proxy,
|
||||||
IMetrics metrics, ProxyService proxy,
|
CommandTree tree, ILifetimeScope services, IDatabase db, BotConfig config, ModelRepository repo, IDiscordCache cache,
|
||||||
CommandTree tree, ILifetimeScope services, IDatabase db, BotConfig config, ModelRepository repo, IDiscordCache cache, Bot bot, DiscordApiClient rest)
|
Bot bot, Cluster cluster, DiscordApiClient rest)
|
||||||
{
|
{
|
||||||
_lastMessageCache = lastMessageCache;
|
_lastMessageCache = lastMessageCache;
|
||||||
_loggerClean = loggerClean;
|
_loggerClean = loggerClean;
|
||||||
@ -46,10 +47,18 @@ namespace PluralKit.Bot
|
|||||||
_repo = repo;
|
_repo = repo;
|
||||||
_cache = cache;
|
_cache = cache;
|
||||||
_bot = bot;
|
_bot = bot;
|
||||||
|
_cluster = cluster;
|
||||||
_rest = rest;
|
_rest = rest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ulong? ErrorChannelFor(MessageCreateEvent evt) => evt.ChannelId;
|
// for now, only return error messages for explicit commands
|
||||||
|
public ulong? ErrorChannelFor(MessageCreateEvent evt)
|
||||||
|
{
|
||||||
|
if (!HasCommandPrefix(evt.Content, _cluster.User?.Id ?? default, out var cmdStart) || cmdStart == evt.Content.Length)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return evt.ChannelId;
|
||||||
|
}
|
||||||
|
|
||||||
private bool IsDuplicateMessage(Message msg) =>
|
private bool IsDuplicateMessage(Message msg) =>
|
||||||
// We consider a message duplicate if it has the same ID as the previous message that hit the gateway
|
// We consider a message duplicate if it has the same ID as the previous message that hit the gateway
|
||||||
|
Loading…
Reference in New Issue
Block a user