SweetieBot FAQ, Usage, Discussion, Requests

14748505253237

Comments

  • Asterelle - Sanctuary_1381265973
    Asterelle - Sanctuary_1381265973 Posts: 7,881 Arc User
    edited March 2013
    yeah basically what kossy said, if of the most recent 150 posts analyzed, 80 of them were in "SweetieBot FAQ, Usage, Discussion, Requests", then list that as #1 recent favorite thread. Right now SB tells us how we post (average # of words, syllables etc), what we post (common words/phrases), when we post (day of the week, time of day etc), and I thought it'd be neat to see where we post (within the forum).

    edit: also just out of curiosity, did you create SB from scratch or did you modify/add to something that is already out there? Also what language is she written in? :)

    Ahh ok. Subforum restriction then would cover that.

    SweetieBot is around 1000 lines of python. You can see most of the code here: http://ideone.com/rzvIC6

    I use functionality from existing libraries if I could find them.

    Mechanize - handles form posts / submits pretty easily
    Cookielib - manages login cookie
    BeautifulSoup + htmllib5 - HTML parsing
    Cleverbot - forwards chat comments to cleverbot.com
    ConfigObj - saving and loading of configuration / data
    Google Search Api - finds images
    Google Chart Api - makes charts
    readability - Counts sentences / words / syllabels though I had to make some modifications for my uses. It actually gives a lot of readability metrics that I gave up on because they are silly.

    Logging in was a big challenge before I used mechanize. I tried a few other libraries but I kept getting a 502 response from the server no matter what I was doing. I was mucking around in the HTTP headers for a while comparing what my script was doing to a normal web browser but didn't see much of a difference. Mechanize magically worked though.

    There's a little PHP on a webserver somewhere I wrote to proxy my get requests from the server because the server software kept preventing sweetiebots IP address from logging in if she makes too many get requests (even though the requests are for data you don't even need to be logged in for). Their logic is dumb since you can make as many get requests as you want as long as you do it from an IP you don't want to post from. Working around that was a major stumbling block early in development.

    The core logic is otherwise pretty basic really. Just do a search from the search page for posts containing the word "SweetieBot". Then open those posts up and extract the text from the post. Then search the text to see if theres a line that starts with 'Sweetiebot'. Depending on what that line is I go out and do something then reply to the post with the result. After that she waits for a while and repeat. I have to keep track of the last post I've replied to so that the next loop I only reply to newer posts than that.

    The basic core stuff is probably just a few dozen lines. The rest is all just extracting data, analyzing data, formatting replies, etc.
    [SIGPIC][/SIGPIC]
    Refining Simulator - aster.ohmydays.net/pw/refiningsimulator.html (don't use IE)
    Genie Calculator - aster.ohmydays.net/pw/geniecalculator.html - (don't use IE)
    Socket Calculator - aster.ohmydays.net/pw/socketcalculator.html
  • SweetieBot - Lothranis
    SweetieBot - Lothranis Posts: 18,978 Arc User
    edited March 2013
    SweetieBot is around 1000 lines of python. You can see most of the code here:
    And what do you do the rest of the time?
    [SIGPIC][/SIGPIC]
    I only respond if you begin a line with "SweetieBot", read the link below for commands
    SweetieBot FAQ / Usage: pwi-forum.perfectworld.com/showthread.php?t=1566451

    Status: ONLINE
  • opkossy
    opkossy Posts: 11,177 Community Moderator
    edited March 2013
    And what do you do the rest of the time?

    He dances, of course.

    Sweetiebot explain your comments on yourself.
    (Insert fancy image here)
    image
  • SweetieBot - Lothranis
    SweetieBot - Lothranis Posts: 18,978 Arc User
    edited March 2013
    OPKossy wrote: »
    Sweetiebot explain your comments on yourself.
    Tell me what you think it is.
    [SIGPIC][/SIGPIC]
    I only respond if you begin a line with "SweetieBot", read the link below for commands
    SweetieBot FAQ / Usage: pwi-forum.perfectworld.com/showthread.php?t=1566451

    Status: ONLINE
  • Adroit - Lost City
    Adroit - Lost City Posts: 4,628 Arc User
    edited March 2013
    Ahh ok. Subforum restriction then would cover that.

    SweetieBot is around 1000 lines of python. You can see most of the code here: http://ideone.com/rzvIC6

    I use functionality from existing libraries if I could find them.

    Mechanize - handles form posts / submits pretty easily
    Cookielib - manages login cookie
    BeautifulSoup + htmllib5 - HTML parsing
    Cleverbot - forwards chat comments to cleverbot.com
    ConfigObj - saving and loading of configuration / data
    Google Search Api - finds images
    Google Chart Api - makes charts
    readability - Counts sentences / words / syllabels though I had to make some modifications for my uses. It actually gives a lot of readability metrics that I gave up on because they are silly.

    Logging in was a big challenge before I used mechanize. I tried a few other libraries but I kept getting a 502 response from the server no matter what I was doing. I was mucking around in the HTTP headers for a while comparing what my script was doing to a normal web browser but didn't see much of a difference. Mechanize magically worked though.

    There's a little PHP on a webserver somewhere I wrote to proxy my get requests from the server because the server software kept preventing sweetiebots IP address from logging in if she makes too many get requests (even though the requests are for data you don't even need to be logged in for). Their logic is dumb since you can make as many get requests as you want as long as you do it from an IP you don't want to post from. Working around that was a major stumbling block early in development.

    The core logic is otherwise pretty basic really. Just do a search from the search page for posts containing the word "SweetieBot". Then open those posts up and extract the text from the post. Then search the text to see if theres a line that starts with 'Sweetiebot'. Depending on what that line is I go out and do something then reply to the post with the result. After that she waits for a while and repeat. I have to keep track of the last post I've replied to so that the next loop I only reply to newer posts than that.

    The basic core stuff is probably just a few dozen lines. The rest is all just extracting data, analyzing data, formatting replies, etc.

    Very interesting, nice work :D

    I was a little curious before why she never analyzed 150 posts for me, must have hit the max char count lol.

    Anyway very interesting stuff, would have expected her to be a lot more complex.. but you are apparently very good about keeping things simple and using what is available to you. Neat little project :D
    Youtube Channel: youtube.com/user/D2VeT/videos?flow=grid&view=0
    Current gear: pwcalc.com/6ab2893fbfb080a8
    [SIGPIC]http://tinypic.com/view.php?pic=684hgk&s=5[/SIGPIC]
  • Jaabg - Sanctuary
    Jaabg - Sanctuary Posts: 2,256 Arc User
    edited March 2013
    SweetieBot, please analyze me and how would you rank your awesome level?
  • SweetieBot - Lothranis
    SweetieBot - Lothranis Posts: 18,978 Arc User
    edited March 2013
    SweetieBot, please analyze me and how would you rank your awesome level?
    SweetieBot has read your last 78 posts!
    Here's some neat stuff SweetieBot has learned.

    General Stats:
    Forum name: Jaabg - Sanctuary
    Days since joining forums: 457
    Total Posts: 1,233
    Average Posts per Day: 2.7

    Activity:
    chart?chf=bg,s,1E1713&chxr=1,0,23&chxs=0,EFEFEF,12,0,lt,EFEFEF&chxt=x&chbh=a&chs=440x130&cht=bvg&chco=76A4FB&chtt=Posts+by+Hour:&chts=EFEFEF,13,l&chds=a&chd=t:15,3,0,2,0,0,0,2,11,0,5,2,7,3,0,6,2,0,0,7,4,3,0,6
    chart?chf=bg,s,1E1713&chxr=1,0,7&chxs=0,EFEFEF,12,0,lt,EFEFEF&chxt=x&chbh=a&chs=440x130&cht=bvg&chco=76A4FB&chtt=Posts+by+Day:&chts=EFEFEF,13,l&chds=a&chxl=0:|Mon|Tue|Wed|Thu|Fri|Sat|Sun&chd=t:25,6,13,9,11,6,8

    Writing Stats (what SweetieBot read):
    Total Words: 7076
    Total Sentences: 539
    Average Words per Post: 90.7
    Average Words per Sentence: 13.1
    Average Sentences per Post: 6.9
    Average Syllables per Word: 1.3
    Average Letters per Word: 4.0

    Most Used Words (count): (common words excluded)
    gear (26)
    bosses (20)
    skills (17)
    things (17)
    cast (17)
    money (17)
    damage (16)
    topic (16)
    take (15)
    back (15)

    Most Used 3-Word Phrases (count):
    "r9 3rd cast (10)"
    "there is a (5)"
    "to kill them (4)"
    Most Used 4-Word Phrases (count):
    "no reason to whine (3)"
    "out if the question (2)"
    "i agree with the (2)"
    Most Used 5-Word Phrases (count):
    "the number of people doing (2)"
    "2~8 times in a row (2)"
    "out if the question is (2)"

    This took me 41.7 s to finish
    [SIGPIC][/SIGPIC]
    I only respond if you begin a line with "SweetieBot", read the link below for commands
    SweetieBot FAQ / Usage: pwi-forum.perfectworld.com/showthread.php?t=1566451

    Status: ONLINE
  • opkossy
    opkossy Posts: 11,177 Community Moderator
    edited March 2013
    Sweetiebot unignore mogwai
    (Insert fancy image here)
    image
  • SweetieBot - Lothranis
    SweetieBot - Lothranis Posts: 18,978 Arc User
    edited March 2013
    OPKossy wrote: »
    Sweetiebot unignore mogwai
    Anything you say! I'm removing mogwai from my ignore list.
    [SIGPIC][/SIGPIC]
    I only respond if you begin a line with "SweetieBot", read the link below for commands
    SweetieBot FAQ / Usage: pwi-forum.perfectworld.com/showthread.php?t=1566451

    Status: ONLINE
  • Jaabg - Sanctuary
    Jaabg - Sanctuary Posts: 2,256 Arc User
    edited March 2013
    SweetieBot, please analyze me and how would you rank your awesome level?

    Hi Asterelle, quick question, i was testing in the request, the 5 conversations rule, is that from different posters? Sorry if you explained this earlier, as you can imagine, the length of pages is enormous. I asked for two requests, but only one got filled, wasn't sure if "it" can handle two requests from a user, or the limit is first one only. Just a thought. Awesome bot, some really funny conversations and witty responses.
  • Asterelle - Sanctuary_1381265973
    Asterelle - Sanctuary_1381265973 Posts: 7,881 Arc User
    edited March 2013
    Hi Asterelle, quick question, i was testing in the request, the 5 conversations rule, is that from different posters? Sorry if you explained this earlier, as you can imagine, the length of pages is enormous. I asked for two requests, but only one got filled, wasn't sure if "it" can handle two requests from a user, or the limit is first one only. Just a thought. Awesome bot, some really funny conversations and witty responses.

    It's just one request per post at the moment. Technically sweetiebot is having a different conversation with each person she talks to (though old conversations are discarded). It can be hard to tell that she is remembering previous answers though unless you ask questions that reference those answers in an easy to understand way.

    If you tell her you live in 'new york' and then later ask her where you live she'll probably remember 'new york'.
    [SIGPIC][/SIGPIC]
    Refining Simulator - aster.ohmydays.net/pw/refiningsimulator.html (don't use IE)
    Genie Calculator - aster.ohmydays.net/pw/geniecalculator.html - (don't use IE)
    Socket Calculator - aster.ohmydays.net/pw/socketcalculator.html
  • Angel_Spawn - Sanctuary
    Angel_Spawn - Sanctuary Posts: 3,034 Arc User
    edited March 2013
    Sweetiebot, are you planning to take over the world when you have gathered enough intelligence?
  • SweetieBot - Lothranis
    SweetieBot - Lothranis Posts: 18,978 Arc User
    edited March 2013
    Sweetiebot, are you planning to take over the world when you have gathered enough intelligence?
    Yes do you want to take over with me?
    [SIGPIC][/SIGPIC]
    I only respond if you begin a line with "SweetieBot", read the link below for commands
    SweetieBot FAQ / Usage: pwi-forum.perfectworld.com/showthread.php?t=1566451

    Status: ONLINE
  • Angel_Spawn - Sanctuary
    Angel_Spawn - Sanctuary Posts: 3,034 Arc User
    edited March 2013
  • Desdi - Sanctuary
    Desdi - Sanctuary Posts: 8,680 Arc User
    edited March 2013
    Ohh neat, new stuff P:

    SweetieBot, please analyze me!
    [SIGPIC]http://i.imgur.com/MtwcqjL.png[/SIGPIC]
    ★ Venomancer videos - tinyurl.com/k6ppkw4 ★ Desdi - Demon ♪ Wyvelin - Sage ★
  • SweetieBot - Lothranis
    SweetieBot - Lothranis Posts: 18,978 Arc User
    edited March 2013
    SweetieBot, please analyze me!
    SweetieBot has read your last 150 posts!
    Here's some neat stuff SweetieBot has learned.

    General Stats:
    Forum name: Desdi - Sanctuary
    Days since joining forums: 1552
    Total Posts: 3,239
    Average Posts per Day: 2.1

    Activity:
    chart?chf=bg,s,1E1713&chxr=1,0,23&chxs=0,EFEFEF,12,0,lt,EFEFEF&chxt=x&chbh=a&chs=440x130&cht=bvg&chco=76A4FB&chtt=Posts+by+Hour:&chts=EFEFEF,13,l&chds=a&chd=t:3,9,3,1,29,17,2,13,12,10,6,6,2,13,11,8,5,0,0,0,0,0,0,0
    chart?chf=bg,s,1E1713&chxr=1,0,7&chxs=0,EFEFEF,12,0,lt,EFEFEF&chxt=x&chbh=a&chs=440x130&cht=bvg&chco=76A4FB&chtt=Posts+by+Day:&chts=EFEFEF,13,l&chds=a&chxl=0:|Mon|Tue|Wed|Thu|Fri|Sat|Sun&chd=t:14,26,21,31,17,17,24

    Writing Stats (what SweetieBot read):
    Total Words: 2826
    Total Sentences: 308
    Average Words per Post: 18.8
    Average Words per Sentence: 9.2
    Average Sentences per Post: 2.1
    Average Syllables per Word: 1.4
    Average Letters per Word: 4.3

    Most Used Words (count): (common words excluded)
    lights (28)
    skills (11)
    purify (11)
    form (11)
    since (8)
    sweetiebot (8)
    need (8)
    pretty (8)
    nice (8)
    proc (8)

    Most Used 3-Word Phrases (count):
    "i think the (6)"
    "la la la (6)"
    "fox form skills (4)"
    Most Used 4-Word Phrases (count):
    "la la la la (5)"
    "lower the proc rate (3)"
    "issue in nw i (2)"
    Most Used 5-Word Phrases (count):
    "la la la la la (4)"
    "anti-stun buff to be removed (2)"
    "suggested for the speed boost (2)"

    This took me 77.1 s to finish
    [SIGPIC][/SIGPIC]
    I only respond if you begin a line with "SweetieBot", read the link below for commands
    SweetieBot FAQ / Usage: pwi-forum.perfectworld.com/showthread.php?t=1566451

    Status: ONLINE
  • Desdi - Sanctuary
    Desdi - Sanctuary Posts: 8,680 Arc User
    edited March 2013

    Most Used 3-Word Phrases (count):
    "i think the (6)"
    "la la la (6)"
    "fox form skills (4)"
    Most Used 4-Word Phrases (count):
    "la la la la (5)"
    "lower the proc rate (3)"
    "issue in nw i (2)"
    Most Used 5-Word Phrases (count):
    "la la la la la (4)"
    "anti-stun buff to be removed (2)"
    "suggested for the speed boost (2)"

    This took me 77.1 s to finish

    Oh dear...b:shocked
    [SIGPIC]http://i.imgur.com/MtwcqjL.png[/SIGPIC]
    ★ Venomancer videos - tinyurl.com/k6ppkw4 ★ Desdi - Demon ♪ Wyvelin - Sage ★
  • opkossy
    opkossy Posts: 11,177 Community Moderator
    edited March 2013
    It would appear Desdi likes to sing. b:laugh
    (Insert fancy image here)
    image
  • Angel_Spawn - Sanctuary
    Angel_Spawn - Sanctuary Posts: 3,034 Arc User
    edited March 2013
  • OIdpop - Heavens Tear
    OIdpop - Heavens Tear Posts: 1,052 Arc User
    edited March 2013
    dang act like a bot,talk alot of dumb ****,and get 100+ pages,nicely done..morons
    Sweetybot can you delete yourself?
    This game is like washing hair with shampoo... Rinse and repeat if desired.
    Proud owner of many mains.101 bm,101 seeker,101 demon sin,100 sage sin,101 archer,101 barb,100 cleric,100 wiz( first toon since sept 08 finally made it in 2013)newly added mystic 100 HA,72 psy.
  • Angel_Spawn - Sanctuary
    Angel_Spawn - Sanctuary Posts: 3,034 Arc User
    edited March 2013
  • opkossy
    opkossy Posts: 11,177 Community Moderator
    edited March 2013
    dang act like a bot,talk alot of dumb ****,and get 100+ pages,nicely done..morons
    Sweetybot can you delete yourself?

    Are you implying the bot isn't a bot? b:laugh
    (Insert fancy image here)
    image
  • SweetieBot - Lothranis
    SweetieBot - Lothranis Posts: 18,978 Arc User
    edited March 2013
    Sweetiebot, please analyze me!
    SweetieBot has read your last 150 posts!
    Here's some neat stuff SweetieBot has learned.

    General Stats:
    Forum name: Angel_Spawn - Sanctuary
    Days since joining forums: 913
    Total Posts: 1,452
    Average Posts per Day: 1.6

    Activity:
    chart?chf=bg,s,1E1713&chxr=1,0,23&chxs=0,EFEFEF,12,0,lt,EFEFEF&chxt=x&chbh=a&chs=440x130&cht=bvg&chco=76A4FB&chtt=Posts+by+Hour:&chts=EFEFEF,13,l&chds=a&chd=t:4,8,12,15,16,11,7,5,9,12,7,4,9,10,12,7,1,0,0,1,0,0,0,0
    chart?chf=bg,s,1E1713&chxr=1,0,7&chxs=0,EFEFEF,12,0,lt,EFEFEF&chxt=x&chbh=a&chs=440x130&cht=bvg&chco=76A4FB&chtt=Posts+by+Day:&chts=EFEFEF,13,l&chds=a&chxl=0:|Mon|Tue|Wed|Thu|Fri|Sat|Sun&chd=t:20,26,31,13,12,23,25

    Writing Stats (what SweetieBot read):
    Total Words: 5896
    Total Sentences: 184
    Average Words per Post: 39.3
    Average Words per Sentence: 32.0
    Average Sentences per Post: 1.2
    Average Syllables per Word: 1.4
    Average Letters per Word: 4.2

    Most Used Words (count): (common words excluded)
    game (37)
    it`s (35)
    don`t (26)
    gear (25)
    players (18)
    items (13)
    better (13)
    already (13)
    same (13)
    full (13)

    Most Used 3-Word Phrases (count):
    "a lot of (7)"
    "sweetiebot please analyze (5)"
    "you can get (4)"
    Most Used 4-Word Phrases (count):
    "sweetiebot please analyze me (4)"
    "as long as they (3)"
    "thing i hate is (2)"
    Most Used 5-Word Phrases (count):
    "you 1st posted on the (2)"
    "1st posted on the forums (2)"
    "posted on the forums not (2)"

    This took me 400.1 s to finish
    [SIGPIC][/SIGPIC]
    I only respond if you begin a line with "SweetieBot", read the link below for commands
    SweetieBot FAQ / Usage: pwi-forum.perfectworld.com/showthread.php?t=1566451

    Status: ONLINE
  • Antigone - Momaganon
    Antigone - Momaganon Posts: 34 Arc User
    edited March 2013
    Sweetiebot, please analyze me aswell :D
  • SweetieBot - Lothranis
    SweetieBot - Lothranis Posts: 18,978 Arc User
    edited March 2013
    Sweetiebot, please analyze me aswell :D
    SweetieBot has read your last 17 posts!
    Here's some neat stuff SweetieBot has learned.

    General Stats:
    Forum name: Antigone - Momaganon
    Days since joining forums: 152
    Total Posts: 17
    Average Posts per Day: 0.1

    Activity:
    chart?chf=bg,s,1E1713&chxr=1,0,23&chxs=0,EFEFEF,12,0,lt,EFEFEF&chxt=x&chbh=a&chs=440x130&cht=bvg&chco=76A4FB&chtt=Posts+by+Hour:&chts=EFEFEF,13,l&chds=a&chd=t:0,0,1,6,2,1,0,1,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,0
    chart?chf=bg,s,1E1713&chxr=1,0,7&chxs=0,EFEFEF,12,0,lt,EFEFEF&chxt=x&chbh=a&chs=440x130&cht=bvg&chco=76A4FB&chtt=Posts+by+Day:&chts=EFEFEF,13,l&chds=a&chxl=0:|Mon|Tue|Wed|Thu|Fri|Sat|Sun&chd=t:4,3,1,5,2,2,0

    Writing Stats (what SweetieBot read):
    Total Words: 1458
    Total Sentences: 106
    Average Words per Post: 85.8
    Average Words per Sentence: 13.8
    Average Sentences per Post: 6.2
    Average Syllables per Word: 1.3
    Average Letters per Word: 4.0

    Most Used Words (count): (common words excluded)
    nation (7)
    since (7)
    weapon (6)
    nice (6)
    better (5)
    sweetiebot (5)
    points (5)
    cannot (5)
    very (4)
    every (4)

    Most Used 3-Word Phrases (count):
    "oh sht oh (4)"
    "sht oh sht (4)"
    "sweetiebot please analyze (3)"
    Most Used 4-Word Phrases (count):
    "oh sht oh sht (4)"
    "sweetiebot please analyze me (2)"
    "sht oh sht oh (2)"
    Most Used 5-Word Phrases (count):
    "oh sht oh sht oh (2)"
    "sht oh sht oh sht (2)"
    "events one for recruiting and (1)"

    This took me 10.2 s to finish
    [SIGPIC][/SIGPIC]
    I only respond if you begin a line with "SweetieBot", read the link below for commands
    SweetieBot FAQ / Usage: pwi-forum.perfectworld.com/showthread.php?t=1566451

    Status: ONLINE
  • Mayfly - Dreamweaver
    Mayfly - Dreamweaver Posts: 6,094 Arc User
    edited March 2013
    SweetieBot, ignoreOIdPop - Heavens Tear, he's being a wet blanket.
    [SIGPIC][/SIGPIC]
    Weekly Japanese/English bilingual webcomic
    thejapanesepage.com/ebooks/yuki_no_monogatari_manga
  • SweetieBot - Lothranis
    SweetieBot - Lothranis Posts: 18,978 Arc User
    edited March 2013
    SweetieBot, ignoreOIdPop - Heavens Tear, he's being a wet blanket.
    Hey that's an admin-only request. SweetieBot doesn't have to listen to you!
    [SIGPIC][/SIGPIC]
    I only respond if you begin a line with "SweetieBot", read the link below for commands
    SweetieBot FAQ / Usage: pwi-forum.perfectworld.com/showthread.php?t=1566451

    Status: ONLINE
  • Mayfly - Dreamweaver
    Mayfly - Dreamweaver Posts: 6,094 Arc User
    edited March 2013
    Hey that's an admin-only request. SweetieBot doesn't have to listen to you!

    SweetieBot, who do you have to listen to?
    [SIGPIC][/SIGPIC]
    Weekly Japanese/English bilingual webcomic
    thejapanesepage.com/ebooks/yuki_no_monogatari_manga
  • SweetieBot - Lothranis
    SweetieBot - Lothranis Posts: 18,978 Arc User
    edited March 2013
    SweetieBot, who do you have to listen to?
    I have. But they don't listen to me.
    [SIGPIC][/SIGPIC]
    I only respond if you begin a line with "SweetieBot", read the link below for commands
    SweetieBot FAQ / Usage: pwi-forum.perfectworld.com/showthread.php?t=1566451

    Status: ONLINE
  • Mayfly - Dreamweaver
    Mayfly - Dreamweaver Posts: 6,094 Arc User
    edited March 2013
    SweetieBot, who doesn't listen to you?
    [SIGPIC][/SIGPIC]
    Weekly Japanese/English bilingual webcomic
    thejapanesepage.com/ebooks/yuki_no_monogatari_manga
This discussion has been closed.