Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if cmd == ("getdefs"):
- dbc = mysql.connector.connect(user="charizard", password="password", host="localhost", autocommit=True, database="charizard")
- db = dbc.cursor()
- db.execute("select word, definition from definitions where user = \""+post.user+"\";")
- tmp = [[': '.join(x for x in x)][0] for x in db.fetchall()]
- tmp.sort()
- wordCount = len(tmp)
- if wordCount <= 15:
- words = ', '.join(tmp)
- group.sendPost("You have "+str(wordCount)+" words defined and they are: "+words)
- else:
- data = urllib.parse.urlencode({
- "api_dev_key": "api_dev_key_goes_here",
- "api_option": "paste",
- "api_paste_code": '\n'.join(tmp),
- "api_paste_private": "1",
- "api_paste_name": post.user,
- "api_user_key": ""}).encode()
- group.sendPost("Here are your definitions: "+str(urllib.request.urlopen("http://pastebin.com/api/api_post.php", data).readall().decode("utf-8")))
- db.close()
- dbc.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement