app/cogs/deranged_commands.py
2024-06-27 17:07:10 -04:00

35 lines
1.5 KiB
Python

import discord
from discord import app_commands
from discord.ext import commands
import os
import util
class DerangedCommands(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
@app_commands.command(name="get-token", description="Get my token :3")
@app_commands.allowed_installs(guilds=False, users=True)
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
async def token(self, interaction: discord.Interaction) -> None:
embed = discord.Embed()
embed.title = "My token"
embed.description = os.getenv("TOKEN") if util.is_owner(interaction.user.id) else "[object Object]"
embed.color = 0x00EAFF
await interaction.response.send_message(embed=embed, ephemeral=True)
@app_commands.command(name="sync", description="This will sync slash commands")
@app_commands.allowed_installs(guilds=False, users=True)
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
async def sync(self, interaction: discord.Interaction) -> None:
if not util.is_owner(interaction.user.id):
await interaction.response.send_message(embed=util.fuckoff_embed)
return
await self.bot.tree.sync()
embed = discord.Embed()
embed.description = ":white_check_mark: Synced slash commands"
embed.color = util.success
await interaction.response.send_message(embed=embed, ephemeral=True)
async def setup(bot: commands.Bot) -> None:
await bot.add_cog(DerangedCommands(bot))