Untitled

tried more than this but here ya go
 avatar
hisoka
python
2 years ago
6.5 kB
6
Indexable
############################
############################
WILL PASTE DIFFERENT TRIES
############################
############################

class Verification(commands.Cog):
    def __init__(self,
        bot: commands.bot,
    ) -> None:
        @app_commands.command(
            name="verification_enable", description="Verification setup."
        )
        @app_commands.describe(channel="Verification channel.", role="Verified role.")
        async def verify(
            self,
            interaction: discord.Interaction,
            channel: discord.TextChannel,
            role: discord.Role,
        ):
            captchaembed = discord.Embed(
                title="Security Checkpoint",
                description=f"Bots are not permitted in `{interaction.guild.name}`.\n\n To prove you are human, please complete the verification process.",
                color=0x000001,
            )
            captchaembed.set_footer(
                text="Verification by /bran#6666",
                icon_url="https://i.imgur.com/4DuUUVU.png",
            )
            # SEND INITIAL VERIFICATION EMBED
            await interaction.channel.send(
                content="", embed=captchaembed, view=VerifyButton()
            )
            await interaction.response.send_message(
                content=f"Verification enabled!\n\nTo *disable*, please delete the embedded message.\n\n**Setup Information:**\n> Verification Channel: <#{self.verify_channel}>\n> Verified Role: <@&{self.verify_role.id}>",
                ephemeral=True,
            )

        async def cog_load(self):
            asyncio.create_task(self.load_my_data())

            async def load_my_data(self):
                await self.bot.wait_until_ready()
                # do your assign logic
                self.verifyconfig = json.loads(
                    open("cogs/verifyconfig.json", "r").read()
                )
                self.verify_guild = self.bot.get_guild(verifyconfig["verify_guild"])
                self.verify_channel = self.bot.get_channel(
                    verifyconfig["verify_channel"]
                )
                self.verify_role = self.bot.get_role(verifyconfig["verify_role"])

            print(
                f"Config: {self.verifyconfig} Role: {self.verify_role} Guild: {self.verify_guild} Channel: {self.verify_channel}"
            )


async def setup(bot: commands.Bot):
    await bot.add_cog(Verification(bot))
    
############################
############################
WILL PASTE DIFFERENT TRIES
############################
############################

class Verification(commands.Cog):
    def __init__(self, bot: commands.bot):
        self.bot = bot

    @app_commands.command(name="verification_enable", description="Verification setup.")
    @app_commands.describe(channel="Verification channel.", role="Verified role.")
    async def verify(
        self,
        interaction: discord.Interaction,
        channel: discord.TextChannel,
        role: discord.Role,
    ):
        captchaembed = discord.Embed(
            title="Security Checkpoint",
            description=f"Bots are not permitted in `{interaction.guild.name}`.\n\n To prove you are human, please complete the verification process.",
            color=0x000001,
        )
        captchaembed.set_footer(
            text="Verification by /bran#6666",
            icon_url="https://i.imgur.com/4DuUUVU.png",
        )
        # SEND INITIAL VERIFICATION EMBED
        await interaction.channel.send(
            content="", embed=captchaembed, view=VerifyButton()
        )
        await interaction.response.send_message(
            content=f"Verification enabled!\n\nTo *disable*, please delete the embedded message.\n\n**Setup Information:**\n> Verification Channel: <#{self.verify_channel}>\n> Verified Role: <@&{self.verify_role.id}>",
            ephemeral=True,
        )

    async def cog_load(self):
        asyncio.create_task(self.load_my_data())

        async def load_my_data(self):
            await self.bot.wait_until_ready()
            # do your assign logic
            self.verifyconfig = json.loads(open("cogs/verifyconfig.json", "r").read())
            self.verify_guild = self.bot.get_guild(verifyconfig["verify_guild"])
            self.verify_channel = self.bot.get_channel(verifyconfig["verify_channel"])
            self.verify_role = self.bot.get_role(verifyconfig["verify_role"])



async def setup(bot: commands.Bot):
    await bot.add_cog(Verification(bot))

############################
############################
WILL PASTE DIFFERENT TRIES
############################
############################


class Verification(commands.Cog):
    def __init__(self, bot: commands.bot):
        self.bot = bot

    @app_commands.command(name="verification_enable", description="Verification setup.")
    @app_commands.describe(channel="Verification channel.", role="Verified role.")
    async def verify(
        self,
        interaction: discord.Interaction,
        channel: discord.TextChannel,
        role: discord.Role,
    ):
        captchaembed = discord.Embed(
            title="Security Checkpoint",
            description=f"Bots are not permitted in `{interaction.guild.name}`.\n\n To prove you are human, please complete the verification process.",
            color=0x000001,
        )
        captchaembed.set_footer(
            text="Verification by /bran#6666",
            icon_url="https://i.imgur.com/4DuUUVU.png",
        )
        # SEND INITIAL VERIFICATION EMBED
        await interaction.channel.send(
            content="", embed=captchaembed, view=VerifyButton()
        )
        await interaction.response.send_message(
            content=f"Verification enabled!\n\nTo *disable*, please delete the embedded message.\n\n**Setup Information:**\n> Verification Channel: <#{self.verify_channel}>\n> Verified Role: <@&{self.verify_role.id}>",
            ephemeral=True,
        )

    async def cog_load(self):
        asyncio.create_task(self.load_my_data())

    async def load_my_data(self):
        await self.bot.wait_until_ready()
        # do your assign logic
        self.verifyconfig = json.loads(open("cogs/verifyconfig.json", "r").read())
        self.verify_guild = self.bot.get_guild(verifyconfig["verify_guild"])
        self.verify_channel = self.bot.get_channel(verifyconfig["verify_channel"])
        self.verify_role = self.bot.get_role(verifyconfig["verify_role"])


async def setup(bot: commands.Bot):
    await bot.add_cog(Verification(bot))

Editor is loading...