#looking for a autodelete function

1 messages · Page 1 of 1 (latest)

jade sage
#

i am currently looking for a autodelete function for my bot if someone has one laying around that i could use that would be great cause i have been trying to make one but i cant wrap my head around the json file and how to save what channel it can clear and such

#

im not really experianced with python yet i am learning

#

i had this code

@bot.event
async def on_ready():
    guilds = bot.guilds
    data = {}
    for guild in guilds:
        data[guild.id] = []
        for channel in guild.channels:
            data[guild.id].append(channel.id)
    with open("result.json", "w") as file:
        json.dump(data, file)
#

that i was fidling around with

#

cause i want to be able to do !setclean 1H

#

and it will clear every message in only that channel after 1 hour