how can a bot delete it's own messages ?

Posted in General by Mario Hennenberger Fri Dec 22 2017 07:59:43 GMT+0000 (Coordinated Universal Time)·1·Viewed 953 times

the issue is simple, i have a dicordPHP bot with posts timebased warnings, but in quiet times this results in flood-ish apearance. so the idea is that the bot remebers the last message id and just delete it before sending another one. is that doable ? i have not found a response that contains the message id, so it's kind of tricky to delete it.
June 12, 2019

Add this to vendor/team-reflex/discord-php/src/Discord/Parts/Channel/Channel.php around line 237

     * Deletes a message from the channel.
     * @param Message $message The message to delete.
     * @return \React\Promise\Promise
    public function deleteMessage(Message $message)
        $deferred = new Deferred();

        if ($message->channel_id != $this->id) {
            return \React\Promise\reject(new \Exception('You cannot delete a message from a different channel.'));

            function () use (&$message, $deferred) {
            \React\Partial\bind_right($this->reject, $deferred)

        return $deferred->promise();
Markdown is allowed