Fixes. Improved .savechat
This commit is contained in:
parent
3bad28aa18
commit
94f1657a03
@ -219,7 +219,7 @@ namespace NadekoBot.Modules.Administration
|
||||
return;
|
||||
}
|
||||
var roleName = args[0].ToUpperInvariant();
|
||||
var role = channel.Guild.Roles.Where(r=>r.Name.ToUpperInvariant() == roleName).FirstOrDefault();
|
||||
var role = channel.Guild.Roles.Where(r => r.Name.ToUpperInvariant() == roleName).FirstOrDefault();
|
||||
|
||||
if (role == null)
|
||||
{
|
||||
@ -254,7 +254,7 @@ namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
msg = "❗️No reason provided.";
|
||||
}
|
||||
if (umsg.Author.Id != user.Guild.OwnerId && user.Roles.Select(r=>r.Position).Max() >= ((IGuildUser)umsg.Author).Roles.Select(r => r.Position).Max())
|
||||
if (umsg.Author.Id != user.Guild.OwnerId && user.Roles.Select(r => r.Position).Max() >= ((IGuildUser)umsg.Author).Roles.Select(r => r.Position).Max())
|
||||
{
|
||||
await channel.SendErrorAsync("⚠️ You can't use this command on users with a role higher or equal to yours in the role hierarchy.");
|
||||
return;
|
||||
@ -367,7 +367,7 @@ namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
foreach (var u in users)
|
||||
{
|
||||
await u.ModifyAsync(usr=>usr.Deaf = true).ConfigureAwait(false);
|
||||
await u.ModifyAsync(usr => usr.Deaf = true).ConfigureAwait(false);
|
||||
}
|
||||
await channel.SendConfirmAsync("🔇 **Deafen** successful.").ConfigureAwait(false);
|
||||
}
|
||||
@ -390,7 +390,7 @@ namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
foreach (var u in users)
|
||||
{
|
||||
await u.ModifyAsync(usr=> usr.Deaf = false).ConfigureAwait(false);
|
||||
await u.ModifyAsync(usr => usr.Deaf = false).ConfigureAwait(false);
|
||||
}
|
||||
await channel.SendConfirmAsync("🔊 **Undeafen** successful.").ConfigureAwait(false);
|
||||
}
|
||||
@ -650,8 +650,10 @@ namespace NadekoBot.Modules.Administration
|
||||
cnt -= 100;
|
||||
}
|
||||
var title = $"Chatlog-{channel.Guild.Name}/#{channel.Name}-{DateTime.Now}.txt";
|
||||
var grouping = msgs.GroupBy(x => $"{x.CreatedAt.Date:dd.MM.yyyy}")
|
||||
.Select(g => new { date = g.Key, messages = g.Select(s => $"【{s.Timestamp:HH:mm:ss}】{s.Author}:" + s.ToString()) });
|
||||
await (umsg.Author as IGuildUser).SendFileAsync(
|
||||
await JsonConvert.SerializeObject(new { Messages = msgs.Select(s => $"【{s.Timestamp:HH:mm:ss}】{s.Author}:" + s.ToString()) }, Formatting.Indented).ToStream().ConfigureAwait(false),
|
||||
await JsonConvert.SerializeObject(grouping, Formatting.Indented).ToStream().ConfigureAwait(false),
|
||||
title, title).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@ -667,7 +669,7 @@ namespace NadekoBot.Modules.Administration
|
||||
foreach (var role in roles)
|
||||
{
|
||||
send += $"\n**{role.Name}**\n";
|
||||
send += string.Join(", ", (await channel.Guild.GetUsersAsync()).Where(u => u.Roles.Contains(role)).Distinct().Select(u=>u.Mention));
|
||||
send += string.Join(", ", (await channel.Guild.GetUsersAsync()).Where(u => u.Roles.Contains(role)).Distinct().Select(u => u.Mention));
|
||||
}
|
||||
|
||||
while (send.Length > 2000)
|
||||
|
@ -834,6 +834,8 @@ namespace NadekoBot.Modules.Searches
|
||||
website = $"https://yande.re/post.xml?limit=100&tags={tag}";
|
||||
break;
|
||||
}
|
||||
try
|
||||
{
|
||||
using (var http = new HttpClient())
|
||||
{
|
||||
http.AddFakeHeaders();
|
||||
@ -849,6 +851,11 @@ namespace NadekoBot.Modules.Searches
|
||||
return url;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static async Task<bool> ValidateQuery(ITextChannel ch, string query)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(query.Trim())) return true;
|
||||
|
Loading…
Reference in New Issue
Block a user