python-discord/meta

Make `bot-var` and `cogs` tags (mainly for discord-bots channel)

NIRDERIi opened this issue · 4 comments

Many people ask a lot of times how to access some variable through all the files they have, and we have to explain many times what is a bot-var and how to use it, a tag that we can show can be a real help in #discord-bots channel, like how to use bot vars in cogs and why to use it anyway
About the cogs, also this is for the discord-bots channel, which is a was to organize your code, also about this topic many people ask, and the responses are ofc not enough, a tag could also be very useful.

Tho even some pinned message could be helpful, but I am not sure what is for a better suggesion.

GDWR commented

botvar

it seems like we already have a botvar tag now. This can be viewed using !botvar and the content is screenshotted below.
image

It seems to have made its way into the tag list here python-discord/bot#1784


cogs

I'd expect linking to the documentation for cogs to be helpful to a user who wants to find out more, namely discord.py Cog Quickstart. A brief description of what they offer and a link to this page could be created as a tag.

My suggestion would be along the lines of (which is practically the brief they give here) :

image

View Raw

discord.py offers a cogs framework to organize your commands, listeners, and state into reusable classes that can be loaded and unloaded during runtime. An example of a cog is shown below:

class Greetings(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self._last_member = None

    @commands.Cog.listener()
    async def on_member_join(self, member):
        channel = member.guild.system_channel
        if channel is not None:
            await channel.send(f'Welcome {member.mention}.')

    @commands.command()
    async def hello(self, ctx, *, member: discord.Member = None):
        """Says hello"""
        member = member or ctx.author
        if self._last_member is None or self._last_member.id != member.id:
            await ctx.send(f'Hello {member.name}~')
        else:
            await ctx.send(f'Hello {member.name}... This feels familiar.')
        self._last_member = member

To learn more, see the docs


Do you think this content would be ample?
and/or do you have an idea of what the cogs tag should look like or include?

I agree that cogs is an important and likely topic on Pydis, but I have doubts that we could provide much additional help over the cog docs provided by discord.py. Typically, a tag would cover some additional information and context than what might be provided in the docs for that topic. Therefore, I do not think the cogs tag will be much help.

I also agree that linking the docs would be better here, as cogs are quite a broad topic. I'll close this, though a new issue can be opened if a tag for a specific aspect of cogs would be useful.