fix: repeat, greet, bye, boost messages can now once again mention anyone

fix: .say #channel fixed
This commit is contained in:
Kwoth
2024-05-11 07:59:37 +00:00
parent d766295286
commit 0da8190637
5 changed files with 15 additions and 9 deletions

View File

@@ -2,11 +2,13 @@
Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
## [5.0.5] - ## [5.0.5] - 11.05.2024
### Fixed ### Fixed
- `%server.members%` placeholder fixed - `%server.members%` placeholder fixed
- `.say #channel <message>` should now be working properly again
- `.repeat`, `.greet`, `.bye` and `.boost` command can now once again mention anyone
## [5.0.4] - 10.05.2024 ## [5.0.4] - 10.05.2024

View File

@@ -97,7 +97,7 @@ public class GreetService : INService, IReadyExecutor
{ {
var newContent = await _repSvc.ReplaceAsync(toSend, var newContent = await _repSvc.ReplaceAsync(toSend,
new(client: _client, guild: user.Guild, channel: channel, users: user)); new(client: _client, guild: user.Guild, channel: channel, users: user));
var toDelete = await _sender.Response(channel).Text(newContent).SendAsync(); var toDelete = await _sender.Response(channel).Text(newContent).Sanitize(false).SendAsync();
if (conf.BoostMessageDeleteAfter > 0) if (conf.BoostMessageDeleteAfter > 0)
toDelete.DeleteAfter(conf.BoostMessageDeleteAfter); toDelete.DeleteAfter(conf.BoostMessageDeleteAfter);
@@ -217,7 +217,7 @@ public class GreetService : INService, IReadyExecutor
text = await _repSvc.ReplaceAsync(text, repCtx); text = await _repSvc.ReplaceAsync(text, repCtx);
try try
{ {
var toDelete = await _sender.Response(channel).Text(text).SendAsync(); var toDelete = await _sender.Response(channel).Text(text).Sanitize(false).SendAsync();
if (conf.AutoDeleteByeMessagesTimer > 0) if (conf.AutoDeleteByeMessagesTimer > 0)
toDelete.DeleteAfter(conf.AutoDeleteByeMessagesTimer); toDelete.DeleteAfter(conf.AutoDeleteByeMessagesTimer);
} }
@@ -258,7 +258,7 @@ public class GreetService : INService, IReadyExecutor
text = await _repSvc.ReplaceAsync(text, repCtx); text = await _repSvc.ReplaceAsync(text, repCtx);
try try
{ {
var toDelete = await _sender.Response(channel).Text(text).SendAsync(); var toDelete = await _sender.Response(channel).Text(text).Sanitize(false).SendAsync();
if (conf.AutoDeleteGreetMessagesTimer > 0) if (conf.AutoDeleteGreetMessagesTimer > 0)
toDelete.DeleteAfter(conf.AutoDeleteGreetMessagesTimer); toDelete.DeleteAfter(conf.AutoDeleteGreetMessagesTimer);
} }
@@ -360,7 +360,7 @@ public class GreetService : INService, IReadyExecutor
} }
} }
await _sender.Response(user).Text(smartText).SendAsync(); await _sender.Response(user).Text(smartText).Sanitize(false).SendAsync();
} }
catch catch
{ {
@@ -573,8 +573,6 @@ public class GreetService : INService, IReadyExecutor
public bool SetBoostMessage(ulong guildId, ref string message) public bool SetBoostMessage(ulong guildId, ref string message)
{ {
message = message.SanitizeMentions();
using var uow = _db.GetDbContext(); using var uow = _db.GetDbContext();
var conf = uow.GuildConfigsForId(guildId, set => set); var conf = uow.GuildConfigsForId(guildId, set => set);
conf.BoostMessage = message; conf.BoostMessage = message;

View File

@@ -269,7 +269,11 @@ public sealed class RepeaterService : IReadyExecutor, INService
var text = SmartText.CreateFrom(repeater.Message); var text = SmartText.CreateFrom(repeater.Message);
text = await _repSvc.ReplaceAsync(text, repCtx); text = await _repSvc.ReplaceAsync(text, repCtx);
var newMsg = await _sender.Response(channel).Text(text).SendAsync(); var newMsg = await _sender.Response(channel)
.Text(text)
.Sanitize(false)
.SendAsync();
_ = newMsg.AddReactionAsync(new Emoji("🔄")); _ = newMsg.AddReactionAsync(new Emoji("🔄"));
if (_noRedundant.Contains(repeater.Id)) if (_noRedundant.Contains(repeater.Id))

View File

@@ -85,6 +85,7 @@ public partial class Utility : NadekoModule
await Response() await Response()
.Text(message) .Text(message)
.Channel(channel)
.UserBasedMentions() .UserBasedMentions()
.SendAsync(); .SendAsync();
} }

View File

@@ -360,6 +360,7 @@ public sealed partial class ResponseBuilder
public PaginatedResponseBuilder Paginated() public PaginatedResponseBuilder Paginated()
=> new(this); => new(this);
} }
public class PaginatedResponseBuilder public class PaginatedResponseBuilder