async def playertoken(self, ctx, *args): """ Generates and sends a token for use on VTTs. __Valid Arguments__ -border <gold|plain|none> - Chooses the token border. """ char: Character = await Character.from_ctx(ctx) if not char.image: return await ctx.send("This character has no image.") token_args = argparse(args) ddb_user = await self.bot.ddb.get_ddb_user(ctx, ctx.author.id) is_subscriber = ddb_user and ddb_user.is_subscriber try: processed = await img.generate_token(char.image, is_subscriber, token_args) except Exception as e: return await ctx.send(f"Error generating token: {e}") file = discord.File(processed, filename="image.png") embed = EmbedWithCharacter(char, image=False) embed.set_image(url="attachment://image.png") await ctx.send(file=file, embed=embed) processed.close()
async def playertoken(self, ctx): """Generates and sends a token for use on VTTs.""" char: Character = await Character.from_ctx(ctx) color_override = char.get_setting('color') if not char.image: return await ctx.send("This character has no image.") try: processed = await generate_token(char.image, color_override) except Exception as e: return await ctx.send(f"Error generating token: {e}") file = discord.File(processed, filename="image.png") embed = EmbedWithCharacter(char, image=False) embed.set_image(url="attachment://image.png") await ctx.send(file=file, embed=embed)
async def playertoken(self, ctx): """Generates and sends a token for use on VTTs.""" char: Character = await Character.from_ctx(ctx) if not char.image: return await ctx.send("This character has no image.") ddb_user = await self.bot.ddb.get_ddb_user(ctx, ctx.author.id) is_subscriber = ddb_user and ddb_user.subscriber try: processed = await generate_token(char.image, is_subscriber) except Exception as e: return await ctx.send(f"Error generating token: {e}") file = discord.File(processed, filename="image.png") embed = EmbedWithCharacter(char, image=False) embed.set_image(url="attachment://image.png") await ctx.send(file=file, embed=embed) processed.close()