allthingslinux / tux

Tux is an all in one bot for the All Things Linux discord server.
https://discord.gg/linux
GNU General Public License v3.0
85 stars 25 forks source link

Remove hardcoded role ids #601

Open github-actions[bot] opened 1 month ago

github-actions[bot] commented 1 month ago

https://github.com/allthingslinux/tux/blob/9e0e710e0e7192aead47505fd0249c684be63331/tux/cogs/utility/snippets.py#L350


            The name and content of the snippet.
        """

        # TODO: Remove hardcoded role ids

        # If user does not have any of the access level roles, return
        access_level_role_ids = [1290368656441872535, 1290368813627346995]

        assert ctx.guild

        if isinstance(ctx.author, discord.Member) and all(
            role.id not in access_level_role_ids for role in ctx.author.roles
        ):
            await ctx.send("You do not have the permission to use this command.")
            return

        if await self.is_snippetbanned(ctx.guild.id, ctx.author.id):
            await ctx.send("You are banned from using snippets.")
            return