This commit is contained in:
nin0dev 2024-06-27 08:27:06 -04:00
parent caccd2ceb7
commit 8fa038b942
2 changed files with 28 additions and 12 deletions

21
cogs/deranged_commands.py Normal file
View file

@ -0,0 +1,21 @@
import discord
from discord import app_commands
from discord.ext import commands
import os
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")
embed.color = 0x00EAFF
await interaction.response.send_message(embed=embed, ephemeral=True)
async def setup(bot: commands.Bot) -> None:
await bot.add_cog(DerangedCommands(bot))

19
main.py
View file

@ -1,30 +1,25 @@
import discord
import os
from discord import app_commands
from discord.ext import commands
from cogs.deranged_commands import DerangedCommands
from dotenv import load_dotenv
load_dotenv()
client = discord.Client(intents=discord.Intents.all())
tree = app_commands.CommandTree(client)
client = commands.Bot(intents=discord.Intents.all(), command_prefix=".")
@tree.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(interaction: discord.Interaction) -> None:
embed = discord.Embed()
embed.title = "My token"
embed.description = os.getenv("TOKEN")
embed.color = 0x00EAFF
await interaction.response.send_message(embed=embed)
@client.event
async def on_message(message):
if message.author.id != 886685857560539176:
return
if message.content.startswith('.sync'):
await tree.sync()
await client.tree.sync()
await message.channel.send('Synced commands')
@client.event
async def on_ready():
await client.add_cog(DerangedCommands(client))
client.run(os.getenv("TOKEN"))