From de4aa44201ffb4df5d74914c1b7329ad8dbf3eb4 Mon Sep 17 00:00:00 2001 From: JP Date: Sat, 30 Jun 2018 00:36:15 +0200 Subject: [PATCH] small fix on previous commit --- Shitpost.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Shitpost.py b/Shitpost.py index b8844b0..4daebc6 100644 --- a/Shitpost.py +++ b/Shitpost.py @@ -27,6 +27,7 @@ class Shitpost(object): """Hoe lang nog tot Hoestende Dranken Con 2018? Gebruik: !ishetalhdcon """ + #year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0) Now = datetime.now() HdConDate = datetime(2018, 9, 14, 4, 0, 1) #om 4 uur lig je toch wel al op bed? @@ -61,7 +62,8 @@ class Shitpost(object): eventsMinutesAgoSameAuthor +=1 if eventDistance.days < 2: eventsLastDays += 1 - self.hdConImpatientEvents.append([ctx.author.id, Now]) + if not "DMChannel" in type(ctx.channel).__name__: #ignore personal chats + self.hdConImpatientEvents.append([ctx.author.id, Now]) #Als dezelfde persoon het blijft vragen pikken we het niet: if eventsMinutesAgoSameAuthor > 3: @@ -73,15 +75,16 @@ class Shitpost(object): yield from ctx.channel.send("Dat vroeg je net ook al, " + ctx.author.mention + "!") return #Hoe vaker er wordt gevraagd, hoe ongeduldiger de antwoorden: - impatientFactor = 10 + eventsMinutesAgo*25 + eventsLastDays*10; - impatientFactor *= random.random() - if impatientFactor > 100: - yield from ctx.channel.send("Nee!") - return - elif impatientFactor > 15 and eventsMinutesAgo > 0: - Message = "Dat hebben jullie net gevraagd." - elif impatientFactor > 9: - Message = "Nee." + if not "DMChannel" in type(ctx.channel).__name__: #ignore personal chats + impatientFactor = 10 + eventsMinutesAgo*25 + eventsLastDays*10; + impatientFactor *= random.random() + if impatientFactor > 100: + yield from ctx.channel.send("Nee!") + return + elif impatientFactor > 15 and eventsMinutesAgo > 0: + Message = "Dat hebben jullie net gevraagd." + elif impatientFactor > 9: + Message = "Nee." yield from ctx.channel.send(ctx.author.mention + ' ' + str(Message))