embed and image support for .savechat
This commit is contained in:
		@@ -113,7 +113,7 @@ namespace NadekoBot.Modules.Administration
 | 
			
		||||
            public static async Task UnmuteUser(IGuildUser usr)
 | 
			
		||||
            {
 | 
			
		||||
                StopUnmuteTimer(usr.GuildId, usr.Id);
 | 
			
		||||
                await usr.ModifyAsync(x => x.Mute = false).ConfigureAwait(false);
 | 
			
		||||
                try { await usr.ModifyAsync(x => x.Mute = false).ConfigureAwait(false); } catch { }
 | 
			
		||||
                try { await usr.RemoveRolesAsync(await GetMuteRole(usr.Guild)).ConfigureAwait(false); } catch { /*ignore*/ }
 | 
			
		||||
                using (var uow = DbHandler.UnitOfWork())
 | 
			
		||||
                {
 | 
			
		||||
 
 | 
			
		||||
@@ -466,7 +466,31 @@ namespace NadekoBot.Modules.Utility
 | 
			
		||||
 | 
			
		||||
            var title = $"Chatlog-{Context.Guild.Name}/#{Context.Channel.Name}-{DateTime.Now}.txt";
 | 
			
		||||
            var grouping = msgs.GroupBy(x => $"{x.CreatedAt.Date:dd.MM.yyyy}")
 | 
			
		||||
                .Select(g => new { date = g.Key, messages = g.OrderBy(x => x.CreatedAt).Select(s => $"【{s.Timestamp:HH:mm:ss}】{s.Author}:" + s.ToString()) });
 | 
			
		||||
                .Select(g => new
 | 
			
		||||
                {
 | 
			
		||||
                    date = g.Key,
 | 
			
		||||
                    messages = g.OrderBy(x => x.CreatedAt).Select(s =>
 | 
			
		||||
                    {
 | 
			
		||||
                        var msg = $"【{s.Timestamp:HH:mm:ss}】{s.Author}:";
 | 
			
		||||
                        if (string.IsNullOrWhiteSpace(s.ToString()))
 | 
			
		||||
                        {
 | 
			
		||||
                            if (s.Attachments.Any())
 | 
			
		||||
                            {
 | 
			
		||||
                                msg += "FILES_UPLOADED: " + string.Join("\n", s.Attachments.Select(x => x.Url));
 | 
			
		||||
                            }
 | 
			
		||||
                            else if (s.Embeds.Any())
 | 
			
		||||
                            {
 | 
			
		||||
                                //todo probably just go through all properties and check if they are set, if they are, add them
 | 
			
		||||
                                msg += "EMBEDS: " + string.Join("\n--------\n", s.Embeds.Select(x => $"Description: {x.Description}"));
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            msg += s.ToString();
 | 
			
		||||
                        }
 | 
			
		||||
                        return msg;
 | 
			
		||||
                    })
 | 
			
		||||
                });
 | 
			
		||||
            await Context.User.SendFileAsync(
 | 
			
		||||
                await JsonConvert.SerializeObject(grouping, Formatting.Indented).ToStream().ConfigureAwait(false), title, title).ConfigureAwait(false);
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user