Closed vivekashok1221 closed 2 years ago
description
is optional. @command(name="test1")
async def test1(self, ctx):
embed = EmbedHelper.error(description="description be like")
await ctx.send(embed=embed)
@command(name="test2")
async def test2(self, ctx):
embed = EmbedHelper.error(title="hey", description=" be like description")
await ctx.send(embed=embed)
@command(name="test3")
async def test3(self, ctx):
embed = EmbedHelper.error(description="link ^", url='https://www.youtube.com/')
await ctx.send(embed=embed)
@command(name="test4")
async def test4(self, ctx):
fields = ({"name": "hi", "value": "bye"}, {"name": "bye", "value": "hi"})
embed = EmbedHelper.information(title="hi", description="check my fields out", fields=fields)
await ctx.send(embed=embed)
@command(name="test5")
async def test5(self, ctx):
fields = (
{"name": "hi", "value": "bye", "inline": True},
{"name": "bye", "value": "hi", "inline": True}
)
embed = EmbedHelper.information(description="Fields can be inline", fields=fields)
await ctx.send(embed=embed)
I don't think @gustavwilliam (Vestergurkan) is a fan of Embedhelper.category()
and prefers the category to be passed in as an argument.
I'm free to making changes.
I don't think @gustavwilliam (Vestergurkan) is a fan of
Embedhelper.category()
and prefers the category to be passed in as an argument.
Yep. I want it to be dynamic, without having to use getattr if you want to pass the embed type easily.
- [ ] Make the embed deletable or non-deletable based on a
no-delete
parameter.- [ ] Make the embed message mention a role or user specified, or the user invoking the command otherwise.
These features require the message to be sent in the first place. This means that we will need to use a separate helper for sending embeds or subclassing Messagable.send
.
I am thinking of doing the former. Perhaps I shall subclass discord.Embed
and add attributes which specifies which users to mention and whether the embed has to be deleted.
I don't think @gustavwilliam (Vestergurkan) is a fan of
Embedhelper.category()
and prefers the category to be passed in as an argument.Yep. I want it to be dynamic, without having to use getattr if you want to pass the embed type easily.
By dynamic, I have come to understand that you should be able to do this:
category = "warning" if error else "info"
However, the description has to be passed in too and it will actually end up looking something like
category = "warning" if error else "info"
if category = "warning":
descripition = "Hi."
else:
description = "Bye."
embed = embed_helper(description=description)
or
category = "warning" if error else "info"
if category = "warning":
descripition = "Hi." if category = "warning" else "bye"
embed = embed_helper(description=description)
Therefore, it isn't as dynamic in my eyes.
I'm proposing that we shall be able to do the following:
if error:
embed = EmbedHelper.error("Bye.")
else:
embed = EmbedHelper.information("Hi.")
rather than
category = "error" if error else "info"
if category = "error":
descripition = "Bye."
else:
description = "Hi."
embed = embed_helper(description=description)
That was simply an example of something you could do. Let's take the gurkanrate as an example. In it, the description will always be the same and the title will change.
It would be nice to just set the title and then automatically get the right embed.
That was simply an example of something you could do. Let's take the gurkanrate as an example. In it, the description will always be the same and the title will change.
It would be nice to just set the title and then automatically get the right embed.
The description will still need to be passed in since the helper is a general method and does not know what it will be used for.
Hi @codephile1221, is there any progress on this?
Hello. This PR is by no means the finished feature. I feel the need to discuss some things before proceeding.
Here are some of the things which I feel this PR should address.
[ ] Provide an easy and consistent way for the developer to create embeds. This is to be achieved by providing default title and embed colors to ensure that the embeds issued are consistent. Embed categories:
[ ] Make the embed deletable or non-deletable based on a
no-delete
parameter.[ ] Make the embed message mention a role or user specified or the user invoking the command otherwise.
TODO:
[ ] Better doc strings (It will probably be useful as IDE tooltips).
[ ] Make the embed deletable or non-deletable based on a
no-delete
parameter.[ ] Make the embed message mention a role or user specified, or the user invoking the command otherwise.