Reddit.NET icon indicating copy to clipboard operation
Reddit.NET copied to clipboard

Can you monitor user mentions?

Open TemporalAgent7 opened this issue 5 years ago • 2 comments

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!

TemporalAgent7 avatar May 25 '19 00:05 TemporalAgent7

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?

sirkris avatar Jun 02 '19 08:06 sirkris

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
        }
    }
} 

Marcel0024 avatar Feb 05 '20 19:02 Marcel0024