Skip to content

Commit

Permalink
Update | Documents
Browse files Browse the repository at this point in the history
  • Loading branch information
gncdev committed Aug 8, 2020
1 parent 3debdb5 commit 32ace70
Showing 1 changed file with 56 additions and 5 deletions.
61 changes: 56 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class EventListener extends \Ourted\Interfaces\EventListener
if(isset($json->author->bot)){
return;
}
$this->func->sendMessage("Message Sent! By: <@{$json->author->id}>, Content: {$json->content}", $json->channel_id);
$this->channel->sendMessage("Message Sent! By: <@{$json->author->id}>, Content: {$json->content}", $json->channel_id);
}


Expand Down Expand Up @@ -157,7 +157,7 @@ class Ourted extends Bot
class TestCommand extends Command{

public function execute($json, $bot){
$bot->functions->sendMessage("Command Used! Command: {$json->content}", $json->channel_id);
$bot->channel->sendMessage("Command Used! Command: {$json->content}", $json->channel_id);
}
}

Expand Down Expand Up @@ -200,11 +200,62 @@ class Ourted extends Bot


// Get Channel
$channel = $this->functions->get_channel(CHANNEL_ID);
$channel = $this->channel->getChannel(CHANNEL_ID);

// Delete Messages
$message = $func->getMessage($channel, MESSAGE_ID);
$func->deleteMessage($message);
$message = $this->channel->getMessage($channel, MESSAGE_ID);
$this->channel->deleteMessage($message);


$this->run();
}
}

new Ourted();
?>
````

Delete Bulk Message
---

````php
<?php

require_once __DIR__ . '/vendor/autoload.php';

use Dotenv\Dotenv;
use Ourted\Bot;

class Ourted extends Bot
{

public $token;

public function __construct()
{
$dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->load();
$this->token = $_ENV['BOT_TOKEN'];
parent::__construct($this->token, '!');
$this->setBot();
}

public function setBot()
{
// Channel
$channel = $this->channel->getChannel(CHANNEL_ID);

$ids = "";
// Count Messages
foreach (json_decode($this->channel->getMessages($channel)) as $key => $item) {
if($key == 99){
return;
}
count(json_decode($this->channel->getMessages($channel))) -1 == $key?
$ids .= "\"$item->id\"" : $ids.= "\"$item->id\",";
}
// Delete Messages
$this->channel->deleteBulkMessage("[{$ids}]", $channel);


$this->run();
Expand Down

0 comments on commit 32ace70

Please sign in to comment.