From 2246fa7da4532b370b73202cf4729f0f0448299b Mon Sep 17 00:00:00 2001 From: ionburger Date: Sun, 16 Oct 2022 13:24:16 -0600 Subject: [PATCH] a --- bot.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bot.py b/bot.py index 854b22f..c05424f 100644 --- a/bot.py +++ b/bot.py @@ -1,9 +1,10 @@ import discord -import time import datetime +import time import configparser import random from discord.ext import tasks, commands +quotetime = datetime.time.fromisoformat("02:25:01") intents = discord.Intents.all() client = discord.Client(intents=intents) avgtimelst = [] @@ -81,7 +82,7 @@ async def on_message(message): print("\n end client.event \n time: " + str(reventime) + "\n average time: " + avgtime) -@tasks.loop(seconds=5,reconnect=True) +@tasks.loop(time=quotetime,reconnect=True) async def dailyquote(): if quotebotconf["config"]["enabled"] == "true": file = open("data/quotes.var","r+") @@ -89,9 +90,9 @@ async def dailyquote(): rand = random.randint(0, (len(list)-1)) print(rand) channel = client.get_channel(int(quotebotconf["config"]["dailyquote"])) - await channel.send(list[rand]) - list.remove(rand) - file.write(list) + await channel.send(list.pop(rand)) + file.write(":".join(list)) + file.close() client.run(botconf["config"]["token"])