D
D
Damir2018-04-12 12:23:35
PHP
Damir, 2018-04-12 12:23:35

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();

I'm sorry to ask, I've been back to the problem 3 times already and I can't solve it,
It gives an error when starting
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

if I understand correctly, he does not see the class in this file, but he links in the storm and everything is fine (

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MYPABEU, 2014-03-12
@ruslite

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.

S
Sergey, 2014-03-12
Protko @Fesor

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 question

Ask a Question

731 491 924 answers to any question