So, I am developping a bot on repl.it and I don't understand why my code is not working...
I have a looped async function that is called every 24 hours:
@tasks.loop(hours=24)
async def send_plot():
await bot.wait_until_ready()
if str(datetime.now(tz).strftime('%Y-%m-%d')) not in db['Date']:
append_db('Date', str(datetime.now(tz).strftime('%Y-%m-%d')))
---------------------------------------------------------------------------- # starting here
print('...')
for key in db.keys():
append_db(key, db[key][len(db[key]) - 1])
---------------------------------------------------------------------------- # ending here
plotting()
message_channel = bot.get_channel(int(channel_id))
await message_channel.send(file=discord.File('plot.png'))
So, for an unknown reason nothing is working between those two lines. I was trying to figure it out by myself but I am tired of it cuz nothing rly works. It is some kind of a magic shit happening here...
Here is the append_db function:
def append_db(key, value):
clone = db[key]
clone.append(value)
db[key] = clone
Idk why, but it is the only way it lets me save the information to the repl.it database.