mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-03 16:24:27 -05:00 
			
		
		
		
	- .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:
		@@ -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)]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user