Add Profile Plugin
add /avatar command to set bot's avatar.
This commit is contained in:
parent
6f3ebbd45d
commit
18f8234735
1 changed files with 24 additions and 0 deletions
24
ext/profile.py
Normal file
24
ext/profile.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
import hikari
|
||||
import lightbulb
|
||||
|
||||
plugin = lightbulb.Plugin("ProfilePlugin")
|
||||
|
||||
|
||||
@plugin.command
|
||||
@lightbulb.option("img", "image to set as new avatar", type=hikari.Attachment, required=True)
|
||||
@lightbulb.add_checks(lightbulb.owner_only)
|
||||
@lightbulb.command("avatar", "set the bot avatar.", ephemeral=True)
|
||||
@lightbulb.implements(lightbulb.SlashCommand)
|
||||
async def set_avatar(ctx: lightbulb.Context) -> None:
|
||||
await ctx.bot.rest.edit_my_user(avatar=ctx.options.img)
|
||||
embed = hikari.Embed(title="New avatar set!")
|
||||
embed.set_image(ctx.options.img)
|
||||
await ctx.respond(embed)
|
||||
|
||||
|
||||
def load(bot: lightbulb.BotApp):
|
||||
bot.add_plugin(plugin)
|
||||
|
||||
|
||||
def unload(bot: lightbulb.BotApp):
|
||||
bot.remove_plugin(plugin)
|
Loading…
Reference in a new issue