Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command for checking a user's forum stats #8

Closed
Southclaws opened this issue Feb 27, 2017 · 15 comments
Closed

Command for checking a user's forum stats #8

Southclaws opened this issue Feb 27, 2017 · 15 comments
Assignees

Comments

@Southclaws
Copy link
Owner

Requires some xpath/web scraping knowledge:

  • Forum post count
  • Forum reputation
  • Total visitor messages
  • Anything else interesting about a user on the forum that can be retrieved using the user's ID (mine is 50199 for example, you can access my profile page, all posts, all threads, posts-per-day, etc.)
@WopsS
Copy link
Contributor

WopsS commented Feb 28, 2017

What do you say about /userinfo for this command?

We can use some parameters, like general (will include post count, reputation, posts-per-day), visitor_messages, what do you say?

@Southclaws
Copy link
Owner Author

Yep, that sounds perfect!

@Crayder
Copy link

Crayder commented Feb 28, 2017

Discord Name: bleh
Forum Name: bleh
Online: (green, yellow, red)
Forum Join Date:
Discord Join Date:
Last Discord Activity (time and channel): bleh
Last Forum Activity (time and the last "Current Activity"): bleh
Total Posts: bleh
Reputation:
etc 

@Southclaws
Copy link
Owner Author

I don't think we need a Discord username (the user already knows this from typing the command), online status or some of the activity stuff.

I'd actually like to keep this minimal - even though there will be usage limiting to prevent spam, it's not really good practice to have commands post paragraphs of text. I say we post the info in a single paragraph but separate keys from values using formatting:

Forum name: [HLF]Southclaw Member since: 2009 Reputation: 1500 etc: etc...

Regarding the activity/date stuff: For one thing, most of the discord join dates are going to be early 2017, when this server opened. The forum join date is probably the more interesting one to users. Discord activity could be useful if a user disappears for a while, depends if the API exposes this value as I'd rather not introduce more state tracking to the bot. Last forum activity can be scraped but is it really necessary? Use cases?

@Ahmad45123
Copy link

I've added scraping for TotalPosts, LastActive and JoinDate... Reputation is remaining though which I don't know where should I get it from. I need to goto any of user's posts to get it or any other solution ?
https://github.com/JohnyMac/cj/commit/406486116d894e2d59955ff664dbe17c261930b3

@Southclaws
Copy link
Owner Author

It should be visible from the user profile page, in the "mini stats" box if I remember correctly.

@Ahmad45123
Copy link

Ahmad45123 commented Feb 28, 2017

It doesn't.. There is only that green icon that shows rep amount.. rep rep rep

@Southclaws
Copy link
Owner Author

Yeah, that's odd, everything else is exposed via the user page! I suppose you'll need to use http://forum.sa-mp.com/search.php?do=finduser&u=USER_ID, grab the first page and look at the post div and grab the reputation points from there - that's the only way I can think of doing it unless there's another area where reputation is stored.

@Crayder
Copy link

Crayder commented Feb 28, 2017

I don't think we need a Discord username (the user already knows this from typing the command), online status or some of the activity stuff.

  • Discord username: People can have multiple names. Like khanz for example, his real Discord name is aymel (not talking about his forum name). We should show this.
  • Online status: Agreed, not needed.
  • Activity stuff: I think both, forum and discord activity would be useful.

As I suggested to @johnymac, maybe we should separate the discord/forum data.

/info <user>

Name(s): (and aka's, see below)
Join Date: (date joined Discord)
Last Activity: ("time in #channel" or "Online in #channel")

/forum <user>

Name: (current forum name)
Join Date:
Last Activity:  (time and the last "Current Activity" from the forum... ex. [was viewing Bleh Bleh Bleh on data/time])
Posts: 
Reputation:

Also, when you PM people with multiple names you can see their alternative names at the top, is it possible to get these AKA's through the API?

@Ahmad45123
Copy link

Command should be in pm or general channel ?
And also @Crayder there is no a last activity thing, but only current activity...

@Southclaws
Copy link
Owner Author

I say general, but with rate-limiting and a minimal line-footprint (see my earlier post).
We could add a separate command for listing Discord names: /aliases or it could be integrated into this one.

@WopsS
Copy link
Contributor

WopsS commented Feb 28, 2017

An idea for this command is to store reputation in a database field and a MD5 hash for page http://forum.sa-mp.com/search.php?do=finduser&u=ID and every time when a user execute this command the bot should compare the MD5 or the user will wait a little bit for the bot to query 2 pages.

@Ahmad45123
Copy link

That hash will be different everytime the user posts and not when rep changes.
I think just adding a cooldown or something to make it only accept new request after previous is done would be good.

@Southclaws
Copy link
Owner Author

The codebase has a cache available at app.cache, it uses patrickmn/go-cache and supports expiry.

So just store the user profile object or data in a cache keyed by the ID/URL/Username and only do lookups if the cache lookup doesn't hit.

@Crayder
Copy link

Crayder commented Mar 1, 2017

And also @Crayder there is no a last activity thing, but only current activity...

Yes, like I literally said, it's called "Current Activity" on the forum. It's only available when the user is active on the forum. So we will only show that line if the user is online on the forum. And yes, CJ should call it "Last Activity" since it's sent in a message that isn't current after it's sent.

@WopsS WopsS self-assigned this Mar 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants