Skip to content

Commit e574506

Browse files
committed
code clean up is so much fun -.-
1 parent aba8755 commit e574506

File tree

1 file changed

+20
-39
lines changed

1 file changed

+20
-39
lines changed

discordbot.py

Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -233,47 +233,25 @@ async def on_message(message):
233233
await client.send_message(message.channel, '%s: Error getting info for character %s-%s-%s. Role not found. Make sure your format is \'!sim charactername-servername-region\'.' % (author.mention, character, server, region))
234234
else:
235235
await client.send_message(message.channel, '%s: Character %s-%s-%s not found. Make sure your format is \'!sim charactername-servername-region\'.' % (author.mention, character, server, region))
236-
if message.content.startswith('!sim3 '):
237-
character = charstrip(message.content, '!sim3 ').strip()
238-
server = serverstrip(message.content).replace("'", "").strip()
239-
region = regionfind(message.content).strip()
240-
escapeAuthor = author.mention.replace(">", "\>").replace("<", "\<")
241-
print('Looking at %s - %s - %s' % (character, server, region))
242-
if char_exists(character, server, region):
243-
print("Toon exists, moving on")
244-
isDPS = is_dps(character, server, region)
245-
spec = get_spec(character, server, region)
246-
role = get_role(character, server, region)
247-
print('Looking at %s - %s - %s who exists and is a %s' % (character, server, region, spec ))
248-
if (isDPS or spec == 'Shadow'):
249-
if(spec == 'Shadow' or True):
250-
await client.send_message(message.channel, 'Pulling simming stats for %s - %s - %s. Be aware concurrent simulations will slow me down. Be gentle... I\'m delicate :^)' % (character, server, region))
251-
await client.send_message(message.channel, 'Temple Bot takes about 3-5 min to run a sim (longer if multiple sims are going at the same time). I will ping you when I\'m done')
252-
await client.send_message(message.channel, 'Current spec: %s. Armory info last updated %s' % (spec, armory_date(character, server, region)))
253-
await client.send_message(message.channel, '%s: Starting 3 sims for 1, 2 and 3 targets. These will run one after the other and will take several minutes.' % author.mention)
254-
subprocess.Popen('python3 sim1.py %s %s %s %s %s' % (character, server, message.channel.id, escapeAuthor, region), shell=True)
255-
else:
256-
await client.send_message(message.channel, '%s: Sorry, I am a mean temple bot. I only have eyes for Shadow Priests.' % author.mention)
257-
else:
258-
if (role == 'TANK'):
259-
await client.send_message(message.channel, '%s: Sorry, sims for pawn do not work well for Tanks. This is a limitation of SimulationCraft. Have you thought about being Shadow? I like Shadow' % author.mention)
260-
elif (role == 'HEALING'):
261-
await client.send_message(message.channel, '%s: Sorry, sims do not work for healers. This is a limitation of SimulationCraft. Have you thought about being Shadow?' % author.mention)
262-
else:
263-
await client.send_message(message.channel, '%s: Error getting info for character %s-%s-%s. Role not found. Make sure your format is \'!sim charactername-servername-region\'.' % (author.mention, character, server, region))
264-
else:
265-
await client.send_message(message.channel, '%s: Character %s-%s-%s not found. Make sure your format is \'!sim charactername-servername-region\'.' % (author.mention, character, server, region))
266-
if message.content.startswith('!2sim ') or message.content.startswith('!3sim '):
267-
run2 = True
236+
if message.content.startswith('!2sim ') or message.content.startswith('!3sim ') or message.content.startswith('!sim3 '):
237+
run2 = False
238+
run3 = False
239+
runAll3 = False
240+
268241
if(message.content.startswith('!2sim ')):
269242
character = charstrip(message.content, '!2sim ').strip()
270-
else:
243+
run2 = True
244+
elif(message.content.startswith('!3sim ')):
271245
character = charstrip(message.content, '!3sim ').strip()
272-
run2 = False
246+
run3 = True
247+
else:
248+
character = charstrip(message.content, '!sim3 ').strip()
249+
runAll3 = True
273250
server = serverstrip(message.content).replace("'", "").strip()
274251
region = regionfind(message.content).strip()
275252
escapeAuthor = author.mention.replace(">", "\>").replace("<", "\<")
276253
print('Looking at %s - %s - %s' % (character, server, region))
254+
await client.send_message(message.channel, 'Pulling simming stats for %s - %s - %s. Be aware concurrent simulations will slow me down. Be gentle... I\'m delicate :^)' % (character, server, region))
277255
if char_exists(character, server, region):
278256
print("Toon exists, moving on")
279257
isDPS = is_dps(character, server, region)
@@ -282,14 +260,17 @@ async def on_message(message):
282260
print('Looking at %s - %s - %s who exists and is a %s' % (character, server, region, spec ))
283261
if (isDPS or spec == 'Shadow'):
284262
if(spec == 'Shadow' or True):
285-
await client.send_message(message.channel, 'Pulling simming stats for %s - %s - %s. Be aware concurrent simulations will slow me down. Be gentle... I\'m delicate :^)' % (character, server, region))
286263
await client.send_message(message.channel, 'Temple Bot takes about 3-5 min to run a sim (longer if multiple sims are going at the same time). I will ping you when I\'m done')
287-
await client.send_message(message.channel, 'Current spec: %s. Armory info last updated %s' % (spec, armory_date(character, server, region)))
288-
await client.send_message(message.channel, '%s: Starting 1 sim for 2 targets. This will take several minutes.' % author.mention)
289-
if(run2):
264+
await client.send_message(message.channel, 'Current spec: %s. Armory info last updated %s' % (spec, armory_date(character, server, region)))
265+
if(run2):
266+
await client.send_message(message.channel, '%s: Starting 1 sim for 2 targets. This will take several minutes.' % author.mention)
290267
subprocess.Popen('python3 sim2.py %s %s %s %s %s yes' % (character, server, message.channel.id, escapeAuthor, region), shell=True)
291-
else:
268+
elif(run3):
269+
await client.send_message(message.channel, '%s: Starting 1 sim for 3 targets. This will take several minutes.' % author.mention)
292270
subprocess.Popen('python3 sim3.py %s %s %s %s %s yes' % (character, server, message.channel.id, escapeAuthor, region), shell=True)
271+
else:
272+
await client.send_message(message.channel, '%s: Starting 3 sims for 1, 2 and 3 targets. These will run one after the other and will take several minutes.' % author.mention)
273+
subprocess.Popen('python3 sim1.py %s %s %s %s %s' % (character, server, message.channel.id, escapeAuthor, region), shell=True)
293274
else:
294275
await client.send_message(message.channel, '%s: Sorry, I am a mean temple bot. I only have eyes for Shadow Priests.' % author.mention)
295276
else:

0 commit comments

Comments
 (0)