Skip to content

Commit

Permalink
update perbaikan
Browse files Browse the repository at this point in the history
  • Loading branch information
fadhil-riyanto committed Mar 26, 2021
1 parent 2c03c30 commit 5bd3451
Show file tree
Hide file tree
Showing 7 changed files with 219 additions and 21 deletions.
74 changes: 59 additions & 15 deletions anime_command/__init__.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,68 @@
<?php
$animecomm = explode(' ', $text);
function cek_apakah_anime_ada($cek)

function animecheck($string)
{
global $hasilcommand;
$cek = substr($cek, 1);
$gets = file_get_contents('https://waifu.pics/api/sfw/' . $cek);
$dec = json_decode($gets);
if ($dec == null) {
return false;
} elseif (isset($dec->message) && $dec->message == "Not Found") {
$string = strtolower($string);
$dict = array(
'/waifu' => 'waifu',
'/neko' => 'neko',
'/shinobu' => 'shinobu',
'/megumin' => 'megumin',
'/bully' => 'bully',
'/cuddle' => 'cuddle',
'/cry' => 'cry',
'/hug' => 'hug',
'/awoo' => 'awoo',
'/kiss' => 'kiss',
'/lick' => 'lick',
'/pat' => 'pat',
'/smug' => 'smug',
'/bonk' => 'bonk',
'/yeet' => 'yeet',
'/blush' => 'blush',
'/smile' => 'smile',
'/wave' => 'wave',
'/smile' => 'smile',
'/wave' => 'wave',
'/highfive' => 'highfive',
'/handhold' => 'handhold',
'/nom' => 'nom',
'/bite' => 'bite',
'/glomp' => 'glomp',
'/kill' => 'kill',
'/slap' => 'slap',
'/happy' => 'happy',
'/wink' => 'wink',
'/poke' => 'poke',
'/dance' => 'dance',
'/cringe' => 'cringe',
'/blush' => 'blush'
);
if (isset($dict[$string])) {
return $dict[$string];
} else {
return false;
}
}

$ngecekanime = animecheck($adanParse_plain_nokarakter[0]);
if ($ngecekanime == false) {
$exuser = explode('@', strtolower($adanParse_plain_nokarakter[0]));
$konf = animecheck($exuser[0]);
if ($konf == false) {
$animecek = false;
} else {
$hasilcommand = $cek;
return true;
$animecek = true;
$animeget = $konf;
}
} else {
$animecek = true;
$animeget = $ngecekanime;
}
$checkanime = cek_apakah_anime_ada($animecomm[0]);
if ($checkanime == true) {
$imganimedec = json_decode(file_get_contents('https://waifu.pics/api/sfw/' . $hasilcommand));

if ($animecek == true) {
$imganimedec = json_decode(file_get_contents('https://waifu.pics/api/sfw/' . $animeget));
$content = array('chat_id' => $chat_id, 'photo' => $imganimedec->url, 'reply_to_message_id' => $message_id, 'disable_web_page_preview' => true);
$telegram->sendPhoto($content);
exit;
} else {
}
18 changes: 16 additions & 2 deletions command/carbon.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@
$telegram->sendMessage($content);
exit;
} else {

function generateRandomString_files($length = 10)
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}


$reply = 'Tunggu sebentar, kami sedang meng-generate image (sync)';
$content = array('chat_id' => $chat_id, 'text' => $reply, 'reply_to_message_id' => $message_id, 'parse_mode' => 'html', 'disable_web_page_preview' => true);
$editmsg = $telegram->sendMessage($content);
Expand All @@ -23,15 +36,16 @@
));

$result = curl_exec($ch);
$output = __DIR__ . '/../tmp/carbonimg.png';
$randomstrings = generateRandomString_files(40);
$output = __DIR__ . '/../tmp/' . $randomstrings . '.png';
file_put_contents($output, $result);
$bot_url = "https://api.telegram.org/bot" . TG_HTTP_API . "/";
$url = $bot_url . "sendDocument?chat_id=" . $chat_id;

$post_fields = array(
'chat_id' => $chat_id,
'reply_to_message_id' => $message_id,
'document' => new CURLFile(realpath('tmp/carbonimg.png'))
'document' => new CURLFile(realpath('tmp/' . $randomstrings . '.png'))
);

$ch = curl_init();
Expand Down
8 changes: 5 additions & 3 deletions json_data/group_command/adminlist.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
[
{
"gid": -1001182246595,
"timelapsce": 1616689072,
"timelapsce": 1616740331,
"admin": [
466284462,
1214724816,
605166480,
1355798219,
1393342467,
1349919799,
1051577909,
1195226552,
617426792,
415839164,
Expand All @@ -16,7 +18,7 @@
},
{
"gid": -1001209274058,
"timelapsce": 1616689199,
"timelapsce": 1616740195,
"admin": [
466284462,
1355798219,
Expand All @@ -29,7 +31,7 @@
},
{
"gid": -1001310420564,
"timelapsce": 1616730483,
"timelapsce": 1616738947,
"admin": [
1489990155,
1349919799,
Expand Down
28 changes: 28 additions & 0 deletions json_data/user_delay_time.json
Original file line number Diff line number Diff line change
Expand Up @@ -3426,5 +3426,33 @@
{
"userid": 1393342467,
"time": 1616735979
},
{
"userid": 1393342467,
"time": 1616736725
},
{
"userid": 1393342467,
"time": 1616738718
},
{
"userid": 1393342467,
"time": 1616738777
},
{
"userid": 1393342467,
"time": 1616738785
},
{
"userid": 1393342467,
"time": 1616739198
},
{
"userid": 1393342467,
"time": 1616739309
},
{
"userid": 1393342467,
"time": 1616739536
}
]
84 changes: 84 additions & 0 deletions logs/TelegramErrorLogger-2021-03-26.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
============[Date]============
[ 2021-03-26 12:32:15 Asia/Jakarta ]
==========[Response]==========
ok: False
error_code: 400
description: Bad Request: failed to get HTTP URL content
=========[Sent Data]==========
[ref]
ref.update_id= 804443424
ref.message.message_id= 21989
ref.message.from.id= 1393342467
ref.message.from.is_bot= false
ref.message.from.first_name= Fadhil
ref.message.from.last_name= Riyanto
ref.message.from.username= fadhil_riyanto
ref.message.from.language_code= ms
ref.message.chat.id= 1393342467
ref.message.chat.first_name= Fadhil
ref.message.chat.last_name= Riyanto
ref.message.chat.username= fadhil_riyanto
ref.message.chat.type= private
ref.message.date= 1616736725
ref.message.text= /neko
ref.message.entities.0.offset= 0
ref.message.entities.0.length= 5
ref.message.entities.0.type= bot_command


[ref]
ref.photo= https://i.waifu.pics/hd-3qtP.jpg
ref.reply_to_message_id= 21989
ref.disable_web_page_preview= true


============[Trace]===========
#0 C:\bot telegram\vendor\eleirbag89\telegrambotphp\Telegram.php(662): TelegramErrorLogger::log(Array, Array)
#1 C:\bot telegram\vendor\eleirbag89\telegrambotphp\Telegram.php(46): Telegram->sendAPIRequest('https://api.tel...', Array)
#2 C:\bot telegram\vendor\eleirbag89\telegrambotphp\Telegram.php(75): Telegram->endpoint('sendPhoto', Array)
#3 C:\bot telegram\anime_command\__init__.php(22): Telegram->sendPhoto(Array)
#4 C:\bot telegram\hook.php(702): require('C:\\bot telegram...')
#5 {main}

============[Date]============
[ 2021-03-26 13:06:21 Asia/Jakarta ]
==========[Response]==========
ok: False
error_code: 400
description: Bad Request: wrong file identifier/HTTP URL specified
=========[Sent Data]==========
[ref]
ref.update_id= 804443446
ref.message.message_id= 22000
ref.message.from.id= 1393342467
ref.message.from.is_bot= false
ref.message.from.first_name= Fadhil
ref.message.from.last_name= Riyanto
ref.message.from.username= fadhil_riyanto
ref.message.from.language_code= ms
ref.message.chat.id= 1393342467
ref.message.chat.first_name= Fadhil
ref.message.chat.last_name= Riyanto
ref.message.chat.username= fadhil_riyanto
ref.message.chat.type= private
ref.message.date= 1616738717
ref.message.text= /neko
ref.message.entities.0.offset= 0
ref.message.entities.0.length= 5
ref.message.entities.0.type= bot_command


[ref]
ref.photo= https://i.waifu.pics/L6NFl2g.png
ref.reply_to_message_id= 22000
ref.disable_web_page_preview= true


============[Trace]===========
#0 C:\bot telegram\vendor\eleirbag89\telegrambotphp\Telegram.php(662): TelegramErrorLogger::log(Array, Array)
#1 C:\bot telegram\vendor\eleirbag89\telegrambotphp\Telegram.php(46): Telegram->sendAPIRequest('https://api.tel...', Array)
#2 C:\bot telegram\vendor\eleirbag89\telegrambotphp\Telegram.php(75): Telegram->endpoint('sendPhoto', Array)
#3 C:\bot telegram\anime_command\__init__.php(22): Telegram->sendPhoto(Array)
#4 C:\bot telegram\hook.php(702): require('C:\\bot telegram...')
#5 {main}

2 changes: 1 addition & 1 deletion pengaturan/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"no": 1,
"debug": true
"debug": false
}
]
26 changes: 26 additions & 0 deletions tmp/iffb0OCFACDXS3Xb63mns4qh46vCiKxeHhEl3N7n.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5bd3451

Please sign in to comment.