Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import re
- import time
- import sys
- from cleverbot import Cleverbot
- from random import randint
- sys.setrecursionlimit(100000);
- requests.packages.urllib3.disable_warnings();
- #####
- Account = [raw_input('Username: '), raw_input('Password: ')];
- ID = raw_input('ID: ');
- Wait = 32;
- #####
- def getval(name, string):
- return re.search('id=\"' + name + '\" value=\"(.+)\"', string).group(1);
- def login(username, password, session):
- return session.post('https://m.roblox.com/login', data={'UserName':username,'Password':password});
- def getRandomThread(subforum, session):
- req1 = session.get('https://forum.roblox.com/Forum/ShowForum.aspx?ForumID=' + str(subforum)).content;
- number = randint(3, 10);
- postid = re.findall('PostID=(\d+)', req1)[1+number];
- return postid
- def getTitle(postid, session):
- req1 = session.get('https://forum.roblox.com/Forum/ShowPost.aspx?PostID=' + postid).content;
- title = re.search('20px\">(.+)<', req1).group(1);
- return title
- def reply(postid, body, session):
- req1 = session.get('https://forum.roblox.com/Forum/AddPost.aspx?PostID=' + str(postid)).content;
- reqdata = {
- '__EVENTTARGET': ' ', #getval('__EVENTTARGET', req1),
- '__EVENTARGUMENT': ' ', #getval('__EVENTARGUMENT', req1),
- '__VIEWSTATE': getval('__VIEWSTATE', req1),
- '__VIEWSTATEGENERATOR': getval('__VIEWSTATEGENERATOR', req1),
- '__EVENTVALIDATION': getval('__EVENTVALIDATION', req1),
- 'ctl00$cphRoblox$Createeditpost1$PostForm$PostBody': body,
- 'ctl00$cphRoblox$Createeditpost1$PostForm$PostButton': ' Post '
- }
- return session.post('https://forum.roblox.com/Forum/AddPost.aspx?PostID=' + str(postid), data=reqdata);
- #####
- ses = requests.Session();
- login(Account[0], Account[1], ses);
- print '-- CLEVERBOT FOR FORUM --'
- print '-- Made by DominusTrex --'
- print ' 1 day of use: ' + str(60 * 60 / 32 * 24) + ' posts'
- print ''
- def main():
- def main2():
- try:
- Siggy = 'There are only ' + str(randint(100, 1000)) + ' ducks left in the world.';
- threadid = getRandomThread(ID, ses);
- title = getTitle(threadid, ses);
- answer = (Cleverbot().ask(title) + '\n\n\n').lower() + Siggy;
- reply(threadid, answer, ses);
- print(threadid);
- except:
- main2();
- main2();
- time.sleep(Wait);
- main();
- main();
Add Comment
Please, Sign In to add comment