|
|
|
@ -7,21 +7,34 @@ with open("config.toml", "r") as f:
|
|
|
|
|
config = toml.load(f)
|
|
|
|
|
guild_ids=config["bot"]["guild_ids"]
|
|
|
|
|
|
|
|
|
|
with open("cogs/essentials/config.toml", "r") as f:
|
|
|
|
|
esconf = toml.load(f)
|
|
|
|
|
|
|
|
|
|
class EssentialCommands(commands.Cog):
|
|
|
|
|
def __init__(self, bot):
|
|
|
|
|
self.bot = bot
|
|
|
|
|
|
|
|
|
|
@commands.slash_command(guild_ids=guild_ids)
|
|
|
|
|
async def ping(self, ctx):
|
|
|
|
|
if not esconf["commands"]["ping"]:
|
|
|
|
|
await ctx.respond("This command is disabled.")
|
|
|
|
|
return 0
|
|
|
|
|
await ctx.respond('Pong!')
|
|
|
|
|
|
|
|
|
|
@commands.slash_command(guild_ids=guild_ids)
|
|
|
|
|
@option('msg', description="The message to say.")
|
|
|
|
|
async def say(self, ctx, message):
|
|
|
|
|
if not esconf["commands"]["say"]:
|
|
|
|
|
await ctx.respond("This command is disabled.")
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
await ctx.send(message)
|
|
|
|
|
|
|
|
|
|
@commands.slash_command(guild_ids=guild_ids)
|
|
|
|
|
async def serverinfo(self, ctx):
|
|
|
|
|
if not esconf["commands"]["serverinfo"]:
|
|
|
|
|
await ctx.respond("This command is disabled.")
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
await ctx.defer()
|
|
|
|
|
|
|
|
|
@ -45,6 +58,9 @@ class EssentialCommands(commands.Cog):
|
|
|
|
|
@option('ammount', description="The of messages to clear.", required=True)
|
|
|
|
|
@commands.has_permissions(manage_messages=True)
|
|
|
|
|
async def clean(self, ctx, amount: int = 10):
|
|
|
|
|
if not esconf["commands"]["clean"]:
|
|
|
|
|
await ctx.respond("This command is disabled.")
|
|
|
|
|
return 0
|
|
|
|
|
await ctx.defer()
|
|
|
|
|
try:
|
|
|
|
|
await ctx.channel.purge(limit=amount + 1)
|
|
|
|
@ -56,6 +72,9 @@ class EssentialCommands(commands.Cog):
|
|
|
|
|
@commands.slash_command(guild_ids=guild_ids)
|
|
|
|
|
@commands.has_permissions(manage_channels=True)
|
|
|
|
|
async def lock(self, ctx, *, reason=None):
|
|
|
|
|
if not esconf["commands"]["lock"]:
|
|
|
|
|
await ctx.respond("This command is disabled.")
|
|
|
|
|
return 0
|
|
|
|
|
await ctx.defer()
|
|
|
|
|
channel = ctx.channel
|
|
|
|
|
overwrite = channel.overwrites_for(ctx.guild.default_role)
|
|
|
|
@ -68,6 +87,9 @@ class EssentialCommands(commands.Cog):
|
|
|
|
|
@commands.slash_command(guild_ids=guild_ids)
|
|
|
|
|
@commands.has_permissions(manage_channels=True)
|
|
|
|
|
async def unlock(self, ctx, *, reason=None):
|
|
|
|
|
if not esconf["commands"]["unlock"]:
|
|
|
|
|
await ctx.respond("This command is disabled.")
|
|
|
|
|
return 0
|
|
|
|
|
await ctx.defer()
|
|
|
|
|
channel = ctx.channel
|
|
|
|
|
overwrite = channel.overwrites_for(ctx.guild.default_role)
|
|
|
|
@ -80,6 +102,9 @@ class EssentialCommands(commands.Cog):
|
|
|
|
|
@commands.slash_command(guild_ids=guild_ids)
|
|
|
|
|
@commands.has_permissions(manage_channels=True)
|
|
|
|
|
async def lockdown(self, ctx, *, reason=None):
|
|
|
|
|
if not esconf["commands"]["lockdown"]:
|
|
|
|
|
await ctx.respond("This command is disabled.")
|
|
|
|
|
return 0
|
|
|
|
|
await ctx.defer()
|
|
|
|
|
for channel in ctx.guild.channels:
|
|
|
|
|
if isinstance(channel, discord.TextChannel):
|
|
|
|
@ -93,6 +118,9 @@ class EssentialCommands(commands.Cog):
|
|
|
|
|
@commands.slash_command(guild_ids=guild_ids)
|
|
|
|
|
@commands.has_permissions(manage_channels=True)
|
|
|
|
|
async def unlockdown(self, ctx):
|
|
|
|
|
if not esconf["commands"]["unlockdown"]:
|
|
|
|
|
await ctx.respond("This command is disabled.")
|
|
|
|
|
return 0
|
|
|
|
|
await ctx.defer()
|
|
|
|
|
for channel in ctx.guild.channels:
|
|
|
|
|
if isinstance(channel, discord.TextChannel):
|
|
|
|
@ -107,6 +135,9 @@ class EssentialCommands(commands.Cog):
|
|
|
|
|
@commands.slash_command(guild_ids=guild_ids)
|
|
|
|
|
@option('user', description="The username of the user you want the avatars picture incl 1234 numbers", required=True)
|
|
|
|
|
async def avatar(self, ctx, member: discord.Member):
|
|
|
|
|
if not esconf["commands"]["avatar"]:
|
|
|
|
|
await ctx.respond("This command is disabled.")
|
|
|
|
|
return 0
|
|
|
|
|
try:
|
|
|
|
|
avatar_url = member.avatar.url
|
|
|
|
|
except:
|
|
|
|
@ -118,6 +149,9 @@ class EssentialCommands(commands.Cog):
|
|
|
|
|
@commands.slash_command(guild_ids=guild_ids)
|
|
|
|
|
@option('member', description="The username of the user to run the check on.")
|
|
|
|
|
async def whois(self, ctx, member: discord.Member = None):
|
|
|
|
|
if not esconf["commands"]["whois"]:
|
|
|
|
|
await ctx.respond("This command is disabled.")
|
|
|
|
|
return 0
|
|
|
|
|
member = member or ctx.author
|
|
|
|
|
roles = [role.mention for role in member.roles[1:]]
|
|
|
|
|
if not roles:
|
|
|
|
@ -130,6 +164,8 @@ class EssentialCommands(commands.Cog):
|
|
|
|
|
embed.add_field(name="ID", value=member.id, inline=False)
|
|
|
|
|
embed.add_field(name="Account Created", value=member.created_at.strftime("%d/%m/%Y %H:%M:%S"), inline=False)
|
|
|
|
|
embed.add_field(name="Join Date", value=member.joined_at.strftime("%d/%m/%Y %H:%M:%S"), inline=False)
|
|
|
|
|
if not member.activity == None:
|
|
|
|
|
embed.add_field(name="Activity", value=member.activity, inline=False)
|
|
|
|
|
embed.add_field(name="Roles", value=" ".join(roles), inline=False)
|
|
|
|
|
await ctx.send(embed=embed)
|
|
|
|
|
|
|
|
|
@ -140,6 +176,9 @@ class EssentialCommands(commands.Cog):
|
|
|
|
|
@option('footer', description="The lower text.", required=False)
|
|
|
|
|
@option('color', description="The color as a word example: Color: dark_blue", required=False)
|
|
|
|
|
async def embed(self, ctx, title: str, content: str, color: str = None, footer: str = None):
|
|
|
|
|
if not esconf["commands"]["embed"]:
|
|
|
|
|
await ctx.respond("This command is disabled.")
|
|
|
|
|
return 0
|
|
|
|
|
embed = discord.Embed(title=title, description=content)
|
|
|
|
|
|
|
|
|
|
if color:
|
|
|
|
|