feat: make pk;reproxy handle keepproxy correctly
				
					
				
			This commit is contained in:
		| @@ -70,7 +70,7 @@ public class ProxiedMessage | |||||||
|  |  | ||||||
|         try |         try | ||||||
|         { |         { | ||||||
|             await _proxy.ExecuteReproxy(ctx.Message, msg.Message, match); |             await _proxy.ExecuteReproxy(ctx.Message, msg.Message, members, match); | ||||||
|  |  | ||||||
|             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 }); | ||||||
|   | |||||||
| @@ -188,7 +188,7 @@ public class ProxyService | |||||||
|         await HandleProxyExecutedActions(ctx, autoproxySettings, trigger, proxyMessage, match); |         await HandleProxyExecutedActions(ctx, autoproxySettings, trigger, proxyMessage, match); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public async Task ExecuteReproxy(Message trigger, PKMessage msg, ProxyMember member) |     public async Task ExecuteReproxy(Message trigger, PKMessage msg, List<ProxyMember> members, ProxyMember member) | ||||||
|     { |     { | ||||||
|         var originalMsg = await _rest.GetMessageOrNull(msg.Channel, msg.Mid); |         var originalMsg = await _rest.GetMessageOrNull(msg.Channel, msg.Mid); | ||||||
|         if (originalMsg == null) |         if (originalMsg == null) | ||||||
| @@ -203,9 +203,15 @@ public class ProxyService | |||||||
|             throw new ProxyChecksFailedException( |             throw new ProxyChecksFailedException( | ||||||
|                 "Proxying was disabled in this channel by a server administrator (via the proxy blacklist)."); |                 "Proxying was disabled in this channel by a server administrator (via the proxy blacklist)."); | ||||||
|  |  | ||||||
|  |         var autoproxySettings = await _repo.GetAutoproxySettings(ctx.SystemId.Value, msg.Guild!.Value, null); | ||||||
|  |         var prevMatched = _matcher.TryMatch(ctx, autoproxySettings, members, out var prevMatch, originalMsg.Content, | ||||||
|  |                                             originalMsg.Attachments.Length > 0, false); | ||||||
|  |  | ||||||
|         var match = new ProxyMatch |         var match = new ProxyMatch | ||||||
|         { |         { | ||||||
|             Member = member, |             Member = member, | ||||||
|  |             Content = prevMatched ? prevMatch.Content : originalMsg.Content, | ||||||
|  |             ProxyTags = member.ProxyTags.First(), | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|         var messageChannel = await _rest.GetChannelOrNull(msg.Channel!); |         var messageChannel = await _rest.GetChannelOrNull(msg.Channel!); | ||||||
| @@ -229,7 +235,7 @@ public class ProxyService | |||||||
|             ThreadId = threadId, |             ThreadId = threadId, | ||||||
|             Name = match.Member.ProxyName(ctx), |             Name = match.Member.ProxyName(ctx), | ||||||
|             AvatarUrl = AvatarUtils.TryRewriteCdnUrl(match.Member.ProxyAvatar(ctx)), |             AvatarUrl = AvatarUtils.TryRewriteCdnUrl(match.Member.ProxyAvatar(ctx)), | ||||||
|             Content = originalMsg.Content!, |             Content = match.ProxyContent!, | ||||||
|             Attachments = originalMsg.Attachments!, |             Attachments = originalMsg.Attachments!, | ||||||
|             FileSizeLimit = guild.FileSizeLimit(), |             FileSizeLimit = guild.FileSizeLimit(), | ||||||
|             Embeds = originalMsg.Embeds!.ToArray(), |             Embeds = originalMsg.Embeds!.ToArray(), | ||||||
| @@ -237,7 +243,7 @@ public class ProxyService | |||||||
|             AllowEveryone = allowEveryone |             AllowEveryone = allowEveryone | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|         var autoproxySettings = await _repo.GetAutoproxySettings(ctx.SystemId.Value, msg.Guild!.Value, null); |          | ||||||
|         await HandleProxyExecutedActions(ctx, autoproxySettings, trigger, proxyMessage, match, deletePrevious: false); |         await HandleProxyExecutedActions(ctx, autoproxySettings, trigger, proxyMessage, match, deletePrevious: false); | ||||||
|         await _rest.DeleteMessage(originalMsg.ChannelId!, originalMsg.Id!); |         await _rest.DeleteMessage(originalMsg.ChannelId!, originalMsg.Id!); | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user