Reddit.NET
Reddit.NET copied to clipboard
Can you monitor user mentions?
Hi,
Is there a way to monitor user mentions? If someone mentions the bot in a comment, I'd like to be able to see the comment's text as well as the post, and easily reply in the comment thread to the message that mentioned the bot.
Thank you!
That's a good question. It depends on whether or not the mentions would appear in the results for the messages API endpoint. If so, then monitoring for user mentions should be a fairly simple matter. Have you tried running some tests?
I don't know if it shows up in messages but, this is really a key feature missing in the library imo How about:
var r = new RedditClient("MyAppID", "MyRefreshToken");
r.Account.MonitorMentions()
And just add it to the monitoring thread? What do you think? I'd be up for the challenge
Edit: Mentions just arrive as messages with the subject "username mention":
var r = new RedditClient("MyAppID", "MyRefreshToken");
r .Account.Messages.MonitorUnread();
r .Account.Messages.UnreadUpdated += test;
private void test(object sender, MessagesUpdateEventArgs e)
{
foreach (var message in e.Added)
{
if (message.Subject == "username mention")
{
// do something
}
}
}