removed @bot slm, #395

This commit is contained in:
Kwoth 2016-07-14 05:45:45 +02:00
parent 0aca439ddb
commit 06a156d73f

View File

@ -171,38 +171,6 @@ namespace NadekoBot.Modules.Conversations
await e.Channel.SendMessage(str).ConfigureAwait(false); await e.Channel.SendMessage(str).ConfigureAwait(false);
}); });
cgb.CreateCommand("slm")
.Description("Shows the message where you were last mentioned in this channel (checks last 10k messages)")
.Do(async e =>
{
Message msg = null;
var msgs = (await e.Channel.DownloadMessages(100).ConfigureAwait(false))
.Where(m => m.MentionedUsers.Contains(e.User))
.OrderByDescending(m => m.Timestamp);
if (msgs.Any())
msg = msgs.First();
else
{
var attempt = 0;
Message lastMessage = null;
while (msg == null && attempt++ < 5)
{
var msgsarr = await e.Channel.DownloadMessages(100, lastMessage?.Id).ConfigureAwait(false);
msg = msgsarr
.Where(m => m.MentionedUsers.Contains(e.User))
.OrderByDescending(m => m.Timestamp)
.FirstOrDefault();
lastMessage = msgsarr.OrderBy(m => m.Timestamp).First();
}
}
if (msg != null)
await e.Channel.SendMessage($"Last message mentioning you was at {msg.Timestamp}\n**Message from {msg.User.Name}:** {msg.RawText}")
.ConfigureAwait(false);
else
await e.Channel.SendMessage("I can't find a message mentioning you.").ConfigureAwait(false);
});
cgb.CreateCommand("dump") cgb.CreateCommand("dump")
.Description("Dumps all of the invites it can to dump.txt.** Owner Only.**") .Description("Dumps all of the invites it can to dump.txt.** Owner Only.**")
.Do(async e => .Do(async e =>