I have say
command that works fine, replying with a message I provide in it. However, I want to change the code to support custom embed body message as well.
Basically, my question is: How can I make my say
command reply with message OR custom Embed body message?
My say
command
@commands.command(name='say', aliases=['repeat', 'talk'])
@commands.has_permissions(manage_messages=True)
async def _say(self, ctx, *, message):
await ctx.send(message, ctx)
What I want my command to be able to do is...
Example:
-say {embed=discord.Embed(title="Test", description="Embed Example")
embed.set_author(name="Author", url="https://authorlink.com", icon_url="https://authoricon.com")
embed.set_thumbnail(url="https://thumbnail.png")
embed.add_field(name="Field 1", value="Field test 1", inline=True)
embed.add_field(name="Field 2", value="Field test 2", inline=False)
embed.set_footer(text=ctx.guild.name)
await ctx.send(embed=embed)}
Does anyone know how to make the code to send custom embed body message as well? I understand Embed and how to form it. Now, I just want my command be able to say both custom embed and custom message. I hope it makes sense what my idea is.
- Edit: This is what I got for embed (as separated command)
(This way I cannot customize the entire embed, but only the value of the field provided in the code. I'm looking for a way to make it fully custom, if possible, and merging it with one command only, for embed and normal message)_
@commands.command(name="sayembed")
@commands.has_permissions(manage_messages=True)
async def _saye(self, ctx, *, message):
embedsay = discord.Embed(color=ctx.author.color, timestamp=ctx.message.created_at)
embedsay.set_author(name="Message from:", icon_url=ctx.author.avatar_url)
embedsay.add_field(name=ctx.message.author, value=str(message))
embedsay.set_thumbnail(url=ctx.author.avatar_url)
embedsay.set_footer(text=ctx.guild.name)
await ctx.send(embed=embedsay)
-say
command can send both kinds of message. If it's not possible, I guess I'd be satisfied with separate command for embed, probably as-sayembed
or something. – xscriptxdata