MinnDevelopment/discord-webhooks

Trying to send a file along with a message

NextZac opened this issue · 5 comments

This is my bit of code

long id = 779418282280091669L;
WebhookClient client = WebhookClient.withId(id, "[REDACTED]");
client.send("Hello, lmao test");
WebhookEmbed embed = new WebhookEmbedBuilder()
    .setColor(0x00b3ff)
    .setDescription("test")
    .build();
client.send(embed);
System.out.println("Message Sent!");
client.send(new File("/storage/emulated/0/Downloads/file.txt"));
System.out.println("File sent!");
client.close();

Its using the Android sdk lvl 30
The message sends fine, just not the embed neither the file

image

Ive tried other library's as well, but they dont work either. This library is the nicest one yet so here i am posing my issue.
Im quite a begginer in java so please dont roast me, thank you 😀

I/System.out: Message Sent!
I/System.out: File sent!
W/System: A resource failed to call close. 
W/.zack.growtopi: Accessing hidden method Lcom/android/org/conscrypt/ConscryptFileDescriptorSocket;->setUseSessionTickets(Z)V (greylist,core-platform-api, reflection, allowed)
W/.zack.growtopi: Accessing hidden method Lcom/android/org/conscrypt/ConscryptFileDescriptorSocket;->setHostname(Ljava/lang/String;)V (greylist,core-platform-api, reflection, allowed)
W/.zack.growtopi: Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setAlpnProtocols([B)V (greylist,core-platform-api, reflection, allowed)
W/.zack.growtopi: Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->getAlpnSelectedProtocol()[B (greylist,core-platform-api, reflection, allowed)
W/System: A resource failed to call end. 
D/AwareBitmapCacher: handleInit switch not opened pid=25558

I also never get any error messages

This library isn't designed to support android and I have no way to even test it. Make sure you enable logging and try not to close the client immediately after sending, since sending is an asynchronous task.

Okay, ill try debugging it. Thank you

I've tested your code on 0.5.1 and it works as expected:

image

Just got it working as well. Thanks for trying as well 👍