def textPlain(text, size, font='times.ttf', x=100, y=200, xsize=1280, ysize=720): im = Image.new('RGB', (xsize, ysize), color=(255, 255, 255)) draw = ImageDraw.Draw(im) font = ImageFont.truetype(font, int(size)) draw.text((x, y), text, font=font, fill=(0, 0, 0, 255)) _path = TempFile.generatePath('png') im.save(_path) return _path
def textPlain(text, size, font='times.ttf', x=100, y=200, xsize=1280, ysize=720): im = Image.new('RGB', (xsize, ysize), color=(255, 255, 255)) draw = ImageDraw.Draw(im) font = ImageFont.truetype(font, int(size)) draw.text((x, y), text, font=font, fill=(0, 0, 0, 255)) _path = TempFile.generatePath('png') im.save(_path) return _path
def execute(bot, data, forward=True): args = { "peer_id": data['peer_id'], "v": "5.60", } if forward: args.update({"forward_messages": data['message_id']}) im = ImageGrab.grab() pt = TempFile.generatePath('jpg') im.save(pt) att = bot.UploadFromDisk(pt) os.remove(pt) args['attachment'] = att bot.Replyqueue.put(args)