This repository was archived by the owner on Jul 23, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeveloper.py
More file actions
39 lines (30 loc) · 1.21 KB
/
developer.py
File metadata and controls
39 lines (30 loc) · 1.21 KB
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
29
30
31
32
33
34
35
36
37
38
39
from discord import TextChannel
from discord.ext.commands import Bot, Cog, Context, command
class DeveloperCog(Cog, name='Developer'):
def __init__(self, bot: Bot):
self.bot = bot
async def cog_check(self, ctx: Context) -> bool:
return await self.bot.is_owner(ctx.author)
@command()
async def load(self, ctx: Context, extension: str) -> None:
"""Loads an extension"""
self.bot.load_extension(extension)
await ctx.message.add_reaction('✅')
@command()
async def unload(self, ctx: Context, extension: str) -> None:
"""Unloads an extension"""
self.bot.unload_extension(extension)
await ctx.message.add_reaction('✅')
@command(name='reload')
async def reload_(self, ctx: Context, extension: str) -> None:
"""Reloads an extension"""
self.bot.reload_extension(extension)
await ctx.message.add_reaction('✅')
@command()
async def say(
self, ctx: Context, channel: TextChannel, *, message: str
) -> None:
await channel.send(message)
await ctx.message.add_reaction('✅')
def setup(bot: Bot) -> None:
bot.add_cog(DeveloperCog(bot))