Kod:
import keep_alive
import os
import discord
from discord.ext import commands

bot = commands.Bot(command_prefix='!pydocs')

token = "tokenim"


async def on_ready(self):
print('Logged on as {0}!'.format(self.user))

for filename in os.listdir("./handler"):
if filename.endswith(".py"):
bot.load_extension(f"handler.{filename[:-3]}")
print("Loaded:" + filename)

keep_alive.keep_alive()


bot.run(token)
usteeki kod diskord.py ile yapilmis basit bir "cog" sistemi ben buna handler diye hitap ediyorum, ancak ne yaparsam yapayim assagidaki hayati aliyorum:

Kod:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 607, in _load_from_module_spec
spec.loader.exec_module(lib)
File "", line 783, in exec_module
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 613, in _load_from_module_spec
setup = getattr(lib, 'setup')
AttributeError: module 'handler.ping' has no attribute 'setup'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 607, in _load_from_module_spec
spec.loader.exec_module(lib)
File "", line 783, in exec_module
File "", line 219, in _call_with_frames_removed
File "/home/runner/PyDocsBot/handler/ping.py", line 4, in
class ping(commands.cog):
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 607, in _load_from_module_spec
spec.loader.exec_module(lib)
File "", line 783, in exec_module
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 613, in _load_from_module_spec
setup = getattr(lib, 'setup')
AttributeError: module 'handler.ping' has no attribute 'setup'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 607, in _load_from_module_spec
spec.loader.exec_module(lib)
File "", line 783, in exec_module
File "", line 219, in _call_with_frames_removed
File "/home/runner/PyDocsBot/handler/ping.py", line 4, in
class ping(commands.cog):
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 607, in _load_from_module_spec
spec.loader.exec_module(lib)
File "", line 783, in exec_module
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 607, in _load_from_module_spec
spec.loader.exec_module(lib)
File "", line 783, in exec_module
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 607, in _load_from_module_spec
spec.loader.exec_module(lib)
File "", line 783, in exec_module
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 607, in _load_from_module_spec
spec.loader.exec_module(lib)
File "", line 783, in exec_module
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 607, in _load_from_module_spec
spec.loader.exec_module(lib)
File "", line 783, in exec_module
File "", line 219, in _call_with_frames_removed
File "/home/runner/PyDocsBot/handler/ping.py", line 4, in
class ping(commands.cog):
TypeError: module() takes at most 2 arguments (3 given)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "main.py", line 16, in
bot.load_extension(f"handler.{filename[:-3]}")
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 664, in load_extension
self._load_from_module_spec(spec, name)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 610, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'handler.ping' raised an error: TypeError: module() takes at most 2 arguments (3 given)
discord.py a yeni basladim :(