embeds
Embeds module adds some pre-configured embeds to streamline the creation of your help command.
MAX_CHARS_PER_FIELD = 1024
module-attribute
¶
Set the max and default character limit per embed field.
This is a Discord limitation, so we use this for chunking command description lines for the overview embed(s) which allow us to split into multiple fields within a single embed.
Notes
I do not recommend exceeding 400 characters as this can create very tall embeds.
MAX_FIELDS_PER_EMBED = 25
module-attribute
¶
Set the max and default field per embed.
Discord limits this to 25, so that's what has been set as the max here as well.
command_detail_embed(command, *, thumbnail_url=None, guild=None, color=None)
¶
Create and return an embed showing command details.
Parameters:
-
command
(AppCommand
) –The
AppCommand
retrieved fromAppCommandHelp.get_command_named
-
thumbnail_url
(Optional[str]
, default:None
) –The image's URL. - changed in 0.5.0 - thumbnail -> thumbnail_url
-
guild
(Optional[Guild]
, default:None
) –Guild where this embed will be displayed. Used to convert any role checks into role objects
-
color
(Optional[Color]
, default:None
) –Set the color the embed. Default is None
Examples:
from disnake.ext.app_command_help import AppCommandHelp, utils
...
app_command_help = AppCommandHelp(bot)
...
command = app_command_help.get_command_named(name)
embed = utils.command_detail_embed(command, guild=inter.guild)
await inter.response.send_message(embed=embed)
Returns:
-
Embed
–The created embed containing the command details.
Source code in src\helply\utils\embeds.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
commands_overview_embeds(commands, *, thumbnail_url=None, max_field_chars=MAX_CHARS_PER_FIELD, max_fields=MAX_FIELDS_PER_EMBED, color=None, category='')
¶
Create and return one or more embeds containing all commands and descriptions.
Parameters:
-
commands
(List[AppCommand]
) –List of
AppCommand
received fromAppCommandHelp.get_all_commands
-
thumbnail_url
(Optional[str]
, default:None
) –The image's URL. - changed in 0.5.0 - thumbnail -> thumbnail_url
-
max_field_chars
(int
, default:MAX_CHARS_PER_FIELD
) –Max number of characters per embed field description, default is MAX_CHARS_PER_FIELD (1024)
-
max_fields
(int
, default:MAX_FIELDS_PER_EMBED
) –Max number of fields per embed. default is MAX_FIELDS_PER_EMBED (10)
-
color
(Optional[Color]
, default:None
) –Set the color the embed(s). Default is None
Examples:
from disnake.ext.app_command_help import AppCommandHelp, utils
...
app_command_help = AppCommandHelp(bot)
...
commands = app_command_help.get_all_commands(inter.guild)
embeds = utils.commands_overview_embeds(commands)
await inter.response.send_message(embeds=embeds)
Returns:
-
List[Embed]
–A list of disnake.Embed containing an overview of the commands.
Source code in src\helply\utils\embeds.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
|