0
@client.command(past_context = True)
async def ss(ctx):
    try:
        os.remove("ss.png")
    except:
        pass
    pyautogui.screenshot("ss.png")
    now = datetime.now()
    current_time = now.strftime("%H:%M:%S")
    file = File(filename="ss.png")
    await ctx.send(file=file)

I'm trying to make a discord bot that send a screenshot when .ss is sent in the server i'm useing python 3.8.2 does anyone know a way as i can't find a way anywhere?

1 Answer 1

3
with open(my_filename, "rb") as fh:
    f = discord.File(fh, filename=my_filename)
await ctx.send(file=f)
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for this answer ill try it and if it works ill make it the answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.