MinnDevelopment/discord-webhooks

Webhook fails to edit due to missing author field

Shea4 opened this issue · 6 comments

Shea4 commented

I currently get this error message when trying to edit any message with a webhook, I've tried this in 2 different servers and get the same result, just in case it's a discord issue and I still believe it might be. I've used the most basic way to edit a message to make sure it's not on my end

java.lang.NumberFormatException: null
	at java.base/java.lang.Integer.parseInt(Integer.java:620)
	at java.base/java.lang.Integer.parseInt(Integer.java:776)
	at club.minnced.discord.webhook.WebhookClient$Bucket.update0(WebhookClient.java:678)
	at club.minnced.discord.webhook.WebhookClient$Bucket.update(WebhookClient.java:692)
	at club.minnced.discord.webhook.WebhookClient.executePair(WebhookClient.java:585)
	at club.minnced.discord.webhook.WebhookClient.drainQueue(WebhookClient.java:560)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:835)
51116 [pool-11-thread-1] ERROR club.minnced.discord.webhook.WebhookClient - There was some error while sending a webhook message
org.json.JSONException: JSONObject["author"] not found.
	at org.json.JSONObject.get(JSONObject.java:566)
	at org.json.JSONObject.getJSONObject(JSONObject.java:778)
	at club.minnced.discord.webhook.receive.EntityFactory.makeMessage(EntityFactory.java:248)
	at club.minnced.discord.webhook.WebhookClient.executePair(WebhookClient.java:600)
	at club.minnced.discord.webhook.WebhookClient.drainQueue(WebhookClient.java:560)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:835)

Could you provide a short example code that I can use to reproduce this?

Shea4 commented

I can reproduce it by the most simple way to edit a message, it's strange because I've also found when using delete it won't actually delete the message but the webhook will be deleted in the process leading me to believe it's something on discords end. At the same time I've done the same through making http requests and that seems to work all okay

webhook.edit(messageId, message)

This should be resolved in 0.5.2, can you confirm?

Hold on I just introduced another issue with rate limits that i need to fix.

This and the rate limit issues should be resolved on 0.5.3. I've also updated the library to use API v8.

Shea4 commented

Yeah both edit and delete work fine now, thank you