php-telegram-bot / core

PHP Telegram Bot based on the official Telegram Bot API
MIT License
3.87k stars 951 forks source link

New commands not work #11

Closed paranoiasystem closed 9 years ago

paranoiasystem commented 9 years ago

I have wrote a new command based on help command

<?php
namespace Longman\TelegramBot\Commands;

use Longman\TelegramBot\Request;
use Longman\TelegramBot\Command;
use Longman\TelegramBot\Entities\Update;

class NicoCommand extends Command
{
    public function execute() {
        $update = $this->getUpdate();
        $message = $this->getMessage();

        $chat_id = $message->getChat()->getId();
        $text = $message->getText(true);

        $data = array();
        $data['chat_id'] = $chat_id;
        $data['text'] = "Sorry, ........";

        $result = Request::sendMessage($data);
    }
}

But when I write /nico it not work :cry:

What's wrong ?

(Sorry for my bad english :grin: )

MBoretto commented 9 years ago

What is the name of the file? It have to be NicoCommand.php On 17 Jul 2015 18:40, "Marco Ferraioli" notifications@github.com wrote:

I have wrote a new command based on help command

<?phpnamespace Longman\TelegramBot\Commands;use Longman\TelegramBot\Request;use Longman\TelegramBot\Command;use Longman\TelegramBot\Entities\Update;class NicoCommand extends Command{ public function execute() { $update = $this->getUpdate(); $message = $this->getMessage(); $chat_id = $message->getChat()->getId(); $text = $message->getText(true); $data = array(); $data['chat_id'] = $chat_id; $data['text'] = "Sorry, ........"; $result = Request::sendMessage($data); }}

But when I write /nico it not work [image: :cry:]

What's wrong ?

(Sorry for my bad english [image: :grin:] )

— Reply to this email directly or view it on GitHub https://github.com/akalongman/php-telegram-bot/issues/11.

paranoiasystem commented 9 years ago

yes, the name is NicoCommand.php

screen

http://s10.postimg.org/smonglf15/Immagine.png

paranoiasystem commented 9 years ago

ops I don't want close this :confused:

MBoretto commented 9 years ago

Wich version of the bot you're using? this is not the last one 0.0.8 right?

paranoiasystem commented 9 years ago

I have update the bot, but now when I set webhook I recive this error:

Webhook was not set! Error:

help me :cry:

MBoretto commented 9 years ago

Try to do he request manually with this: https://api.telegram.org/bot{yourbottoken}/setWebhook?url={yourhttpsurl}

paranoiasystem commented 9 years ago

it work. Thanks