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

Commit

Permalink
Merge branch 'ExtraRandom-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
djetelina committed May 23, 2016
2 parents 385b56b + 06d3b74 commit 8c3da5d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
24 changes: 21 additions & 3 deletions cogs/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ async def release(self, ctx):

if int_day(days) < 0: # if hours is a minus (i.e. game is released)
msg = "{} is out now!".format(game)
elif int_day(days) == 0 and int(hrs) == 0 and int(mins) == 0:
msg = "{} releases within the next 60 seconds, HYPE!!!".format(game)
else:
msg = "{} releases in {}, {} hours and {} minutes.".format(game, days, hrs, mins)
await s.destructmsg(msg, 30, self.bot)
Expand All @@ -213,7 +215,15 @@ async def release(self, ctx):

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

if int_day(days) < 0: # if hours is a minus (i.e. game is released)
msg += "\n{} is out now!".format(game)
elif int_day(days) == 0 and int(hrs) == 0 and int(mins) == 0:
msg += "\n{} releases within the next 60 seconds, HYPE!!!".format(game)
else:
msg += "\n{} releases in {}, {} hours and {} minutes.".format(game, days, hrs, mins)

# msg += "\n{} releases in {}, {} hours and {} minutes.".format(game, days, hrs, mins)

await s.destructmsg("```{}```".format(msg), 30, self.bot)

Expand Down Expand Up @@ -274,12 +284,20 @@ def calc_until(rd):
"""

tdelta = rd - datetime.utcnow()
tstr = str(tdelta)
tstr = str(tdelta) # print(tstr)

test_var = tstr.split(".")[0]
if len(test_var) == 8: # if 8 characters long (meaning 0 days left):
if len(test_var) == 7 or len(test_var) == 8: # is there is still hours in the time left
days = "0 days"
hrs, mins, secs = test_var.split(":")
elif len(test_var) == 5 or len(test_var) == 4: # if there is still minutes in the time left
days = "0 days"
hrs = "0"
mins, secs = test_var.split(":")
elif len(test_var) == 1 or len(test_var) == 2: # if there are still seconds remaining until launch
days = "0 days"
hrs = "0"
mins = "0"
else:
days, notdays = tstr.split(",")
hrs, mins, secs = notdays.split(":")
Expand Down
3 changes: 1 addition & 2 deletions cogs/swear.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,12 @@ def point_check(self):
if self.points == 0:
del watchlist[self.user]


async def warn_user(self):
await s.whisper(self.user, random.choice(self.warnings), self.bot)
await self.bot.send_message(
self.bot.get_channel(chan.channels['admin']),
"User {} seems to be swearing a lot. He now has {} penalty points".format(
self.user.mention, self.points))
self.user.mention, self.points))


class Swear:
Expand Down

0 comments on commit 8c3da5d

Please sign in to comment.