-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglobalvars.py
More file actions
244 lines (222 loc) · 7.51 KB
/
globalvars.py
File metadata and controls
244 lines (222 loc) · 7.51 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# coding=utf-8
from ChatExchange6.chatexchange6.client import Client
from configreader import ConfigReader
import getpass
import sys
import re
from time import sleep
# noinspection PyBroadException
class GlobalVars:
def __init__(self):
pass
try:
open('login.json', 'r')
except IOError:
open('login.json', 'w')
config_reader = ConfigReader('login.json')
config_reader.ensure_value('nopass', False)
if config_reader.has_value('username'):
username = config_reader.get_value('username')
else:
username = raw_input('Username: ')
config_reader.set_value('username', username)
if config_reader.has_value('password'):
password = config_reader.get_value('password')
else:
password = getpass.getpass()
print(password)
while True:
print('What to do with password?')
print('1) Save to login.json')
print('2) Don\'t save to login.json, I\'ll enter it myself every time')
option = int(raw_input('> '))
if option == 1:
config_reader.set_value('password', password)
break
elif option == 2:
break
else:
print('Um wat? ')
config_reader.save()
charcoal_room_id = '11540'
meta_tavern_room_id = '89'
meta_dunno_room_id = '897'
socvr_room_id = '41570'
# smokeDetector_user_id = {'se': '120914', 'meta': '266345',
smokeDetector_user_id = {
charcoal_room_id: '120914',
meta_dunno_room_id: '257207',
meta_tavern_room_id: '257207',
socvr_room_id: '3735529'
}
# Just get the Smokey list for now?
privileged_users = {
charcoal_room_id: [
'117490', # Normal Human
'66258', # Andy
'31768', # ManishEarth
'103081', # hichris123
'73046', # Undo
'88521', # ProgramFOX
'59776', # Doorknob
'31465', # Seth
'88577', # Santa Claus
'34124', # Andrew Leach
'54229', # apnorton
'20459', # S.L. Barth
'32436', # tchrist
'30477' # Brock Adams
], meta_tavern_room_id: [
'259867', # Normal Human
'244519', # Roombatron5000
'244382', # TGMCians
'194047', # Jan Dvorak
'158100', # rene
'178438', # Manishearth
'237685', # hichris123
'215468', # Undo
'229438', # ProgramFOX
'180276', # Doorknob
'161974', # Lynn Crumbling
'186281', # Andy
'266094', # Unihedro
'245167', # Infinite Recursion (No.)
'230261', # Jason C
'213575', # Braiam
'241919', # Andrew T.
'203389', # backwards-Seth
'202832', # Mooseman
'160017', # DragonLord the Fiery
'201151', # bummi
'188558', # Frank
'229166', # Santa Claus
'159034', # Kevin Brown
'203972', # PeterJ
'188673', # Alexis King
'258672', # AstroCB
'227577', # Sam
'255735', # cybermonkey
'279182', # Ixrec
'271104', # James
'220428', # Qantas 94 Heavy
'153355', # tchrist
'238426', # Ed Cottrell
'166899', # Second Rikudo
'287999', # ASCIIThenANSI
'208518', # JNat
'284141', # michaelpri
'260312', # vaultah
'244062', # SouravGhosh
'152859', # Shadow Wizard
'201314', # apnorton
'280934', # M.A.Ramezani
'200235', # durron597
'148310', # Awesome Poodles / Brock Adams
'168333', # S.L. Barth
'257207', # Uni*
'244282', # DroidDev
'163250', # Cupcake
'298265', # Explosions kid
'253560', # josilber
'244254', # misterManSam
'188189', # Robert Longson
'202362' # chmod 666 telkitty
], meta_dunno_room_id: [
'257207', # Uni*,
'282866', # berserk
'152859' # Shadow Wizard
], socvr_room_id: [
'1849664', # Undo
'2581872', # hichris123
'1198729', # Manishearth
'3717023', # Normal Human aka 1999
'2619912', # ProgramFOX
'578411', # rene
'1043380', # gunr2171
'2246344', # Sam
'2756409', # TylerH
'1768232', # durron597
'359284', # Kevin Brown
'258400', # easwee
'3622940', # Unihedron
'3204551', # Deduplicator
'4342498', # NathanOliver
'4639281', # Tiny Giant
'3093387', # josilber
'1652962', # cimmanon
'1677912', # Mogsdad
'656243', # Lynn Crumbling
'3933332', # Rizier123
'2422013', # cybermonkey
'3478852', # Nisse Engström
'2302862', # Siguza
'1324', # Paul Roub
'1743880', # Tunaki
'1663001', # DavidG
'2415822', # JAL
'4174897', # Kyll
'5299236', # Kevin Guan
'4050842', # Thaillie
'1816093' # Drew
]
}
client_se = None
client_mse = None
client_so = None
print('Attempting to login to user...')
while True:
try:
client_se = Client('stackexchange.com')
client_se.login(username, password)
charcoal_hq = client_se.get_room(charcoal_room_id)
charcoal_hq.join()
break
except Exception as e:
print(e)
print('Silly base10 thing in SE, go away!')
sleep(2)
print('Logged into SE')
while True:
try:
client_mse = Client('meta.stackexchange.com')
client_mse.login(username, password)
tavern_on_the_meta = client_mse.get_room(meta_tavern_room_id)
dunno_what_this_is_dun_delete = client_mse.get_room(meta_dunno_room_id)
tavern_on_the_meta.join()
dunno_what_this_is_dun_delete.join()
break
except:
print('Silly base10 thing in MSE, go away!')
sleep(2)
print('Logged into MSE')
while True:
try:
client_so = Client('stackoverflow.com')
client_so.login(username, password)
socvr = client_so.get_room(socvr_room_id)
socvr.join()
break
except:
print('Silly base10 thing in SO, go away!')
sleep(2)
print('Logged into SO')
smokey_regex = re.compile(
"\\[ \\[SmokeDetector\\]\\(https://github\\.com/Charcoal-SE/SmokeDetector\\) \\] " +
"(.+): \\[(.+)\\]\\(//[\\w\\.]+.com/(questions|answers|q|a)/(\\d+)\\) by " +
"\\[(.+)\\]\\(//[\\w.]+/users/(\\d+)/[\\w+-]+\\) on `(.+)`")
last_smokey_id = {
meta_tavern_room_id: -1,
meta_dunno_room_id: -1,
charcoal_room_id: -1,
socvr_room_id: -1
}
se_api_key = 'ejd0RvELOz1Y3t0RXA99JA(('
import api_details
se_api_token = api_details.token
if sys.version_info.major == 3:
# Route raw_input to input
# This is because we love python 3 and 2
# In python 3, raw_input is replaced by input:
# http://stackoverflow.com/a/954840/3278662
# <3 Balpha :P
raw_input = input