diff --git a/misskaty/helper/tools.py b/misskaty/helper/tools.py index 0df86028..aa339510 100644 --- a/misskaty/helper/tools.py +++ b/misskaty/helper/tools.py @@ -176,7 +176,7 @@ def isValidURL(str): @asyncify def gen_trans_image(source, path): # load image - img = cv2.imread(spurce) + img = cv2.imread(source) # convert to graky gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) diff --git a/misskaty/plugins/misc_tools.py b/misskaty/plugins/misc_tools.py index 40e98825..d4993c3d 100644 --- a/misskaty/plugins/misc_tools.py +++ b/misskaty/plugins/misc_tools.py @@ -179,9 +179,11 @@ async def removebg(_, ctx: Client): return await ctx.reply_msg("Please reply image.") if not ctx.reply_to_message.photo: return await ctx.reply_msg("Only support photo for remove background.") + prg = await ctx.reply("Processing...") source = await ctx.reply_to_message.download() await gen_trans_image(ctx.reply_to_message, f"transp_bckgrnd-{ctx.from_user.id}.png") await ctx.reply_photo(f"transp_bckgrnd-{ctx.from_user.id}.png") + await prg.delete_msg() os.remove(source) os.remove(f"transp_bckgrnd-{ctx.from_user.id}.png")