pizzaandcoffee / Geekbot.php

A modular Discord Bot written in pure PHP [UNMAINTAINED]
https://pizzaandcoffee.rocks/
GNU General Public License v3.0
5 stars 1 forks source link

Catchable fatal error #4

Closed REDDE4D closed 8 years ago

REDDE4D commented 8 years ago

I followed your tutorial but whem i try to start the bot:

php bot.php Catchable fatal error: Argument 1 passed to Discord\Discord::__construct() must be of the type array, string given, called in C:\xampp\htdocs\discord\geekbot\bot.php on line 34 and defined in C:\xampp\htdocs\sn-clan\discord\geekbot\vendor\team-reflex\discord-php\src\Discord\Discord.php on line 289

runebaas commented 8 years ago

The master branch uses the previous version of the api which isn't backwards compatible. We are currently working on a completely rewritten version of the geekbot which works on the new api and should be finalized soon.You might wanna check it out. https://github.com/runebaas/Geekbot/tree/2.0

REDDE4D commented 8 years ago

Thanks. Looks fantastic so far. Is there a possibility to implement a db that catches user info like role, status(online/offline), last seen etc.?

TypicalFence commented 8 years ago

Yes you could write a module for that, here's the guide for it and all modules that are already written can be found here.

runebaas commented 8 years ago

Thanks :smile:

There is already a functionality which records when someone sent his or her last message, you can look it up by using the !stats @user command discord itself In the code itself you can look this up by using

Stats::getLastMessage($userID);

roles can be looked up by the following piece of code

$message->full_channel->guild->members->get('id', $message->author->id)->roles;

we are probably gonna add a function for the final release which makes this a lot easier, something like

$user = new \Geekbot\User($userID);
$roles = $user->getRoles();

The database handles everything separate for each server and user. Everything is stored in small JSON files in the /system/db folder (which will be created upon first launching the bot)

REDDE4D commented 8 years ago

@runebaas Thanks for info. I'tried to start the Version 2.0 but i got the same error. Is it not runable yet?

runebaas commented 8 years ago

Seems like our 2.0 release is also broken since the latest api update, we'll need to rewrite quiet some code to make it work again...

meanwhile you can downgrade to the previous api release by running this command and everything should work fine

composer require team-reflex/discord-php v3.2.3
REDDE4D commented 8 years ago

Hmm.. idk if i did anything wrong but itstill wont work:

Fatal error: Uncaught exception 'GuzzleHttp\Exception\RequestException' with mes sage 'cURL error 60: SSL certificate problem: unable to get local issuer certifi cate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in C:\xampp\htdocs \sn-clan\discord\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:187 Stack trace:

0 C:\xampp\htdocs\sn-clan\discord\vendor\guzzlehttp\guzzle\src\Handler\CurlFact

ory.php(150): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\ Handler\EasyHandle), Array)

1 C:\xampp\htdocs\sn-clan\discord\vendor\guzzlehttp\guzzle\src\Handler\CurlFact

ory.php(103): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Hand ler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handl er\CurlFactory))

2 C:\xampp\htdocs\sn-clan\discord\vendor\guzzlehttp\guzzle\src\Handler\CurlHand

ler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\Cu rlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\Cur lFactory))

3 C:\xampp\ht in C:\xampp\htdocs\sn-clan\discord\vendor\guzzlehttp\guzzle\src\H

andler\CurlFactory.php on line 187

runebaas commented 8 years ago

That is an error on your side... do you have the curl and openssl library enabled in your php.ini?

REDDE4D commented 8 years ago

Yeah they are both enabled

runebaas commented 8 years ago

well, this here might solve your problem http://stackoverflow.com/questions/35638497/curl-error-60-ssl-certificate-prblm-unable-to-get-local-issuer-certificate

runebaas commented 8 years ago

so, the initial issue should be fixed now with these commits da85a5729f029f8f062293c86eef7c0e047510d7 e8e3a60fe86f42239e6990369f19e4652c08ab82