Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Generate commands from MySQL Table

オープン
#97 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
20/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
mysql, php
領域
backend, databases

調査の方向性

Issue にあるインライン PHP スクリプトから始め、特に MySQL の取得ループと botman->hears に渡される callback を確認してください。このフローを BotMan のコマンドおよび callback のドキュメントと比較してください。生成された各コマンドが意図した行固有の応答を生成するようになって初めて Issue は完了ですが、期待される実装は指定されていません。

索引モデルが issue の本文から書いたものです。

説明

Hi!

First off, thank you for this framework! I have been building a chatbot with some JS libraries and really wanted a way to protect some of the clever coding I have done. This is a fantastic solution.

One of my current goals to use my nice GUI CRUD editor to build out my conversations.
The script below connects to a Database and creates a command for each row in the table.

However, every response is equal to the last row's response value. Can anyone provide me with a hint on what I should be googling to find a solution? Right now I am focused on Variable Scopes.

Cheers!

Brandon

<?php
use App\Http\Controllers\BotManController;


$servername = "localhost";
$username = "USR";
$password = "PASS";
$dbname = "DB";



$botman = resolve('botman');



// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

$sql = "SELECT id, command, responce, function FROM commands_general";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
     //   echo "<br> id: ". $row["id"]. " - Command: ". $row["command"]. " " . $row["responce"] . "<br>";
     $command = $row["command"];
     $GLOBALS['responce'. $row["id"]] = $row["responce"];
     $GLOBALS['id'] = $row["id"];
       
    $botman->hears($command, function ($bot) {
      global $id;

     // global $responce.$x;
        $bot->reply('heard you '.$id);  
        $id ++;  
});
    }
} else {
    echo "0 results";
}

$conn->close();

主要言語
言語のデータがありません
スター
33
フォーク
49
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

botman/docs のほかの issue

botman/docs の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。