Answer the question
In order to leave comments, you need to log in
Error running script run.php discord bot?
<?php
use Discord\DiscordCommandClient;
$discord = new DiscordCommandClient([
'token' => 'token',
]);
$discord->registerCommand('ping', function ($message) {
return 'pong!';
}, [
'description' => 'pong!',
]);
$discord->run();
PHP Fatal error: Uncaught Error: Class 'Discord\DiscordCommandClient' not found in /home/sleep/PhpstormProjects/bots/bots/run.php:6
Stack trace:
#0 {main}
thrown in /home/sleep/PhpstormProjects/bots/bots/run.php on line 6
Answer the question
In order to leave comments, you need to log in
For the future: refine the language and frameworks.
I understand that this is JS code.
Here the request is executed, and the callback function accepts an error, if any, and the result of the request.
In this case, the presence of an error is not checked.
What "SET ?" does:
If we make a query with SET, then we enumerate the values in the form: key1=value1, key2=value2, ..., keyN=valueN.
The question mark here will just play the role of the section that will be replaced by a dictionary.
If you need to add a name field, then you need to add the name key and its value to the post dictionary.
in node.js, this is how callbacks are made. When your request to the database is processed, this function will be called, and if an error occurs, it will be displayed in the err variable. This is how errors are handled. To make things prettier, you can use things like promise ( q ), and thus save yourself from future problems when the nesting of callbacks grows.
About SET? - SET is a part of SQL, a string formed from what you stuffed into the post variable will be substituted for the question mark. In fact, SET says what exactly to insert, and everything up to - what exactly needs to be inserted data and where.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question