diff --git a/Modules/ModCommands/Commands/BanKick.cs b/Modules/ModCommands/Commands/BanKick.cs index a5a8842..2b41da8 100644 --- a/Modules/ModCommands/Commands/BanKick.cs +++ b/Modules/ModCommands/Commands/BanKick.cs @@ -14,8 +14,8 @@ class Ban : BanKick { // Ban: Unlike kick, the minimum required is just the target ID var result = await Module.Bot.BanAsync(g, msg.Author.ToString(), targetId, PurgeDays, reason, SendNotify); if (result.OperationSuccess && SuccessMessage != null) { - // TODO string replacement, formatting, etc - await msg.Channel.SendMessageAsync($"{SuccessMessage}\n{result.GetResultString(Module.Bot)}"); + var success = ProcessText(SuccessMessage, msg); + await msg.Channel.SendMessageAsync($"{success}\n{result.GetResultString(Module.Bot)}"); } else { await msg.Channel.SendMessageAsync(result.GetResultString(Module.Bot)); } @@ -35,8 +35,8 @@ class Kick : BanKick { var result = await Module.Bot.KickAsync(g, msg.Author.ToString(), targetId, reason, SendNotify); if (result.OperationSuccess && SuccessMessage != null) { - // TODO string replacement, formatting, etc - await msg.Channel.SendMessageAsync($"{SuccessMessage}\n{result.GetResultString(Module.Bot)}"); + var success = ProcessText(SuccessMessage, msg); + await msg.Channel.SendMessageAsync($"{success}\n{result.GetResultString(Module.Bot)}"); } else { await msg.Channel.SendMessageAsync(result.GetResultString(Module.Bot)); } diff --git a/Modules/ModCommands/Commands/CommandConfig.cs b/Modules/ModCommands/Commands/CommandConfig.cs index bda304c..2d4ec87 100644 --- a/Modules/ModCommands/Commands/CommandConfig.cs +++ b/Modules/ModCommands/Commands/CommandConfig.cs @@ -36,4 +36,12 @@ abstract class CommandConfig { }; await target.SendMessageAsync(message ?? "", embed: usageEmbed.Build()); } + + protected static string ProcessText(string input, SocketMessage m) { + // TODO elaborate on this + // For now, replaces all instances of @_ with the message sender. + return input + .Replace("@_", m.Author.Mention) + .Replace("@\\_", "@_"); + } } diff --git a/Modules/ModCommands/Commands/Timeout.cs b/Modules/ModCommands/Commands/Timeout.cs index 7b755ab..3864ae0 100644 --- a/Modules/ModCommands/Commands/Timeout.cs +++ b/Modules/ModCommands/Commands/Timeout.cs @@ -64,8 +64,8 @@ class Timeout : CommandConfig { var result = await Module.Bot.SetTimeoutAsync(g, msg.Author.AsEntityNameString(), targetUser, TimeSpan.FromMinutes(timeParam), reason, SendNotify); if (result.Success && SuccessMessage != null) { - // TODO string replacement, formatting, etc - await msg.Channel.SendMessageAsync($"{SuccessMessage}\n{result.ToResultString()}"); + var success = ProcessText(SuccessMessage, msg); + await msg.Channel.SendMessageAsync($"{success}\n{result.ToResultString()}"); } else { await msg.Channel.SendMessageAsync(result.ToResultString()); }