#why are pycord cogs so buggy?

1 messages · Page 1 of 1 (latest)

wary hound
#

i have 2 different ways to load my cogs: ```bot.load_extension('cogs.events')
bot.load_extension('cogs.fun')
bot.load_extension('cogs.locks')
bot.load_extension('cogs.slashs')
bot.load_extension('cogs.mod')
bot.load_extension('cogs.invite')
bot.load_extension('cogs.infos')
bot.load_extension('cogs.role')
bot.load_extension('cogs.fun')
bot.load_extension('cogs.banner')
cogs_list = [
'infos', 'role', 'invite', 'banner', 'locks', 'events', 'slashs', 'fun', 'mod'
]

for cog in cogs_list:
bot.load_extension(f'cogs.{cog}')``` and half of my cogs just wont work, if you request to see my code inside the cogs i will send them but please help

#

update: changed my cog loader to for filename in os.listdir('./cogs'): if filename.endswith('.py'): bot.load_extension(f'cogs.{filename[:-3]}') some cogs still don't load

distant basin
mortal musk
#

i.e. ```py
cogs_list = [
'infos', 'role', 'invite', 'banner', 'locks', 'events', 'slashs', 'fun', 'mod'
]

for cog in cogs_list:
bot.load_extension(f'cogs.{cog}', store=False)```or whatever your loop is now

distant basin
mortal musk
#

2.0 had a pr which set store=True, which won't raise errors but instead returns them as a dict

#

this is reverted in the next release

#

but for now, you have to set store=False for it to raise errors and warn you

mortal musk
#

for loop

wary hound
#
  File "c:\Users\steph\spot\main.py", line 35, in <module>
    bot.load_extension(f'cogs.{cog}', store=False)
  File "C:\Users\steph\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\cog.py", line 857, in load_extension
    raise final_out
discord.errors.ExtensionAlreadyLoaded: Extension 'cogs.infos' is already loaded.```
mortal musk
#

that's pretty self explanatory...

wary hound
#
from discord.ext import commands



class Invite(commands.Cog, name="Invite"):
  def __init__(self, bot):
    self.bot = bot

  @commands.command(aliases = ['inv', 'support'])
  async def invite(self, ctx):
    view = discord.ui.View()
#https://discord.com/api/oauth2/authorize?client_id=1004992609565036645&permissions=8&scope=bot
    embed = discord.Embed(color=0x303135, description = '>_<')
    embed.set_author(icon_url=self.bot.user.avatar.url, name='cope')
    view.add_item(discord.ui.Button(label='invite', url='https://discord.com/api/oauth2/authorize?client_id=1004992609565036645&permissions=8&scope=bot', style=discord.ButtonStyle.url))
    view.add_item(discord.ui.Button(label='support', url='https.gg/kissed', style=discord.ButtonStyle.url))
    
    await ctx.send(embed=embed, view=view)


  @commands.command(aliases=['mc', 'members'])
  async def membercount(self, ctx):
    total = len(ctx.guild.members)
    bots = len(list(filter(lambda m: m.bot, ctx.guild.members)))
    mems = sum(not m.bot for m in ctx.guild.members)


    embed = discord.Embed( description = f"**Users**\n{total}\n**Humans**\n{mems}\n**Bots**\n{bots}", color = 0x303135)
    embed.set_author(name=f"{ctx.guild.name}", icon_url=f"{ctx.guild.icon.url}")

    await ctx.message.reply(embed=embed, mention_author=False)

  @commands.command(aliases=["creds","credit"])
  async def credits(self, ctx):
    embed = discord.Embed(description = "> **har#0001** `&` **sent#0001**",color =0x303135) 
    embed.set_author(name=f'{ctx.author}', icon_url=f'{ctx.author.avatar.url}')
    embed.set_footer(text='use ;botinfo for more info on devs')
    await ctx.send(embed=embed)
    

  @commands.command()
  async def botinfo(self, ctx):
    embed = discord.Embed(
      title = '**cope info**:',
      description = f'[__inv__]( https://discord.com/api/oauth2/authorize?client_id={self.bot.user.id}&permissions=8&scope=bot) : [__support__](https:///kissed)\n\n**Guilds**: {len(self.bot.guilds)}\n**Members**: {len(self.bot.users)}\n**Lang**: Pycord\n**Commands**: {len(self.bot.commands)}\n**Devs**: har#0001',
      color = 0x303135
    )
    embed.set_thumbnail(url=f'{self.bot.user.avatar.url}') 
    await ctx.send(embed=embed)



  
  


def setup(bot): 
    bot.add_cog(Invite(bot))``` ```discord.errors.NoEntryPointError: Extension 'cogs.invite' has no 'setup' function.```
mortal musk
wary hound