-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathadmin.py
More file actions
28 lines (18 loc) · 786 Bytes
/
admin.py
File metadata and controls
28 lines (18 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from discord.ext import commands
if TYPE_CHECKING:
from discord.ext.commands.context import Context
from ..bot import EmbedFixer
class Admin(commands.Cog):
def __init__(self, bot: EmbedFixer) -> None:
self.bot = bot
async def cog_check(self, ctx: Context) -> bool:
return await self.bot.is_owner(ctx.author)
@commands.command(name="sync")
async def sync_command(self, ctx: commands.Context) -> Any:
message = await ctx.send("Syncing commands...")
synced_commands = await self.bot.tree.sync()
await message.edit(content=f"Synced {len(synced_commands)} commands.")
async def setup(bot: EmbedFixer) -> None:
await bot.add_cog(Admin(bot))