本文整理汇总了PHP中Api::reply方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::reply方法的具体用法?PHP Api::reply怎么用?PHP Api::reply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Api
的用法示例。
在下文中一共展示了Api::reply方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($message)
{
$markdown = true;
global $t;
$t->setPlugin("wikipedia");
$cmd = strtolower($message->getCommand());
$data = $message->getData();
$cmd_params = explode("_", $cmd);
if (sizeof($cmd_params) == 2) {
$param = $cmd_params[1];
$cmd = $cmd_params[0];
}
switch ($cmd) {
case "wiki":
if (sizeof($data) >= 1) {
$title = implode(" ", $data);
} else {
$help = $t->g("default");
$help = implode("\n", $help);
Api::reply($message->chat, $help, true);
return;
}
$wp = new WikipediaParser();
$text = $wp->search($title, strtolower(LANGUAGE));
$markdown = false;
break;
case "wikip":
$wp = new WikipediaParser();
$text = $wp->page($param, strtolower(LANGUAGE));
break;
}
Api::reply($message->chat, $text, $markdown);
}
示例2: receive
public function receive($message)
{
if ($message->type == "location") {
$forecast = false;
$coords = array("lon" => $message->location->longitude, "lat" => $message->location->latitude);
$wp = new WeatherParser($coords);
Api::reply($message->chat, $wp->getWeather($forecast), true);
}
}