more BAD code

This commit is contained in:
nin0dev 2024-06-27 17:07:10 -04:00
parent 8fa038b942
commit e9e726569e
4 changed files with 62 additions and 1 deletions

View file

@ -2,6 +2,7 @@ import discord
from discord import app_commands from discord import app_commands
from discord.ext import commands from discord.ext import commands
import os import os
import util
class DerangedCommands(commands.Cog): class DerangedCommands(commands.Cog):
def __init__(self, bot: commands.Bot) -> None: def __init__(self, bot: commands.Bot) -> None:
@ -13,9 +14,22 @@ class DerangedCommands(commands.Cog):
async def token(self, interaction: discord.Interaction) -> None: async def token(self, interaction: discord.Interaction) -> None:
embed = discord.Embed() embed = discord.Embed()
embed.title = "My token" embed.title = "My token"
embed.description = os.getenv("TOKEN") embed.description = os.getenv("TOKEN") if util.is_owner(interaction.user.id) else "[object Object]"
embed.color = 0x00EAFF embed.color = 0x00EAFF
await interaction.response.send_message(embed=embed, ephemeral=True) 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: async def setup(bot: commands.Bot) -> None:
await bot.add_cog(DerangedCommands(bot)) await bot.add_cog(DerangedCommands(bot))

33
cogs/support_helper.py Normal file
View file

@ -0,0 +1,33 @@
import discord
from discord import app_commands
from discord.ext import commands
from selfcord import Client
import os
import util
class SupportHelper(commands.Cog):
def __init__(self, bot: commands.Bot, user: selfcord.Client) -> None:
self.bot = bot
self.user = user
@app_commands.command(name="rule5", description="Call out retards that @ me")
@app_commands.allowed_installs(guilds=False, users=True)
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
async def rule5(self, interaction: discord.Interaction, target: discord.User) -> None:
embed = discord.Embed()
embed.title = "Rule 5"
embed.description = "Avoid pinging anyone in support, or DMing for support. Don't ask for support elsewhere than in <#1026515880080842772>. Be patient when receiving support. You may lose access to support if you break this rule repeatedly."
await interaction.response.send_message(content=target.mention, embed=embed)
@app_commands.command(name="donor", description="How to claim your Vencord Premium perks")
@app_commands.allowed_installs(guilds=False, users=True)
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
async def donor(self, interaction: discord.Interaction, target: discord.User) -> None:
embed = discord.Embed()
embed.title = "Claim donor perks"
embed.description = "To claim your Vencord donor perks, you can DM <@343383572805058560> (username `vending.machine`)."
embed.add_field(name="I can't send the DM!", value="It means **your** DMs are closed. Make sure that they are open in the Vencord Server.")
await interaction.response.send_message(content=target.mention, embed=embed, allowed_mentions=discord.AllowedMentions(users=False))
async def setup(bot: commands.Bot) -> None:
await bot.add_cog(SupportHelper(bot))

View file

@ -3,11 +3,14 @@ import os
from discord import app_commands from discord import app_commands
from discord.ext import commands from discord.ext import commands
from cogs.deranged_commands import DerangedCommands from cogs.deranged_commands import DerangedCommands
from cogs.support_helper import SupportHelper
from dotenv import load_dotenv from dotenv import load_dotenv
import selfcord
load_dotenv() load_dotenv()
client = commands.Bot(intents=discord.Intents.all(), command_prefix=".") client = commands.Bot(intents=discord.Intents.all(), command_prefix=".")
user = selfcord.Client()
@client.event @client.event
@ -18,8 +21,12 @@ async def on_message(message):
await client.tree.sync() await client.tree.sync()
await message.channel.send('Synced commands') await message.channel.send('Synced commands')
@client.event @client.event
async def on_ready(): async def on_ready():
await user.login(os.getenv("USER_TOKEN"))
await client.add_cog(DerangedCommands(client)) await client.add_cog(DerangedCommands(client))
await client.add_cog(SupportHelper(client))
print("Loaded all cogs")
client.run(os.getenv("TOKEN")) client.run(os.getenv("TOKEN"))

7
util.py Normal file
View file

@ -0,0 +1,7 @@
from discord import Embed
def is_owner(id: int):
return True if id == 886685857560539176 else False
success = 0x77b255
error = 0xdd2e44
fuckoff_embed = Embed(title="❌ No permissions", description="You can't use this.", color=error)