-
-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example on create_guild_sticker
doesn't work
#1954
Comments
Actually I think this is a bug, sending the request manually is done successful with the same file
but running its (apparently) counterpart in Twilight returns that error let http = Client::new(env!("TEST_BOT_TOKEN").to_owned());
let guild_id = Id::new(903367565349384202);
http.create_guild_sticker(
guild_id,
"testing sticker",
"testing sticker description",
"testing,sticker,tags",
"/Users/lara/Downloads/output.png".as_bytes(),
)?
.exec()
.await?
.model()
.await?; inlining the file's content doesn't work either let http = Client::new(env!("TEST_BOT_TOKEN").to_owned());
let guild_id = Id::new(903367565349384202);
http.create_guild_sticker(
guild_id,
"testing sticker",
"testing sticker description",
"testing,sticker,tags",
&read("/Users/lara/Downloads/output.png")?,
)?
.exec()
.await?
.model()
.await?; |
What's the debug output of |
strings built from utf8 and \r\n's replaced: Request {
body: None,
form: Some(
Form {
boundary: "9dD9Oho7LuPcyOe",
buffer: "
--9dD9Oho7LuPcyOe
Content-Disposition: form-data; name=\"description\"
testing sticker description
--9dD9Oho7LuPcyOe
Content-Disposition: form-data; name=\"file\"
/Users/lara/Downloads/output.png
--9dD9Oho7LuPcyOe
Content-Disposition: form-data; name=\"name\"
testing sticker
--9dD9Oho7LuPcyOe
Content-Disposition: form-data; name=\"tags\"
testing,sticker,tags
--9dD9Oho7LuPcyOe",
},
),
headers: None,
method: Post,
path: "guilds/903367565349384202/stickers",
ratelimit_path: GuildsIdStickers(
903367565349384202,
),
use_authorization_token: true,
} so i think the bug is the file form doesn't mention the filename or content type |
I was unable to test this at the time and it went untested. So it indeed is untested. I can have a look at it sometime soon |
Is there any updates on this? |
I have a fix for this, I will PR it soon. |
Running the example at https://api.twilight.rs/twilight_http/request/guild/sticker/struct.CreateGuildSticker.html#examples with a proper token and guild ID returns
Error: Response error: status code 400, error: {"message": "Invalid Asset", "code": 50046}
, I'm not sure what to put in the file parameterThe text was updated successfully, but these errors were encountered: