- .say now uses new SmartText instead of CREmbed

- Added IMessageChannel extensions for sending smarttext
- Added implicit operator from string to smarttext (which just creates smartplaintext instance)
This commit is contained in:
Kwoth
2021-07-11 23:37:19 +02:00
parent 236c286278
commit 0064df8ae4
5 changed files with 87 additions and 21 deletions

View File

@@ -41,36 +41,23 @@ namespace NadekoBot.Modules.Utility
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageMessages)]
[Priority(1)]
public async Task Say(ITextChannel channel, [Leftover] string message)
public async Task Say(ITextChannel channel, [Leftover] SmartText message)
{
if (string.IsNullOrWhiteSpace(message))
return;
var rep = new ReplacementBuilder()
.WithDefault(ctx.User, channel, (SocketGuild)ctx.Guild, (DiscordSocketClient)ctx.Client)
.Build();
if (CREmbed.TryParse(message, out var embedData))
{
rep.Replace(embedData);
await channel.EmbedAsync(embedData, _eb, sanitizeAll: !((IGuildUser)Context.User).GuildPermissions.MentionEveryone).ConfigureAwait(false);
}
else
{
var msg = rep.Replace(message);
if (!string.IsNullOrWhiteSpace(msg))
{
await channel.SendConfirmAsync(_eb, msg).ConfigureAwait(false);
}
}
rep.Replace(message);
await channel.SendAsync(_eb, message, !((IGuildUser)Context.User).GuildPermissions.MentionEveryone);
}
[NadekoCommand, Aliases]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageMessages)]
[Priority(0)]
public Task Say([Leftover] string message) =>
Say((ITextChannel)ctx.Channel, message);
public Task Say([Leftover] string message)
=> Say((ITextChannel)ctx.Channel, message);
[NadekoCommand, Aliases]
[RequireContext(ContextType.Guild)]