Plugin
Plugin
#
Plugins include commands and components and provide bot, client, and etc.
Attributes:
-
name
(str
) –The plugin name.
-
guild
(SnowflakeishOr[PartialGuild] | UndefinedType
) –Optional guild (server) where the plugin is available.
-
default_member_permissions
(Permissions
) –The permissions a user must have to use the plugin by default.
-
dm_enabled
(bool
) –Whether the plugin can be used in direct messages.
-
is_nsfw
(bool
) –Indicates whether the plugin is age-restricted.
-
included
(Dict[str, Includable]
) –Included objects of plugin.
-
events
(List[Event]
) –Events of plugin.
Example
plugin = Plugin(
"Admin Plugin",
default_member_permissions=Permissions.ADMINISTRATOR
)
@plugin.include
class BanHammerCommand(SlashCommand):
def __init__(self) -> None:
super().__init__(
name="ban",
options=[
Option(
type=OptionType.USER,
name="target",
description="Who was bad today?"
)
]
)
async def callback(self, context: InteractionContext, target: InteractionMember | User) -> None:
await context.guild.ban(target)
return await context.create_response("**@{target.username}** was ban hammered!")