Skip to content

Commit

Permalink
fixed time setting (local time = utcnow + 2h instead of utcnow+1h)
Browse files Browse the repository at this point in the history
  • Loading branch information
LuminatiHD committed Jun 21, 2022
1 parent 20236ac commit 32d2891
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Briefing/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})")
Expand Down
2 changes: 1 addition & 1 deletion Buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion FuncLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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...")

Expand Down
2 changes: 1 addition & 1 deletion Items/searchItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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<?", (timeset,))
database.commit()

Expand Down
2 changes: 1 addition & 1 deletion Items/specialcmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def recommend(self, ctx:Context):

if not suggestion.lower().replace(" ", "") in ["ligma", "sugma", "you suck", "u suck", "ligmaballs"]:
confirm = await ctx.channel.send("Wird eingetragen...")
time = datetime.utcnow()+timedelta(hours=1)
time = datetime.utcnow()+timedelta(hours=2)
time = f"{time.hour:02}:{time.minute:02}:{time.second:02}, {time.day:02}.{time.month:02}.{str(time.year)[-2::]}"
# ds {time.x:02} isch eifach nur da für weme z.B. ä uhrzit vo 9:16:1 het, dass drus när 09:16:1 wird.
# So isch ds Layout nicer.
Expand Down
2 changes: 1 addition & 1 deletion Mensa/Webscraping.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def menuoutput(output):
menuselect = 1
output = []

if (datetime.utcnow()+timedelta(hours=1)).time() > 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()

Expand Down
6 changes: 3 additions & 3 deletions Mensa/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions News/news_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}."
Expand Down
6 changes: 3 additions & 3 deletions Stundenplan/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ 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]))


@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)
Expand Down Expand Up @@ -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))


Expand Down

0 comments on commit 32d2891

Please sign in to comment.