Merge branch 'main' into feature/groups
This commit is contained in:
@@ -37,8 +37,14 @@ namespace PluralKit.Bot {
|
||||
if (logChannel == null || logChannel.Type != ChannelType.Text) return;
|
||||
|
||||
// Check bot permissions
|
||||
if (!trigger.Channel.BotHasAllPermissions(Permissions.SendMessages | Permissions.EmbedLinks)) return;
|
||||
|
||||
if (!trigger.Channel.BotHasAllPermissions(Permissions.SendMessages | Permissions.EmbedLinks))
|
||||
{
|
||||
_logger.Information(
|
||||
"Does not have permission to proxy log, ignoring (channel: {ChannelId}, guild: {GuildId}, bot permissions: {BotPermissions})",
|
||||
ctx.LogChannel.Value, trigger.Channel.GuildId, trigger.Channel.BotPermissions());
|
||||
return;
|
||||
}
|
||||
|
||||
// Send embed!
|
||||
await using var conn = await _db.Obtain();
|
||||
var embed = _embed.CreateLoggedMessageEmbed(await conn.QuerySystem(ctx.SystemId.Value),
|
||||
@@ -55,7 +61,7 @@ namespace PluralKit.Bot {
|
||||
if (obj == null)
|
||||
{
|
||||
// Channel doesn't exist or we don't have permission to access it, let's remove it from the database too
|
||||
_logger.Warning("Attempted to fetch missing log channel {LogChannel}, removing from database", channel);
|
||||
_logger.Warning("Attempted to fetch missing log channel {LogChannel} for guild {Guild}, removing from database", channel, guild);
|
||||
await using var conn = await _db.Obtain();
|
||||
await conn.ExecuteAsync("update servers set log_channel = null where id = @Guild",
|
||||
new {Guild = guild});
|
||||
|
@@ -67,7 +67,8 @@ namespace PluralKit.Bot
|
||||
dwb.WithUsername(FixClyde(name).Truncate(80));
|
||||
dwb.WithContent(content);
|
||||
dwb.AddMentions(content.ParseAllMentions(allowEveryone, channel.Guild));
|
||||
if (avatarUrl != null) dwb.WithAvatarUrl(avatarUrl);
|
||||
if (!string.IsNullOrWhiteSpace(avatarUrl))
|
||||
dwb.WithAvatarUrl(avatarUrl);
|
||||
|
||||
var attachmentChunks = ChunkAttachmentsOrThrow(attachments, 8 * 1024 * 1024);
|
||||
if (attachmentChunks.Count > 0)
|
||||
|
Reference in New Issue
Block a user