From 18f82347350f170bb6aab7cae083e10d0d14edc5 Mon Sep 17 00:00:00 2001 From: Riley Housden Date: Sun, 21 Aug 2022 18:02:53 -0400 Subject: [PATCH] Add Profile Plugin add /avatar command to set bot's avatar. --- ext/profile.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 ext/profile.py diff --git a/ext/profile.py b/ext/profile.py new file mode 100644 index 0000000..3fc56a3 --- /dev/null +++ b/ext/profile.py @@ -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)