Replies: 1 comment
-
A buffered IO is not currently a valid type that the function accepts. You can pass bytes, but to do that, you'd call read on it beforehand. Example: avatar = open("nextcord-logo.png", "rb").read()
webhook = await channel.create_webhook(name="Testing", avatar=avatar)
await webhook.send("Hello, world!") Another option is to use avatar = nextcord.File("nextcord-logo.png") I have tested both of these approaches and they are working as expected. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
When adding an image in
bytes
type to a webhook using the create_webhook command, I run into a TypeError.Reproduction Steps
I used the
text_channel.create_webhook()
function with anavatar
attribute with value typebytes
.Minimal Reproducible Code
Note: Needs an image named avatar.jpg in the same folder as file.
Expected Results
I expected the command to create a webhook with the avatar included.
Actual Results
I got a TypeError: object bytes can't be used in 'await' expression
The full traceback is below:
Intents
None
System Information
Nextcord version: 2.3.2
(Note: I can't run the version command in my server)
Checklist
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions