1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2025-01-19 14:25:18 +00:00
modufur/commands/master.py

38 lines
1.2 KiB
Python
Raw Normal View History

2022-02-21 01:10:57 -06:00
import os
2022-02-21 14:53:53 -06:00
2022-02-21 01:10:57 -06:00
import lightbulb
2022-02-21 14:53:53 -06:00
plugin = lightbulb.Plugin("master")
2022-02-21 01:10:57 -06:00
@plugin.command
2022-02-21 14:53:53 -06:00
@lightbulb.option("command", "What is your command, master?", required=False, choices=("reload", "sleep"))
@lightbulb.command("master", "Commands my master can demand of me", ephemeral=True)
2022-02-21 01:10:57 -06:00
@lightbulb.implements(lightbulb.SlashCommand)
async def master(context):
if context.user.id == context.bot.application.owner.id:
match context.options.command:
2022-02-21 14:53:53 -06:00
case "reload":
2022-02-21 01:10:57 -06:00
context.bot.reload_extensions(*context.bot.extensions)
extensions = [os.path.splitext(extension)[1][1:] for extension in context.bot.extensions]
2022-02-21 14:53:53 -06:00
await context.respond(
f'**Reloaded `{"`, `".join(extensions[:-1])}`, and `{extensions[-1]}` for you, master.**'
)
case "sleep":
await context.respond("**Goodnight, master.**")
2022-02-21 01:10:57 -06:00
await context.bot.close()
case _:
2022-02-21 14:53:53 -06:00
await context.respond(f"**Hello, master.**")
2022-02-21 01:10:57 -06:00
else:
2022-02-21 14:53:53 -06:00
await context.respond(f"**{context.bot.application.owner.mention} is my master. 🐺**")
2022-02-21 01:10:57 -06:00
def load(bot):
bot.add_plugin(plugin)
2022-02-21 14:53:53 -06:00
2022-02-21 01:10:57 -06:00
def unload(bot):
bot.remove_plugin(plugin)