diff --git a/.github/workflows/beta-bot.yml b/.github/workflows/beta-bot.yml deleted file mode 100644 index e9f34a8b..00000000 --- a/.github/workflows/beta-bot.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: "Update Beta Bot" -on: - push: - branches: [dev] - -jobs: - update-bot: - runs-on: ubuntu-latest - steps: - - name: "Update Beta Bot" - uses: fjogeleit/http-request-action@master - with: - url: https://api-beta.pluralkit.me/v1/update - bearerToken: ${{ secrets.WATCHTOWER_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/dashboard.yml b/.github/workflows/dashboard.yml index 2c5a5c8c..5c06c835 100644 --- a/.github/workflows/dashboard.yml +++ b/.github/workflows/dashboard.yml @@ -24,7 +24,7 @@ jobs: with: # https://github.com/docker/build-push-action/issues/378 context: . - file: Dockerfile.dashboard + file: dashboard/Dockerfile push: true tags: | ghcr.io/pluralkit/dashboard:${{ env.BRANCH_NAME }} diff --git a/.github/workflows/gateway.yml b/.github/workflows/gateway.yml index b3f2be21..1ca6213d 100644 --- a/.github/workflows/gateway.yml +++ b/.github/workflows/gateway.yml @@ -25,7 +25,7 @@ jobs: with: # https://github.com/docker/build-push-action/issues/378 context: . - file: Dockerfile.gateway + file: gateway/Dockerfile push: true tags: | ghcr.io/pluralkit/gateway:${{ env.BRANCH_NAME }} diff --git a/.github/workflows/scheduled_tasks.yml b/.github/workflows/scheduled_tasks.yml index ab7c0373..a5f8e867 100644 --- a/.github/workflows/scheduled_tasks.yml +++ b/.github/workflows/scheduled_tasks.yml @@ -5,7 +5,6 @@ on: branches: [main] paths: - 'scheduled_tasks/**' - - 'Dockerfile.scheduled_tasks' jobs: deploy: @@ -25,7 +24,7 @@ jobs: with: # https://github.com/docker/build-push-action/issues/378 context: . - file: Dockerfile.scheduled_tasks + file: scheduled_tasks/Dockerfile push: true tags: | ghcr.io/pluralkit/scheduled_tasks:${{ env.BRANCH_NAME }} diff --git a/Myriad/Myriad.csproj b/Myriad/Myriad.csproj index 62bbe267..7439b9ee 100644 --- a/Myriad/Myriad.csproj +++ b/Myriad/Myriad.csproj @@ -23,7 +23,7 @@ - + diff --git a/Myriad/packages.lock.json b/Myriad/packages.lock.json index a0c90f89..e606fd58 100644 --- a/Myriad/packages.lock.json +++ b/Myriad/packages.lock.json @@ -24,9 +24,9 @@ }, "Grpc.Tools": { "type": "Direct", - "requested": "[2.37.0, )", - "resolved": "2.37.0", - "contentHash": "cud/urkbw3QoQ8+kNeCy2YI0sHrh7td/1cZkVbH6hDLIXX7zzmJbV/KjYSiqiYtflQf+S5mJPLzDQWScN/QdDg==" + "requested": "[2.47.0, )", + "resolved": "2.47.0", + "contentHash": "nInNoLfT/zR7+0VNIC4Lu5nF8azjTz3KwHB1ckwsYUxvof4uSxIt/LlCKb/NH7GPfXfdvqDDinguPpP5t55nuA==" }, "Polly": { "type": "Direct", diff --git a/PluralKit.API/PluralKit.API.csproj b/PluralKit.API/PluralKit.API.csproj index 3ef156fb..cf916fa7 100644 --- a/PluralKit.API/PluralKit.API.csproj +++ b/PluralKit.API/PluralKit.API.csproj @@ -32,7 +32,7 @@ - + diff --git a/PluralKit.API/packages.lock.json b/PluralKit.API/packages.lock.json index 230cc70b..c88cf343 100644 --- a/PluralKit.API/packages.lock.json +++ b/PluralKit.API/packages.lock.json @@ -53,9 +53,9 @@ }, "Grpc.Tools": { "type": "Direct", - "requested": "[2.37.0, )", - "resolved": "2.37.0", - "contentHash": "cud/urkbw3QoQ8+kNeCy2YI0sHrh7td/1cZkVbH6hDLIXX7zzmJbV/KjYSiqiYtflQf+S5mJPLzDQWScN/QdDg==" + "requested": "[2.47.0, )", + "resolved": "2.47.0", + "contentHash": "nInNoLfT/zR7+0VNIC4Lu5nF8azjTz3KwHB1ckwsYUxvof4uSxIt/LlCKb/NH7GPfXfdvqDDinguPpP5t55nuA==" }, "Microsoft.AspNetCore.Mvc.NewtonsoftJson": { "type": "Direct", diff --git a/PluralKit.Bot/CommandSystem/Context/Context.cs b/PluralKit.Bot/CommandSystem/Context/Context.cs index 3a0fb4be..6398f34f 100644 --- a/PluralKit.Bot/CommandSystem/Context/Context.cs +++ b/PluralKit.Bot/CommandSystem/Context/Context.cs @@ -96,9 +96,9 @@ public class Context // if (embed != null) // { - // Sensitive information that might want to be deleted by :x: reaction is typically in an embed format (member cards, for example) - // but since we can, we just store all sent messages for possible deletion - await _commandMessageService.RegisterMessage(msg.Id, msg.ChannelId, Author.Id); + // Sensitive information that might want to be deleted by :x: reaction is typically in an embed format (member cards, for example) + // but since we can, we just store all sent messages for possible deletion + await _commandMessageService.RegisterMessage(msg.Id, msg.ChannelId, Author.Id); // } return msg; diff --git a/PluralKit.Bot/PluralKit.Bot.csproj b/PluralKit.Bot/PluralKit.Bot.csproj index 4680475f..71bb0f22 100644 --- a/PluralKit.Bot/PluralKit.Bot.csproj +++ b/PluralKit.Bot/PluralKit.Bot.csproj @@ -24,7 +24,7 @@ - + diff --git a/PluralKit.Bot/Proxy/ProxyService.cs b/PluralKit.Bot/Proxy/ProxyService.cs index 10860041..c6fb0dcf 100644 --- a/PluralKit.Bot/Proxy/ProxyService.cs +++ b/PluralKit.Bot/Proxy/ProxyService.cs @@ -228,6 +228,9 @@ public class ProxyService if (!senderPermissions.HasFlag(PermissionSet.SendMessages)) throw new PKError("You don't have permission to send messages in the channel that message is in."); + // Mangle embeds (for reply embed color changing) + var mangledEmbeds = originalMsg.Embeds!.Select(embed => MangleReproxyEmbed(embed, member)).ToArray(); + // Send the reproxied webhook var proxyMessage = await _webhookExecutor.ExecuteWebhook(new ProxyRequest { @@ -239,7 +242,7 @@ public class ProxyService Content = match.ProxyContent!, Attachments = originalMsg.Attachments!, FileSizeLimit = guild.FileSizeLimit(), - Embeds = originalMsg.Embeds!.ToArray(), + Embeds = mangledEmbeds, Stickers = originalMsg.StickerItems!, AllowEveryone = allowEveryone }); @@ -268,6 +271,28 @@ public class ProxyService } } + private Embed MangleReproxyEmbed(Embed embed, ProxyMember member) + { + // XXX: This is a naïve implementation of detecting reply embeds: looking for the same Unicode + // characters as used in the reply embed generation, since we don't _really_ have a good way + // to detect whether an embed is a PluralKit reply embed right now, whether a message is in + // reply to another message isn't currently stored anywhere in the database. + // + // unicodes: [three-per-em space] [left arrow emoji] [force emoji presentation] + if (embed.Author != null && embed.Author!.Name.EndsWith("\u2004\u21a9\ufe0f")) + { + return new Embed + { + Type = "rich", + Author = embed.Author!, + Description = embed.Description!, + Color = member.Color?.ToDiscordColor() + }; + } + + return embed; + } + private Embed CreateReplyEmbed(ProxyMatch match, Message trigger, Message repliedTo, string? nickname, string? avatar) { diff --git a/PluralKit.Bot/Services/WebhookExecutorService.cs b/PluralKit.Bot/Services/WebhookExecutorService.cs index f9ccaf76..e7aec9bd 100644 --- a/PluralKit.Bot/Services/WebhookExecutorService.cs +++ b/PluralKit.Bot/Services/WebhookExecutorService.cs @@ -173,7 +173,7 @@ public class WebhookExecutorService // We don't care about whether the sending succeeds, and we don't want to *wait* for it, so we just fork it off var _ = TrySendRemainingAttachments(webhook, req.Name, req.AvatarUrl, attachmentChunks, req.ThreadId); - + // for some reason discord may(?) return a null guildid here??? return webhookMessage with { GuildId = webhookMessage.GuildId ?? req.GuildId }; } diff --git a/PluralKit.Bot/packages.lock.json b/PluralKit.Bot/packages.lock.json index 33b4bd77..87383ffd 100644 --- a/PluralKit.Bot/packages.lock.json +++ b/PluralKit.Bot/packages.lock.json @@ -24,9 +24,9 @@ }, "Grpc.Tools": { "type": "Direct", - "requested": "[2.37.0, )", - "resolved": "2.37.0", - "contentHash": "cud/urkbw3QoQ8+kNeCy2YI0sHrh7td/1cZkVbH6hDLIXX7zzmJbV/KjYSiqiYtflQf+S5mJPLzDQWScN/QdDg==" + "requested": "[2.47.0, )", + "resolved": "2.47.0", + "contentHash": "nInNoLfT/zR7+0VNIC4Lu5nF8azjTz3KwHB1ckwsYUxvof4uSxIt/LlCKb/NH7GPfXfdvqDDinguPpP5t55nuA==" }, "Humanizer.Core": { "type": "Direct", diff --git a/Dockerfile.dashboard b/dashboard/Dockerfile similarity index 100% rename from Dockerfile.dashboard rename to dashboard/Dockerfile diff --git a/Dockerfile.gateway b/gateway/Dockerfile similarity index 100% rename from Dockerfile.gateway rename to gateway/Dockerfile diff --git a/Dockerfile.scheduled_tasks b/scheduled_tasks/Dockerfile similarity index 100% rename from Dockerfile.scheduled_tasks rename to scheduled_tasks/Dockerfile