title: DISCORD.PY How to stop giveaway without asyncio.sleep
body: <p>I need to &quot;sleep&quot; the giveaway without the <code>asyncio.sleep</code> , because if the bot goes off it wont continue where it left (i know i need to store the other data as well , however time is needed for this one)
  here is the code again :</p>
  <pre class="lang-py prettyprint-override"><code>import aiosqlite
  import time
  import datetime
  import discord
  from discord.ext import commands
  import asyncio
  import os
  import random
  
  class Start(commands.Cog):
      def __init__(self, client):
          self.client = client
  
      def convert(self, timer):
          pos = [&quot;s&quot;, &quot;m&quot;, &quot;h&quot;, &quot;d&quot;]
          time_dict = {&quot;s&quot; : 1, &quot;m&quot; : 60, &quot;h&quot; : 3600, &quot;d&quot; : 3600*24}
          unit = timer[-1]
  
          if unit not in pos:
              return -1
          try:
              val = int(timer[:-1])
          except:
              return -2
  
          return val * time_dict[unit]
      
      @commands.command()
      async def start(self, ctx, duration, winners: str, *, prize):
  
        timer = (self.convert(duration))
        winners = int(winners.replace(&quot;w&quot;,&quot;&quot;))
        await ctx.message.delete()
  
        timestamp = time.time() + timer
        epoch_time = int((time.time() + timer))
  
        embed = discord.Embed(title = f&quot;{prize}&quot;, description = f'React with  to enter\nEnds: &lt;t:{epoch_time}:R&gt; (&lt;t:{epoch_time}&gt;)\nHosted by {ctx.author.mention}\n', color = 
        ctx.author.color, timestamp=(datetime.datetime.utcfromtimestamp(timestamp)))
        embed.set_footer(text=f'Winners : {winners} | Ends at \u200b')
        gaw_msg = await ctx.send(content = &quot;&lt;:spadess:939938117736091678&gt; **GIVEAWAY** &lt;:spadess:939938117736091678&gt;&quot;,embed=embed)
  
        await gaw_msg.add_reaction(&quot;&quot;) 
  
        db = await aiosqlite.connect(&quot;main.db&quot;)
        cursor = await db.cursor()
        await cursor.execute(f'SELECT * FROM storingStuff WHERE msgID = {gaw_msg.id}')
        data = await cursor.fetchone()
  
        if data is None:
          await cursor.execute(f'INSERT INTO storingStuff (msgID, guildID) VALUES({gaw_msg.guild.id} , {gaw_msg.id})')
          await db.commit()
  
        await asyncio.sleep(timer)
              
        new_msg = await ctx.channel.fetch_message(gaw_msg.id)
        users_mention = []     
        for i in range(winners):
              users = await new_msg.reactions[0].users().flatten()
              users.pop(users.index(self.client.user))
              winner = random.choice(users)
              users_mention.append(winner.mention)
              users.remove(winner)
  
              displayed_winners = &quot;,&quot;.join(users_mention)
  
        endembed = discord.Embed(title=f&quot;{prize}&quot;, description=f&quot;Winner: {displayed_winners}\nHosted by: {ctx.author.mention}&quot;, color = ctx.author.color, timestamp=(datetime.datetime.utcfromtimestamp(timestamp)))
        endembed.set_footer(text= 'Ended at \u200b')
        await gaw_msg.edit(content = &quot;&lt;:done:939940228746072096&gt; **GIVEAWAY ENDED** &lt;:done:939940228746072096&gt;&quot;,embed=endembed)
        await ctx.send(f&quot;Congragulations {displayed_winners}! You won the **{prize}**.\n{gaw_msg.jump_url}&quot;)
  
  def setup(client):
      client.add_cog(Start(client))
  </code></pre>
  <p>Any help is appreciated</p>