#command not working and no errors

1 messages · Page 1 of 1 (latest)

naive flax
#

The command is not working and I am not getting any errors

main.py

import discord
from discord.ext import commands
import logging

logging.basicConfig(level=logging.INFO)

intents = discord.Intents.all()
prefix="."
class Bot(commands.Bot):
  def __init__(self):
      super().__init__(command_prefix=commands.when_mentioned_or('.'), intents=discord.Intents().all())

      self.cogslist = ['cogs.info']


  async def on_ready(self):
    print("Online")
  
  async def setup_hook(self):
    for ext in self.cogslist:
      await self.load_extension(ext)

TOKEN = ':)'
bot = Bot()
bot.run(TOKEN)

info.py

from __future__ import annotations
import discord
from discord.ext import commands


class info(commands.Cog):
  def __init__(self, client: commands.Bot):
    self.client = client

  @commands.command()
  async def serverinfo(self, ctx):
          embed = discord.Embed(title = f"**{ctx.guild.name}**", description = "Server Info", color = discord.Colour.yellow())
          embed.add_field(name="Created at:", value=f"None", inline=True)
          embed.set_thumbnail(url=ctx.guild.icon)
          embed.add_field(name="Member Count", value=f"**{ctx.guild.member_count}**", inline=True)
          embed.add_field(name="Server Owner", value=f"**{ctx.guild.owner.mention}**", inline=True)
          embed.add_field(name="Rules Channel", value=f"**{ctx.guild.rules_channel}**")
          embed.add_field(name="Emoji Limit", value=f"**{ctx.guild.emoji_limit}**", inline=True)
          embed.add_field(name="Boosters", value=f"**{ctx.guild.premium_subscription_count}**", inline=True)
          embed.add_field(name="Boost Tier", value=f"**{ctx.guild.premium_tier}**")
          embed.set_footer(text=f"Command issued by {ctx.author}")
          await ctx.send(embed=embed)
          print("server command issued")

async def setup(client:commands.Bot) -> None:
  await client.add_cog(info(client))
opal scaffold
naive flax
opal scaffold
#

You have async def setup

#

That is not py-cord

noble crest
#

And setup_hook doesn't exist in pycord

naive flax
noble crest
naive flax
# noble crest Show your pip list
aiohttp                   3.8.4
aiosignal                 1.3.1
altgraph                  0.17.4
anyio                     3.7.0
async-timeout             4.0.2
attrs                     22.2.0
certifi                   2023.5.7
charset-normalizer        3.1.0
colorama                  0.4.6
contourpy                 1.1.1
cycler                    0.12.1
ffmpeg-python             0.2.0
fonttools                 4.43.1
frozenlist                1.3.3
future                    0.18.3
h11                       0.14.0
httpcore                  0.17.2
httpx                     0.24.1
idna                      3.4
imageio-ffmpeg            0.4.9
kiwisolver                1.4.5
matplotlib                3.8.0
multidict                 6.0.4
numpy                     1.26.1
packaging                 23.2
pefile                    2023.2.7
Pillow                    10.1.0
pip                       23.3.1
py-cord                   2.4.1
pycord                    0.1.1
pyglet                    2.0.9
pyinstaller               6.1.0
pyinstaller-hooks-contrib 2023.10
pyparsing                 3.1.1
PyQt5                     5.15.9
PyQt5-Qt5                 5.15.2
PyQt5-sip                 12.12.1
PySide6                   6.6.0
PySide6-Addons            6.6.0
PySide6-Essentials        6.6.0
python-dateutil           2.8.2
pywin32-ctypes            0.2.2
requests                  2.31.0
setuptools                65.5.0
shiboken6                 6.6.0
six                       1.16.0
sniffio                   1.3.0
tk                        0.1.0
urllib3                   2.0.2
yarl                      1.8.2
noble crest
naive flax
#

Ok

naive flax
opal scaffold
#

change that to ```py
def setup(client: commands.Bot):
cliend.add_cog(info(client)

naive flax
#

yeah I did

#

it works

#

thank you both

opal scaffold
#

before

#

you close the thread

#

uninstall pycord and py-cord and only install py-cord-dev

naive flax
#

oh

#

ok

opal scaffold
#

py-cord-dev is the newest py-cord version