on/off switcher for pwrtelegram peer info requests (#105)
This commit is contained in:
parent
f226973d47
commit
9650a77b89
@ -357,7 +357,7 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
|
|||||||
'allow_threading' => false, // Should I use threading, if it is enabled?
|
'allow_threading' => false, // Should I use threading, if it is enabled?
|
||||||
'handler_workers' => 10, // How many workers should every message handler pool of each socket reader have
|
'handler_workers' => 10, // How many workers should every message handler pool of each socket reader have
|
||||||
],
|
],
|
||||||
'pwr' => ['pwr' => false, 'db_token' => false, 'strict' => false],
|
'pwr' => ['pwr' => false, 'db_token' => false, 'strict' => false, 'requests' => true],
|
||||||
];
|
];
|
||||||
$settings = $this->array_replace_recursive($default_settings, $settings);
|
$settings = $this->array_replace_recursive($default_settings, $settings);
|
||||||
if (!isset($settings['app_info']['api_id'])) {
|
if (!isset($settings['app_info']['api_id'])) {
|
||||||
|
@ -211,12 +211,14 @@ trait PeerHandler
|
|||||||
return $this->gen_all($this->chats[$id]);
|
return $this->gen_all($this->chats[$id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$dbres = json_decode(file_get_contents('https://id.pwrtelegram.xyz/db/getusername?id='.$id, false, stream_context_create(['http'=> [
|
if (!isset($this->settings['pwr']) || $this->settings['pwr']['requests'] === true) {
|
||||||
'timeout' => 2,
|
$dbres = json_decode(file_get_contents('https://id.pwrtelegram.xyz/db/getusername?id='.$id, false, stream_context_create(['http'=> [
|
||||||
],
|
'timeout' => 2,
|
||||||
])), true);
|
],
|
||||||
if ($dbres['ok']) {
|
])), true);
|
||||||
return $this->get_info('@'.$dbres['result']);
|
if ($dbres['ok']) {
|
||||||
|
return $this->get_info('@'.$dbres['result']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
throw new \danog\MadelineProto\Exception("Couldn't find peer by provided chat id ".$id);
|
throw new \danog\MadelineProto\Exception("Couldn't find peer by provided chat id ".$id);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user