Modbot to Help You Run Games: Now With A Votecounter Demo!

This forum is for discussion related to the game.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #12 (isolation #0) » Tue May 01, 2018 2:27 am

Post by Flubbernugget »

This is all python right? I could whip up a gui for whatever json syntax you specify with tkinter or something similar.

If it's a web gui I have less experience but would still be more than willing to give it a shot.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #25 (isolation #1) » Wed May 02, 2018 4:10 pm

Post by Flubbernugget »

Forgive me if this is already in the tutorial because the json doesn't render well on my phone.

Can mods make sandbox forum threads to figure out how to use Modbot?
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #26 (isolation #2) » Wed May 02, 2018 4:35 pm

Post by Flubbernugget »

In post 24, GreenLiquid wrote:This is already looking pretty cool!
I don't have any knowledge about how to automate operations to the forum, such as posting and whatnot, but the bit I've been working on is intended to be able to store a "game state" which can be modified by passing events to it, like "Player A votes for Player B" and stuff like that. I also have a thing for automatically generating vote counts, the player list, the list of events in the first/second post, and the alive/dead/modkilled lists. I'm in the middle of rewriting stuff so it's not really in a suitable state to use at the moment but I would be happy to share what I have when I'm done in like a week or so. You might be able to scavenge some useful code out of it for the project.
Psyche did a really good job at abastracting away the automation of posting to/reading from the thread.

You should just need to use something like:

Code: Select all

mydonbot = Modbot.Donbot("some username", "some password", "thread url")

print(mydonbot.getPosts()) 

mydonbot.makePost("hello world!") 


Just be careful when you're running the makePost that you're in the thread you really want to be in.

I would also try to print() any strings you pass to makePost() before actually using the latter method. Especially if you want to put it in a loop.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #30 (isolation #3) » Thu May 03, 2018 7:48 am

Post by Flubbernugget »

There's a throttling constant in the code, so anyone that would try to flood the site would have to have some coding background, at which point it would be easy enough for them to do so with their own code anyway.

I also don't think there's http calls in the code that aren't linked to a username and password, making Modbot based DDOS extremely transparent on the attacker's end.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #31 (isolation #4) » Thu May 03, 2018 7:49 am

Post by Flubbernugget »

I've looked at the code and hope to actually be able to read the tutorials and run it by tonight
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #34 (isolation #5) » Thu May 03, 2018 2:35 pm

Post by Flubbernugget »

Similar to lxml, I don't think requests comes with python by default, and may need a pip install command as well.

Is this expected to be compatible with both python 2 and 3?
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #35 (isolation #6) » Thu May 03, 2018 2:54 pm

Post by Flubbernugget »

In post 1, Psyche wrote:
On RadarAuto-prodder
Taking claim to this.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #36 (isolation #7) » Thu May 03, 2018 3:08 pm

Post by Flubbernugget »

Okay. I think the best way to implement an auto-prodder is to parse the activity overview page.

My initial thoughts to accomplish this would be to add a 'getActivity' method to the Donbot class, which would return each player's username, and the time since their last post.

An external utility (Prodbot???) would then check the results of getActivity, and use Donbot's sendPM method to prod all the slackers.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #38 (isolation #8) » Thu May 03, 2018 5:47 pm

Post by Flubbernugget »

First attempt at adding the activity parser to donbot was a partial success. I had everything worked out until I realized the V/LA column was being parsed as a column of null strings.

I tried following the nature of how donbot works, which involved XPath, something I had never heard of until I saw this code. My XPath pattern was long and ugly; I need to find the balance between a simple pattern match and a clean algorithm to format the data it gives me.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #50 (isolation #9) » Sun May 06, 2018 7:48 am

Post by Flubbernugget »

Sounds like you want a electron app
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #52 (isolation #10) » Sun May 06, 2018 8:13 am

Post by Flubbernugget »

Node.js would probabaly have to replace the entirety of the Modbot code with js or suffer unnecessary complexity. Flask would probabaly handle this better since it's for python.

On second thought, electron may have the same issue as node.js, but I honestly don't know enough about it to say for sure.

Prodbot will probabaly have to wait till next week. I had an issue with my license plates being stolen this weekend.
Last edited by Flubbernugget on Sun May 06, 2018 8:22 am, edited 2 times in total.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #53 (isolation #11) » Sun May 06, 2018 8:17 am

Post by Flubbernugget »

If you're interested in a js/css interface, you may also be able to accomplish this with an index.html file that runs js with Ajax, but that again removes python entirely.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #55 (isolation #12) » Sun May 06, 2018 8:31 am

Post by Flubbernugget »

If the python has to expose xhr requests (which is ultimately just http), it would be just as capable of hosting a gui front end?

Psyche, what is your motivation for wanting the gui to be web oriented? I get that you don't want to reinvent the wheel, but there's a lot of batteries included python options in this regard (kivy comes to mind).
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #58 (isolation #13) » Sun May 06, 2018 9:10 am

Post by Flubbernugget »

My line of thinking is that getting separate programming languages to play nice with each other is consistently a pain in the ass.

Yesirree has a point though that platform compatability is a bigger pain in the ass
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #69 (isolation #14) » Thu May 10, 2018 10:52 am

Post by Flubbernugget »

Looked through the PR's. Cool stuff!

What's the difference between gevent and asyncio? I know what a coroutine is, but don't have much experience with either library.

Also, any naming conventions in mind? I'm used to class names being nouns.

Prodpot PR up sometime before tonight!! Just got the code done. Tested it (only for one post with a prod deadline of zero days). Need to figure out the jupyter doc thing, and actually write docs next.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #71 (isolation #15) » Thu May 10, 2018 12:43 pm

Post by Flubbernugget »

I'm going to have to look into it tomorrow. Will send a PR with no docs, as the code is short and should be easy to read and understand.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #72 (isolation #16) » Thu May 10, 2018 12:55 pm

Post by Flubbernugget »

Do I need to be whitelisted/authorized to submit pull requests?
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #74 (isolation #17) » Thu May 10, 2018 1:15 pm

Post by Flubbernugget »

Seems as though I had to fork from the github gui. I tried using a vanilla git clone for a "fork"
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #76 (isolation #18) » Thu May 10, 2018 1:31 pm

Post by Flubbernugget »

I'm having a host of problems that seem to be related to how I configured git for a hackathon. I have to address this at a later time, and will integrate yessiree's work before a PR.

Sorry for the delay :/
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #98 (isolation #19) » Sat May 12, 2018 4:51 pm

Post by Flubbernugget »

I had to set my PYTHONPATH to the directory with donbot.py to get imports to work.

Is this intended behavior?
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #100 (isolation #20) » Sat May 12, 2018 6:01 pm

Post by Flubbernugget »

Is there more to that than donbot.getPosts()? I'm trying to sendPM's to a (python) list of people and only the first person in the list seems to be getting it.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #116 (isolation #21) » Tue May 15, 2018 1:05 pm

Post by Flubbernugget »

I think i got the PM aspect of the prodbot working. The next step is to generate a sendto list based on how long a player can go without posting before being prod-worthy.

I have a few items of note though.

I had to change this snippet in donbot:

Code: Select all

216         for user in uids:
217             form['address_list[u][{}]'.format(user.value)] = 'to'
218 
219         for name in ['lastclick', 'creation_time', 'form_token']:
220             form[name] = compose.xpath(postformpath.format(name))[0]

as such:

Code: Select all

---------------------------------------------------------------------------------------------
FROM:
216         for user in uids:
217             form['address_list[u][{}]'.format(user.value)] = 'to']
---------------------------------------------------------------------------------------------
TO:
216         for user in uids:
217             form['address_list[u][{}]'.format(user)] = 'to']
---------------------------------------------------------------------------------------------


My conclusion now is that I am getting the uids as strings, whereas someone else seemed to be getting them as some sort of more complex object. I want to hold off on a PR until I can figure out if/how this would break everyone else's stuff (there will be a push to my fork soon though!!).

Also, the prodbot seems to crap out at around 13-15 players in a single prod with a postdelay of 5 (RIP fortune cookie thread). The errors I have gotten with larger prod sets seem to be either lxml parser errors or http connection refusals. This leads me to believe I'm hitting some limit on the MS server. I'm not 100% sure if it's worth digging into this issue any further than I have, since 13+ prods seems like a lot.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #118 (isolation #22) » Tue May 15, 2018 1:47 pm

Post by Flubbernugget »

So, I did a semi-through test of this. I did start sending PM's to a list of 15 people with a post delay of 10. This mostly gave lxml errors. Putting sleeps in sendPM did not mitigate this issue. I got to the point where I just started slicing the sendto variable from [:1] onward, changing postdelay to 5 to speed up testing.

There is definitely something bizarre going on, as there's not enough information in my course of actions to really figure out what's choking up the server. And hell, its code, so there's a good chance I'm wrong in declaring that as the problem anyway :P

If it's really worth digging into this, I could probably set up a test matrix across a couple of variables (postdelay, number of players, etc...). I don't know what conclusions we'd be able to make from that information, but the results would be comprehensive. The only thing that bothers me about this is spamming users with PM's.

Alternatively, I could try to contact Kison to see if there's any bottlenecks I'm hitting. This might also have the advantage of quickly determining whether or not my looking at server limits is confbias on my end.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #121 (isolation #23) » Tue May 15, 2018 2:12 pm

Post by Flubbernugget »

I got side tracked. Prod limit->sendto list, then a push! I promise this time
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #122 (isolation #24) » Tue May 15, 2018 2:14 pm

Post by Flubbernugget »

In post 120, GreenLiquid wrote:Does the result change if you push 13 PMs while the application is running, kill the application, then immediately restart it and send 1 additional PM?
I should only be sending 1 PM to 13 people.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #124 (isolation #25) » Tue May 15, 2018 2:17 pm

Post by Flubbernugget »

I'm pretty sure there's a place in hell where you're forced to use vim with no way to tell whether or not caps lock is on
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #125 (isolation #26) » Tue May 15, 2018 2:19 pm

Post by Flubbernugget »

The push is going to come in with my one line change to donbot.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #126 (isolation #27) » Tue May 15, 2018 2:20 pm

Post by Flubbernugget »

also maybe dos2unix format issues
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #127 (isolation #28) » Tue May 15, 2018 2:24 pm

Post by Flubbernugget »

Push is on my fork under the branch "prodbot"
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #128 (isolation #29) » Tue May 15, 2018 2:30 pm

Post by Flubbernugget »

In post 123, GreenLiquid wrote:Right, sorry, I meant... is it possible to get it out of its state of not sending PMs by exiting and re-launching the application? Just to see if it's something within that session or not. Might help narrow down the cause.
I don't have much more time tonight to continue working on this, but I am willing to give this a shot at a later date.

So something like this?

Code: Select all

-> Send pm to 13 users. Fail!

-> Send pm to 13 users. Press CTRL+C. Program terminates.

-> Send pm to 13 users. Pass!
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #133 (isolation #30) » Wed May 16, 2018 4:52 am

Post by Flubbernugget »

Fuckin Javascript lol

On a side note, would anyone be opposed to me importing a bootstrap template for the personal Modbot ui?
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #135 (isolation #31) » Wed May 16, 2018 4:58 am

Post by Flubbernugget »

It's a set of CSS templates to make a website look pretty in a short period of time. I think it's written by Twitter people
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #160 (isolation #32) » Mon May 21, 2018 2:17 pm

Post by Flubbernugget »

In post 153, yessiree wrote:it occurred to me that we could just write batch scripts that run the python files, then WindowsTM users can download the source code with the .bat files, and simply run the batch scripts

this is much much simpler than the whole web app thing with flask

it's worth serious consideration
This is a good idea. One of my big concerns with the web gui interface was that it never seemed like it would make for good UX no matter how good the UI could be done. In the scheme of trying to attract more users to what is now a bit of a "clunky" site that was a bit of an issue. Now instead of trying to spin up a server it's literally just clicking an icon.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #161 (isolation #33) » Mon May 21, 2018 2:27 pm

Post by Flubbernugget »

In post 119, Psyche wrote:push the code if you want; i have some ideas for figuring out what's wrong
Was there a resolution on this? I don't see anything on the activity overview as a github issue, but it was a bit of an upper bound anyway.
Post Reply

Return to “Mafia Discussion”