Skip to content
This repository has been archived by the owner on Jan 1, 2021. It is now read-only.

Commit

Permalink
fix countdown command displaying incorrect values
Browse files Browse the repository at this point in the history
  • Loading branch information
jgayfer committed Aug 13, 2017
1 parent 865f24a commit 1a10bb7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.5.1] - 2017-08-12
### Fixed
- Countdown command was displaying incorrect values

## [0.5.0] - 2017-08-12
### Added
- New command 'countdown' displays time until upcoming Destiny 2 releases
Expand Down
8 changes: 5 additions & 3 deletions cogs/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import discord
from discord.ext import commands
import pytz

from cogs.utils.messages import MessageManager
from cogs.utils import constants
Expand All @@ -17,16 +18,17 @@ def __init__(self, bot):
async def countdown(self, ctx):
"""Show time until upcoming Destiny 2 releases"""
manager = MessageManager(self.bot, ctx.message.author, ctx.message.channel, [ctx.message])

pst_now = datetime.now(tz=pytz.timezone('US/Pacific'))
text = ""

for name, date in constants.RELEASE_DATES:
diff = date - datetime.now()
diff = date - pst_now
if diff.days == -1:
text += "{}: Today!\n".format(name)
elif diff.days == 0:
text += "{}: Tomorrow!\n".format(name)
elif diff.days > 1:
text += "{}: {} days\n".format(name, diff.days)
text += "{}: {} days\n".format(name, diff.days + 1)

countdown = discord.Embed(title="Destiny 2 Countdown", color=constants.BLUE)
countdown.description = text
Expand Down
9 changes: 5 additions & 4 deletions cogs/utils/constants.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from datetime import datetime

import discord
import pytz

VERSION = "0.5.0"
VERSION = "0.5.1"
BLUE = discord.Colour(3381759)
SPAM_DELAY = 4.5
REACTION_DELAY = 1
Expand All @@ -18,6 +19,6 @@
'SAMT', 'SDT', 'SRT', 'SST', 'UYST', 'UYT', 'VET',
'WDT', 'WEST', 'WET', 'WST', 'YST', 'YDT' ]

RELEASE_DATES = [("PC Beta", datetime(2017,8,28)),
("Console Release", datetime(2017,9,6)),
("PC Release", datetime(2017,10,24))]
RELEASE_DATES = [("PC Beta", datetime(2017, 8, 28, tzinfo=pytz.timezone('US/Pacific'))),
("Console Release", datetime(2017, 9, 6, tzinfo=pytz.timezone('US/Pacific'))),
("PC Release", datetime(2017, 10, 24, tzinfo=pytz.timezone('US/Pacific')))]
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
discord.py==0.16.7
mysqlclient==1.3.10
pytz==2017.2

0 comments on commit 1a10bb7

Please sign in to comment.