mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-06 05:47:53 +00:00
Ignore proxying messages with no content and no attachment
This commit is contained in:
parent
6668cd8d2d
commit
206d403526
1 changed files with 6 additions and 2 deletions
|
|
@ -92,11 +92,15 @@ namespace PluralKit.Bot
|
|||
// Find a member with proxy tags matching the message
|
||||
var match = GetProxyTagMatch(message.Content, results);
|
||||
if (match == null) return;
|
||||
|
||||
|
||||
// We know message.Channel can only be ITextChannel as PK doesn't work in DMs/groups
|
||||
// Afterwards we ensure the bot has the right permissions, otherwise bail early
|
||||
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
|
||||
var webhook = await _webhookCache.GetWebhook(message.Channel as ITextChannel);
|
||||
var hookMessageId = await ExecuteWebhook(webhook, match.InnerText, match.ProxyName, match.Member.AvatarUrl, message.Attachments.FirstOrDefault());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue