You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having trouble getting files to send using send_file. Commit hash: 245f573
Example code:
// Log in to Discord using a bot token from the environmentlet discord = Discord::from_bot_token(&env::var("DISCORD_TOKEN").expect("Expected token")).expect("login failed");// Establish and use a websocket connectionlet(mut connection, _) = discord.connect().expect("connect failed");println!("Ready.");loop{match connection.recv_event(){Ok(Event::MessageCreate(message)) => {println!("{} says: {}", message.author.name, message.content);if message.content == "!test"{
discord.send_file(
message.channel_id,"This is a reply to the test.","This is a test text file".as_bytes(),"test.txt",).expect("Failed to send file");}}Ok(_) => {}Err(discord::Error::Closed(code, body)) => {println!("Gateway closed on us with code {:?}: {}", code, body);break;}Err(err) => println!("Receive error: {:?}", err),}}
When I DM the bot !test, I get the following:
thread 'main' panicked at 'Failed to send file: Hyper(Io(Custom { kind: InvalidInput, error: "Invalid scheme for Http" }))'
Which suggests to me that TLS isn't being used... But I'm not sure. I tried to find where the hyper Client was being referenced, but didn't have much time. I'll try stepping through the code later tonight to see where the problem might be (and perhaps submit a PR if I find a fix) but I wanted to create an issue first.
The text was updated successfully, but these errors were encountered:
Having trouble getting files to send using
send_file
. Commit hash: 245f573Example code:
When I DM the bot
!test
, I get the following:Which suggests to me that TLS isn't being used... But I'm not sure. I tried to find where the hyper
Client
was being referenced, but didn't have much time. I'll try stepping through the code later tonight to see where the problem might be (and perhaps submit a PR if I find a fix) but I wanted to create an issue first.The text was updated successfully, but these errors were encountered: