Added "@BotMention slm" command
- slm shows the last message you were mentioned in. Useful if you don't want to scroll up just to see where is the message you need to read.
This commit is contained in:
parent
fcb59b15ad
commit
4c0f814f57
@ -307,7 +307,6 @@ namespace NadekoBot.Modules
|
||||
*/
|
||||
});
|
||||
|
||||
|
||||
AliasCommand(CreateCommand(cgb, "save"), "s")
|
||||
.Description("Saves something for the owner in a file.")
|
||||
.Parameter("all", ParameterType.Unparsed)
|
||||
@ -353,7 +352,28 @@ namespace NadekoBot.Modules
|
||||
string str = Encoding.ASCII.GetString(b);
|
||||
await e.User.Send("```" + (str.Length < 1950 ? str : str.Substring(0, 1950)) + "```");
|
||||
});
|
||||
cgb.CreateCommand("slm")
|
||||
.Description("Shows the message where you were last mentioned in this channel (checks last 10k messages)")
|
||||
.Do(async e => {
|
||||
|
||||
Message msg;
|
||||
var msgs = e.Channel.Messages
|
||||
.Where(m => m.MentionedUsers.Contains(e.User))
|
||||
.OrderBy(m => m.Timestamp);
|
||||
if (msgs.Count() > 0)
|
||||
msg = msgs.FirstOrDefault();
|
||||
else {
|
||||
var msgsarr = await client.DownloadMessages(e.Channel, 10000);
|
||||
msg = msgsarr
|
||||
.Where(m => m.MentionedUsers.Contains(e.User))
|
||||
.OrderBy(m => m.Timestamp)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
if (msg != null)
|
||||
await e.Send("Last message mentioning you was at " + msg.Timestamp + "\n**Message:** " + msg.RawText);
|
||||
else
|
||||
await e.Send("I can't find a message mentioning you.");
|
||||
});
|
||||
CreateCommand(cgb, "cs")
|
||||
.Description("Deletes all saves")
|
||||
.Do(async e =>
|
||||
|
Loading…
Reference in New Issue
Block a user