ostern ist nun ein command
This commit is contained in:
parent
eb331a0189
commit
64afd24a90
|
@ -16,7 +16,7 @@ class Holidays(callbacks.Plugin):
|
|||
self.__parent = super(Holidays, self)
|
||||
self.__parent.__init__(irc)
|
||||
|
||||
def easter(self, year):
|
||||
def __ostern(self, year):
|
||||
a = year % 19
|
||||
b = year % 4
|
||||
c = year % 7
|
||||
|
@ -35,28 +35,22 @@ class Holidays(callbacks.Plugin):
|
|||
return date(year, 3, easter_date)
|
||||
|
||||
@internationalizeDocstring
|
||||
def holiday(self, irc, msg, args, holiday_name):
|
||||
"""[<holiday name>]
|
||||
|
||||
Returns the number of days until the next given holiday.
|
||||
def ostern(self, irc, msg, args):
|
||||
"""
|
||||
Returns the number of days until easter.
|
||||
"""
|
||||
|
||||
if holiday_name.lower() != 'ostern':
|
||||
irc.reply('Tut mir leid, ich beherrsche nur Ostern.')
|
||||
return
|
||||
|
||||
# Determine Easter date for current year
|
||||
easter_current_year = self.easter(date.today().year)
|
||||
easter_current_year = self.__ostern(date.today().year)
|
||||
days_remaining = (easter_current_year - date.today()).days
|
||||
# If it has already passed, determine date for next year
|
||||
if days_remaining < 0:
|
||||
easter_next_year = self.easter(date.today().year + 1)
|
||||
easter_next_year = self.__ostern(date.today().year + 1)
|
||||
days_remaining = (easter_next_year - date.today()).days
|
||||
|
||||
if days_remaining == 0:
|
||||
irc.reply('Heute ist Ostersonntag.')
|
||||
else:
|
||||
irc.reply(f'Es sind noch {days_remaining} Tage bis Ostersonntag.')
|
||||
holiday = wrap(holiday, ['text'])
|
||||
ostern = wrap(ostern)
|
||||
|
||||
Class = Holidays
|
||||
|
|
Loading…
Reference in New Issue