Pycord-Development / pycord

Pycord is a modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python
https://docs.pycord.dev
MIT License
2.74k stars 462 forks source link

Unexpected behavior with bot.fetch_webhook #866

Closed eltaylor1104 closed 2 years ago

eltaylor1104 commented 2 years ago

Summary

Using bot.fetch_webhook, I receive an error that '_MissingSentinel' object has no attribute 'request'

Reproduction Steps

  1. Latest version of Pycord installed via the GitHub (alpha version)
  2. Plug in a valid webhook id to bot.fetch_webhook
  3. Receive the error

Minimal Reproducible Code

url = await bot.fetch_webhook(webhookid)
await url.send(embed=embed)

Expected Results

Send an embed to the specified webhook

Actual Results

Received this error:

  File "/home/ec2-user/Loggy/cogs/logevents.py", line 151, in on_message_edit
    url = await bot.fetch_webhook(webhookid)
  File "/home/ec2-user/.local/lib/python3.8/site-packages/discord/client.py", line 1555, in fetch_webhook
    data = await self.http.get_webhook(webhook_id)
  File "/home/ec2-user/.local/lib/python3.8/site-packages/discord/http.py", line 276, in request
    async with self.__session.request(method, url, **kwargs) as response:
AttributeError: '_MissingSentinel' object has no attribute 'request'

(webhook id is substituted out so as to not give everyone access to a webhook)

Intents

discord.Intents.all()

System Information

Checklist

Additional Context

No response

zeffo commented 2 years ago

I thought this was a bug, but it's raised when the method is called before the bot has logged in.

eltaylor1104 commented 2 years ago

Really? My bot is long since logged in 🤔

zeffo commented 2 years ago

Could you ping me on discord (Zeffo#0393) with your whole code please?

zeffo commented 2 years ago

This has been resolved on discord. Closing.