D-Bot/plugins/tts.php

10 lines
389 B
PHP
Raw Normal View History

2015-05-29 11:20:55 -05:00
<?php
PluginList("tts", "Text To Speech");
2015-06-26 01:14:14 -05:00
if (preg_match("/^".TAG."tts (.*)$/", $text, $matches)) {
2015-06-04 04:25:51 -05:00
$mp3 = file_get_contents("http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&text=".urlencode($matches[1]));
2015-06-26 01:14:14 -05:00
$file = fopen($from.".mp3","w");
2015-05-29 11:20:55 -05:00
echo fwrite($file,$mp3);
fclose($file);
2015-06-26 01:14:14 -05:00
$BOT->send_audio($from, "/home/wwwroot/1.vps.dennx.com/".$from.".mp3");
2015-05-29 11:20:55 -05:00
//unlink($matches[1].".mp3");
}