Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bot-api] Bot throws an error when channel is innactive for more than 30 mins. #44

Closed
ghost opened this issue Mar 26, 2016 · 0 comments
Closed

Comments

@ghost
Copy link

ghost commented Mar 26, 2016

Here's the error:

Fatal error: Uncaught Error: Call to a member function get() on null in init.php:33
Stack trace:
#0 [internal function]: {closure}(Object(Discord\Parts\Channel\Message), Object(Discord\Discord), Object(Discord\Discord))
#1 /{DISCORD_DIR}/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(64): call_user_func_array(Object(Closure), Array)
#2 /{DISCORD_DIR}/src/Discord/WebSockets/WebSocket.php(633): Evenement\EventEmitter->emit('MESSAGE_CREATE', Array)
#3 /{DISCORD_DIR}/src/Discord/WebSockets/WebSocket.php(249): Discord\WebSockets\WebSocket->handleHandler(Array, Object(stdClass))
#4 [internal function]: Discord\WebSockets\WebSocket->Discord\WebSockets\{closure}(Object(Ratchet\RFC6455\Messaging\Message), Object(Ratchet\Client\WebSocket))
#5 /{DISCORD_DIR}/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(64): call_user_func_array(Object(Closure), Array)

Line 33 of my code is:

$guild = $discord->guilds->get('id', $message->full_channel->guild->id);
$member = $guild->members->get('id', $message->author->id);

$array['userdata'] = $member->user;

if($member->roles->get('name', 'BOT CONTROLING')) { /* This is line 33 */
    $array['can_control_bot'] = TRUE;
} else {
    $array['can_control_bot'] = FALSE;
}

$message->channel->sendMessage("```".json_encode($array)."```");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant