From e9e726569e266fe84b46997fffcd95010d1d677a Mon Sep 17 00:00:00 2001 From: nin0dev Date: Thu, 27 Jun 2024 17:07:10 -0400 Subject: [PATCH] more BAD code --- cogs/deranged_commands.py | 16 +++++++++++++++- cogs/support_helper.py | 33 +++++++++++++++++++++++++++++++++ main.py | 7 +++++++ util.py | 7 +++++++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 cogs/support_helper.py create mode 100644 util.py diff --git a/cogs/deranged_commands.py b/cogs/deranged_commands.py index d709f64..5b1e597 100644 --- a/cogs/deranged_commands.py +++ b/cogs/deranged_commands.py @@ -2,6 +2,7 @@ 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: @@ -13,9 +14,22 @@ class DerangedCommands(commands.Cog): async def token(self, interaction: discord.Interaction) -> None: embed = discord.Embed() 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 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)) \ No newline at end of file diff --git a/cogs/support_helper.py b/cogs/support_helper.py new file mode 100644 index 0000000..5f68318 --- /dev/null +++ b/cogs/support_helper.py @@ -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)) \ No newline at end of file diff --git a/main.py b/main.py index f9e663b..0f856e6 100644 --- a/main.py +++ b/main.py @@ -3,11 +3,14 @@ import os from discord import app_commands from discord.ext import commands from cogs.deranged_commands import DerangedCommands +from cogs.support_helper import SupportHelper from dotenv import load_dotenv +import selfcord load_dotenv() client = commands.Bot(intents=discord.Intents.all(), command_prefix=".") +user = selfcord.Client() @client.event @@ -17,9 +20,13 @@ async def on_message(message): if message.content.startswith('.sync'): await client.tree.sync() await message.channel.send('Synced commands') + @client.event async def on_ready(): + await user.login(os.getenv("USER_TOKEN")) await client.add_cog(DerangedCommands(client)) + await client.add_cog(SupportHelper(client)) + print("Loaded all cogs") client.run(os.getenv("TOKEN")) \ No newline at end of file diff --git a/util.py b/util.py new file mode 100644 index 0000000..9adc757 --- /dev/null +++ b/util.py @@ -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) \ No newline at end of file