Traceback (most recent call last):
File "C:\Users\fixik\AppData\Local\Programs\Python\Python311\Lib\site-packages\disnake\ext\commands\common_bot_base.py", line 447, in _load_from_module_spec
setup = lib.setup
^^^^^^^^^
AttributeError: module 'cogs.event_bot.webhook' has no attribute 'setup'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\micro_universe_2.0\bot.py", line 111, in
bot.load_extension(f'cogs.{folder}.{file[:-3]}')
File "C:\Users\fixik\AppData\Local\Programs\Python\Python311\Lib\site-packages\disnake\ext\commands\common_bot_base.py", line 512, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Users\fixik\AppData\Local\Programs\Python\Python311\Lib\site-packages\disnake\ext\commands\common_bot_base.py", line 450, in _load_from_module_spec
raise errors.NoEntryPointError(key)
disnake.ext.commands.errors.NoEntryPointError: Extension 'cogs.event_bot.webhook' has no 'setup' function.
import disnake
import aiohttp
from disnake import Webhook
from disnake.ext import commands
class Webhook(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name="webhook", description="ggg")
async def webhook(self, inter, url, text):
async with aiohttp.ClientSession() as webhook:
webhook = Webhook.from_url(url=url, session=webhook)
await webhook.send(text)
await inter.send('gg', ephemeral=True)
def setup(bot):
bot.add_cog(Webhook(bot))