Ignore proxying messages with no content and no attachment

This commit is contained in:
Ske 2019-07-15 21:37:34 +02:00
parent 6668cd8d2d
commit 206d403526

View File

@ -97,6 +97,10 @@ namespace PluralKit.Bot
// Afterwards we ensure the bot has the right permissions, otherwise bail early // Afterwards we ensure the bot has the right permissions, otherwise bail early
if (!await EnsureBotPermissions(message.Channel as ITextChannel)) return; if (!await EnsureBotPermissions(message.Channel as ITextChannel)) return;
// Can't proxy a message with no content and no attachment
if (match.InnerText.Trim().Length == 0 && message.Attachments.Count == 0)
return;
// Fetch a webhook for this channel, and send the proxied message // Fetch a webhook for this channel, and send the proxied message
var webhook = await _webhookCache.GetWebhook(message.Channel as ITextChannel); var webhook = await _webhookCache.GetWebhook(message.Channel as ITextChannel);
var hookMessageId = await ExecuteWebhook(webhook, match.InnerText, match.ProxyName, match.Member.AvatarUrl, message.Attachments.FirstOrDefault()); var hookMessageId = await ExecuteWebhook(webhook, match.InnerText, match.ProxyName, match.Member.AvatarUrl, message.Attachments.FirstOrDefault());