Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Commit

Permalink
Merge pull request #7 from ExtraRandom/master
Browse files Browse the repository at this point in the history
rd improvements
  • Loading branch information
David Jetelina authored and David Jetelina committed May 18, 2016
2 parents 9de3407 + 1abb611 commit 79424e8
Showing 1 changed file with 19 additions and 30 deletions.
49 changes: 19 additions & 30 deletions cogs/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import aiohttp
from datetime import datetime
from pytz import timezone
import collections

class General:
def __init__(self, bot):
Expand Down Expand Up @@ -84,36 +85,24 @@ async def _sf(self):

@commands.command(description=desc.rd, brief=desc.rd)
async def rd(self):
ow_rd = datetime(2016, 5, 24, 0, 0, 0)
bf_rd = datetime(2016, 10, 21, 0, 0, 0)
nms_rd = datetime(2016, 6, 21, 0, 0, 0)
d2_rd = datetime(2016, 11, 11, 0, 0, 0)
dx_rd = datetime(2016, 8, 23, 0, 0, 0)
hi_rd = datetime(2016, 6, 6, 0, 0, 0)

ow_days, ow_hrs, ow_mins = rd_calc(ow_rd) # OW and TW:W have the same release date
bf_days, bf_hrs, bf_mins = rd_calc(bf_rd) # BF1 and Civ6 have the same release date
nms_days, nms_hrs, nms_mins = rd_calc(nms_rd)
d2_days, d2_hrs, d2_mins = rd_calc(d2_rd)
dx_days, dx_hrs, dx_mins = rd_calc(dx_rd)
hi_days, hi_hrs, hi_mins = rd_calc(hi_rd)

# template: "*** *** releases in {},{} hours and {} minutes.\n".format(_days, _hrs, _mins)

title_msg = "__**Release Dates List** - *Times, Dates and Games are subject to change*__ \n \n"
ow_msg = "***Overwatch*** and ***Total War: Warhammer*** release in {},{} hours and {} minutes.\n".format(ow_days, ow_hrs, ow_mins)
nms_msg = "***No Man's Sky*** releases in {},{} hours and {} minutes.\n".format(nms_days, nms_hrs, nms_mins)
bf_msg = "***Battlefield*** ***1*** and ***Civilization*** ***6*** release in {},{} hours and {} minu" \
"tes. \n".format(bf_days, bf_hrs, bf_mins)
d2_msg = "***Dishonored*** ***2*** releases in {},{} hours and {} minutes.\n".format(d2_days, d2_hrs, d2_mins)
dx_msg = "***Deus Ex: Mankind Divided*** releases in {},{} hours and {} minutes.\n".format(dx_days, dx_hrs,
dx_mins)
hi_msg = "***Hearts of Iron*** ***4*** releases in {},{} hours and {}minutes.\n".format(hi_days, hi_hrs, hi_mins)
# having it like this should make changing them easier compared to how it was previously set up

full_msg = title_msg + ow_msg + hi_msg + nms_msg + dx_msg + bf_msg + d2_msg

await s.destructmsg(full_msg, 60, self.bot)
dates = {
"Overwatch": datetime(2016, 5, 24, 0, 0, 0),
"Total War: Warhammer": datetime(2016, 5, 24, 0, 0, 0),
"Hearts of Iron 4": datetime(2016, 6, 6, 0, 0, 0),
"No Man's Sky": datetime(2016, 6, 21, 0, 0, 0),
"Deus Ex: Mankind Divided": datetime(2016, 8, 23, 0, 0, 0),
"Battlefield 1": datetime(2016, 10, 21, 0, 0, 0),
"Civilization 6": datetime(2016, 10, 21, 0, 0, 0),
"Dishonored 2": datetime(2016, 11, 11, 0, 0, 0),
}

msg = "Release Dates List - Times, Dates and Games are subject to change\n"

for game, time in sorted(dates.items(), key=lambda x: x[1]):
days, hrs, mins = rd_calc(dates[game])
msg += "\n{} releases in {},{} hours and {} minutes.".format(game, days, hrs, mins)

await s.destructmsg("```"+msg+"```", 30, self.bot)


def rd_calc(rd):
Expand Down

0 comments on commit 79424e8

Please sign in to comment.