modified: bot.py
This commit is contained in:
13
bot.py
13
bot.py
@@ -368,7 +368,7 @@ async def startgiveaway(ctx, platform: str, prize: str, num_winners: int, title:
|
|||||||
description=f"{subtitle}\n\nPrize: {prize}\nPlatform: {platform}\nNumber of winners: {num_winners}\nEnds in: {duration}",
|
description=f"{subtitle}\n\nPrize: {prize}\nPlatform: {platform}\nNumber of winners: {num_winners}\nEnds in: {duration}",
|
||||||
color=0x00ff00
|
color=0x00ff00
|
||||||
)
|
)
|
||||||
embed.set_footer(text=f"Giveaway endet am {end_time.strftime('%Y-%m-%d %H:%M:%S')}")
|
embed.set_footer(text=f"Giveaway endet at {end_time.strftime('%Y-%m-%d %H:%M:%S')}")
|
||||||
await ctx.send(embed=embed, view=view)
|
await ctx.send(embed=embed, view=view)
|
||||||
|
|
||||||
check_giveaway.start(giveaway_id)
|
check_giveaway.start(giveaway_id)
|
||||||
@@ -378,7 +378,8 @@ async def check_giveaway(giveaway_id):
|
|||||||
"""Checks every 1 minute to see if the giveaway has ended."""
|
"""Checks every 1 minute to see if the giveaway has ended."""
|
||||||
giveaway = giveaways.get(giveaway_id)
|
giveaway = giveaways.get(giveaway_id)
|
||||||
|
|
||||||
if giveaway and giveaway.is_finished():
|
if giveaway:
|
||||||
|
if giveaway.is_finished():
|
||||||
check_giveaway.stop()
|
check_giveaway.stop()
|
||||||
|
|
||||||
winners = giveaway.pick_winners()
|
winners = giveaway.pick_winners()
|
||||||
@@ -397,6 +398,14 @@ async def check_giveaway(giveaway_id):
|
|||||||
await giveaway.ctx.send(f"The giveaway '{giveaway.title}' has ended, but there were no participants.")
|
await giveaway.ctx.send(f"The giveaway '{giveaway.title}' has ended, but there were no participants.")
|
||||||
|
|
||||||
del giveaways[giveaway_id]
|
del giveaways[giveaway_id]
|
||||||
|
else:
|
||||||
|
# Berechne die verbleibende Zeit
|
||||||
|
remaining_time = giveaway.remaining_time()
|
||||||
|
|
||||||
|
# Aktualisiere die Embed-Nachricht mit der verbleibenden Zeit
|
||||||
|
embed = giveaway.message.embeds[0]
|
||||||
|
embed.set_footer(text=f"Giveaway ends in: {str(remaining_time).split('.')[0]}")
|
||||||
|
await giveaway.message.edit(embed=embed)
|
||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
async def on_interaction(interaction):
|
async def on_interaction(interaction):
|
||||||
|
|||||||
Reference in New Issue
Block a user