CortexPE/DiscordWebhookAPI

Messages randomly not being sent

KadTheHunter opened this issue · 1 comments

I'm following the instructions, and am using this code:

public function dChat(PlayerChatEvent $event) : void{
        $webHook = new Webhook("<my webhook is here>");
        $playerName = $event->getPlayer()->getDisplayName();
        $message = $event->getMessage();
        $message = str_replace('@', '', $event->getMessage());
        $msg = new Message();
        $msg->setContent($playerName . ": " . $message);
        $webHook->send($msg);
    }

Some messages will get sent to the channel, others will not. When they do not, it says this in console:
[Server thread/ERROR]: [DiscordWebhookAPI] Got error:

now I looked at the code, and when that message sends there should be a response included, except... there isn't. The message doesn't get sent to discord, and there just isn't any error in console beyond what I put above.

Am extremely confused with why this is happening, as I appear to be doing everything correctly.

The error message is directly from discord API's response.

I'll include an HTTP response code to aid this, though I'm not sure why they aren't sending a response message.