Reputation:
@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?
Upvotes: 0
Views: 7683
Reputation: 1501
with open(my_filename, "rb") as fh:
f = discord.File(fh, filename=my_filename)
await ctx.send(file=f)
Upvotes: 3