From 32d289140bea7a14cd908f31d43fd0a50d661854 Mon Sep 17 00:00:00 2001 From: LuminatiHD Date: Tue, 21 Jun 2022 14:17:50 +0200 Subject: [PATCH] fixed time setting (local time = utcnow + 2h instead of utcnow+1h) --- Briefing/main.py | 2 +- Buttons.py | 2 +- FuncLibrary.py | 2 +- Items/searchItem.py | 2 +- Items/specialcmds.py | 2 +- Mensa/Webscraping.py | 2 +- Mensa/main.py | 6 +++--- News/news_scraper.py | 4 ++-- Stundenplan/main.py | 6 +++--- main.py | 6 +++--- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Briefing/main.py b/Briefing/main.py index 2c173a4..abcee1b 100644 --- a/Briefing/main.py +++ b/Briefing/main.py @@ -76,7 +76,7 @@ def setup(client): def outputbriefing(user, ef, sf, kf, mint): weekdays = FuncLibrary.weekdays - today = (datetime.utcnow()+timedelta(hours=1)) + today = (datetime.utcnow()+timedelta(hours=2)) output = nextcord.Embed(title=f"{weekdays[today.weekday()]}, " f"{today.day}.{today.month}.{str(today.year)[2:]} " f"({today.hour}:{today.minute:02})") diff --git a/Buttons.py b/Buttons.py index 6330515..5bff51a 100644 --- a/Buttons.py +++ b/Buttons.py @@ -525,7 +525,7 @@ def __init__(self, ctx, day=None, month=None, year=None): self.month = month self.year = year - today = (datetime.utcnow()+timedelta(hours=1)) + today = (datetime.utcnow()+timedelta(hours=2)) dayselect = DayDropdown(self, self.day) dayselect.custom_id = "day" diff --git a/FuncLibrary.py b/FuncLibrary.py index 2d6fde9..b69e678 100644 --- a/FuncLibrary.py +++ b/FuncLibrary.py @@ -225,7 +225,7 @@ def outputbriefing(user, ef, sf, kf, mint): async def covid_embed(channel, delete_after): - now = datetime.utcnow() + timedelta(hours=1) + now = datetime.utcnow() + timedelta(hours=2) output = await channel.send("Get covid data...") diff --git a/Items/searchItem.py b/Items/searchItem.py index d90eeb0..9e26510 100644 --- a/Items/searchItem.py +++ b/Items/searchItem.py @@ -29,7 +29,7 @@ def __init__(self, bot: commands.Bot): ) async def todo(self, ctx: Context): # aui Elemänt wo scho düre si wärde glöschet. - timeset = str((datetime.datetime.utcnow()+datetime.timedelta(hours=1)).date()) + timeset = str((datetime.datetime.utcnow()+datetime.timedelta(hours=2)).date()) database.cursor().execute(f"DELETE FROM {Itemtable} WHERE datum time(hour=14, minute=30) and weekday <5: + if (datetime.utcnow()+timedelta(hours=2)).time() > time(hour=14, minute=30) and weekday <5: menuselect=2 weekday = (date.today()+timedelta(1)).weekday() diff --git a/Mensa/main.py b/Mensa/main.py index fe3f5ad..5fd280f 100644 --- a/Mensa/main.py +++ b/Mensa/main.py @@ -15,9 +15,9 @@ def __init__(self, bot): @commands.command(name="menu", aliases=["Menu", "m", "M"], help="Gibt das heutige Menu in der Mensa zurück") async def menu(self, ctx:Context): - datum = (datetime.utcnow()+timedelta(hours=1)).date() + datum = (datetime.utcnow()+timedelta(hours=2)).date() - if (datetime.utcnow()+timedelta(hours=1)).time() > time(hour=14, minute=30): + if (datetime.utcnow()+timedelta(hours=2)).time() > time(hour=14, minute=30): datum = datum + timedelta(1) if datum.weekday() > 4: @@ -45,7 +45,7 @@ async def menu(self, ctx:Context): @commands.command(name = "wochenplan", aliases=["Wochenplan", "wp", "WP"], help="Gibt das Menu der momentanen Woche zurück") async def weekly(self, ctx:Context): - datum = (datetime.utcnow()+timedelta(hours=1)).date() + datum = (datetime.utcnow()+timedelta(hours=2)).date() output = await ctx.channel.send("Einen Moment...") weekm = await Webscraping.menuweekly(output) diff --git a/News/news_scraper.py b/News/news_scraper.py index 09b10da..83d76c8 100644 --- a/News/news_scraper.py +++ b/News/news_scraper.py @@ -38,7 +38,7 @@ def get_news(select, pool): async def post_news(bot, delete_after:timedelta, ctx=None): - now = datetime.utcnow()+timedelta(hours=1) + now = datetime.utcnow()+timedelta(hours=2) rolle = "" if not ctx: channel = bot.get_channel(688135334277414977) @@ -67,7 +67,7 @@ async def post_news(bot, delete_after:timedelta, ctx=None): f"{now.year}" f" ({now.hour}:{now.minute} Uhr)", view=select) - while datetime.utcnow()+timedelta(hours=1) < now + delete_after: + while datetime.utcnow()+timedelta(hours=2) < now + delete_after: select = Buttons.Select_article(articles_short) await output.edit(content=f"{rolle} news vom " f"{now.day}." diff --git a/Stundenplan/main.py b/Stundenplan/main.py index 4f8e020..8d4817d 100644 --- a/Stundenplan/main.py +++ b/Stundenplan/main.py @@ -25,7 +25,7 @@ def __init__(self, bot): @commands.command(name="nextlesson", aliases=["nl"], help="Gibt einem die nächste Lektion zurück, falls heue noch welche anstehen.") async def next(self, ctx:Context): - tag = datetime.utcnow()+timedelta(hours=1) + tag = datetime.utcnow()+timedelta(hours=2) zeit = tag.time() sf, ef, kf, mint= access(ctx.author) @@ -45,7 +45,7 @@ async def next(self, ctx:Context): zeit = output[1].split("-")[0] zeit = datetime.combine(date.today(), time(int(zeit.split(":")[0]), int(zeit.split(":")[1])))-\ - (datetime.utcnow()+timedelta(hours=1)) + (datetime.utcnow()+timedelta(hours=2)) hours = zeit.seconds//3600 minutes = (zeit.seconds//60)%60 @@ -68,7 +68,7 @@ async def next(self, ctx:Context): @commands.command(name = "tagesplan", aliases = ["t", "T"], help="Gibt alle heutigen Lektionen zurück.") async def day(self, ctx:Context): table = "Stundenplan_23b" - currdate = ((datetime.utcnow()+timedelta(hours=1))+timedelta(hours=24-17)).date() + currdate = ((datetime.utcnow()+timedelta(hours=2))+timedelta(hours=24-17)).date() tag = currdate.weekday() if tag>4: diff --git a/main.py b/main.py index 25d5907..f6640ab 100644 --- a/main.py +++ b/main.py @@ -68,7 +68,7 @@ async def briefing(): weekdays = ["mo", "di", "mi", "do", "fr", "sa", "so"] users = cs.execute(f"SELECT user_id, sf, ef, kf, mint FROM briefing WHERE "\ f"{weekdays[zeit.weekday()]} LIKE ?", - (f"%{(datetime.utcnow()+timedelta(hours=1)).hour:02}:00%",)) + (f"%{(datetime.utcnow()+timedelta(hours=2)).hour:02}:00%",)) if users: for user in users: await client.get_user(user[0]).send(embed=main.outputbriefing(client.get_user(user[0]), user[1], user[2], user[3], user[4])) @@ -76,7 +76,7 @@ async def briefing(): @tasks.loop(hours=6) async def covid(): - zeit = (datetime.utcnow()+timedelta(hours=1)).time() + zeit = (datetime.utcnow()+timedelta(hours=2)).time() if TEST_OR_MAIN == "0" and zeit.hour%8==0 and zeit.minute<30: covid_channel = client.get_guild(688050375747698707).get_channel(929704436538933278) await FuncLibrary.covid_embed(covid_channel, 3600*24*2) @@ -109,7 +109,7 @@ async def remind_task(): @tasks.loop(hours=1) async def news(): - if (datetime.utcnow()+timedelta(hours=1)).hour == 10: + if (datetime.utcnow()+timedelta(hours=2)).hour == 10: await news_scraper.post_news(client, timedelta(days=1))