forked from TGWaffles/cryopodbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
statistics.py
82 lines (81 loc) · 2.31 KB
/
statistics.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# #!/usr/bin/python
# import sys
# import logging
# import discord
# from discord.ext import commands
# import praw
# import pdb
# import re
# import time
# #Imports all passwords from a hidden file ;)
# from pw_bot import *
# logging.basicConfig(level=logging.INFO)
# donelist = []
# fulltext = ''
# currenttext = ''
# people = []
# statlist = []
# toreverse = []
# def statcheck():
# file = open('statlines.txt', 'r+', encoding='palmos')
# for line in file:
# linelen = len(line)
# newlinelen = linelen - 1
# if line[:newlinelen] not in statlist:
# statlist.append(line[:newlinelen])
# file.close()
# def donecheck():
# file = open('donestats.txt', 'r')
# for line in file:
# linelen = len(line)
# newlinelen = linelen - 1
# if line[:newlinelen] not in donelist:
# donelist.append(line[:newlinelen])
# file.close()
# statcheck()
# donecheck()
# user_agent = ("CryoStats 1.0")
# #Starts the main section of the reddit bot and assigns it to r.
# r = praw.Reddit(user_agent = user_agent)
# r.login(REDDIT_USERNAME, REDDIT_PASS)
# subreddit = r.get_subreddit("thecryopodtohell")
# for submission in subreddit.get_new(limit=500):
# author = submission.author
# title = str(submission.title)
# print(title)
# if str(author).lower() == "klokinator" and title[0:4].lower() == "part" and title not in toreverse:
# toreverse.append(submission.title + "\n" + submission.selftext + "\n" + "\n")
# for i in toreverse:
# file = open('full.txt', 'r')
# for line in file:
# currenttext = currenttext + line
# file.close()
# file = open('full.txt', 'w')
# for i in reversed(toreverse):
# file = open('full.txt', 'r')
# for line in file:
# currenttext = currenttext + line
# file.close()
# file = open('reversedfull.txt', 'w')
# file.write(currenttext + i)
# print("Written!")
# file.close()
# file.close()
# file = open('full.txt', 'r+')
# for line in file:
# if line not in statlist:
# f = open('chars.txt', 'r')
# for line2 in f:
# characters = int(line2)
# print(line2)
# f.close()
# linelen = len(line)
# newlinelen = linelen - 1
# characters += newlinelen
# f = open('chars.txt', 'w')
# f.write(str(characters))
# f.close()
# fi = open('statlines.txt', 'r+')
# fi.write(line + "\n")
# fi.close()
# statcheck()