@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)
我正在尝试使不和谐的bot在服务器中发送.ss时发送屏幕截图,而我正在使用python 3.8.2,有人知道一种方法,因为我在任何地方都找不到方法?
答案 0 :(得分:0)
with open(my_filename, "rb") as fh:
f = discord.File(fh, filename=my_filename)
await ctx.send(file=f)