mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat: store edit command message ID in redis
This commit is contained in:
parent
4ffaed510a
commit
aa04124639
1 changed files with 5 additions and 1 deletions
|
|
@ -39,11 +39,12 @@ public class ProxiedMessage
|
||||||
private readonly WebhookExecutorService _webhookExecutor;
|
private readonly WebhookExecutorService _webhookExecutor;
|
||||||
private readonly ProxyService _proxy;
|
private readonly ProxyService _proxy;
|
||||||
private readonly LastMessageCacheService _lastMessageCache;
|
private readonly LastMessageCacheService _lastMessageCache;
|
||||||
|
private readonly RedisService _redisService;
|
||||||
|
|
||||||
public ProxiedMessage(EmbedService embeds,
|
public ProxiedMessage(EmbedService embeds,
|
||||||
DiscordApiClient rest, IMetrics metrics, ModelRepository repo, ProxyService proxy,
|
DiscordApiClient rest, IMetrics metrics, ModelRepository repo, ProxyService proxy,
|
||||||
WebhookExecutorService webhookExecutor, LogChannelService logChannel, IDiscordCache cache,
|
WebhookExecutorService webhookExecutor, LogChannelService logChannel, IDiscordCache cache,
|
||||||
LastMessageCacheService lastMessageCache)
|
LastMessageCacheService lastMessageCache, RedisService redisService)
|
||||||
{
|
{
|
||||||
_embeds = embeds;
|
_embeds = embeds;
|
||||||
_rest = rest;
|
_rest = rest;
|
||||||
|
|
@ -54,6 +55,7 @@ public class ProxiedMessage
|
||||||
_metrics = metrics;
|
_metrics = metrics;
|
||||||
_proxy = proxy;
|
_proxy = proxy;
|
||||||
_lastMessageCache = lastMessageCache;
|
_lastMessageCache = lastMessageCache;
|
||||||
|
_redisService = redisService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ReproxyMessage(Context ctx)
|
public async Task ReproxyMessage(Context ctx)
|
||||||
|
|
@ -221,6 +223,8 @@ public class ProxiedMessage
|
||||||
if (ctx.Guild == null)
|
if (ctx.Guild == null)
|
||||||
await _rest.CreateReaction(ctx.Channel.Id, ctx.Message.Id, new Emoji { Name = Emojis.Success });
|
await _rest.CreateReaction(ctx.Channel.Id, ctx.Message.Id, new Emoji { Name = Emojis.Success });
|
||||||
|
|
||||||
|
await _redisService.SetOriginalMid(ctx.Message.Id, editedMsg.Id);
|
||||||
|
|
||||||
if ((await ctx.BotPermissions).HasFlag(PermissionSet.ManageMessages))
|
if ((await ctx.BotPermissions).HasFlag(PermissionSet.ManageMessages))
|
||||||
await _rest.DeleteMessage(ctx.Channel.Id, ctx.Message.Id);
|
await _rest.DeleteMessage(ctx.Channel.Id, ctx.Message.Id);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue