from pyrogram import Client
from pyrogram import types, filters
CHANNEL_ID = -11012345678
app = Client(
"my_account",
api_id=12345,
api_hash="0123456789abcdef0123456789abcdef"
)
@app.on_message(filters=filters.channel)
def my_handler(client: Client, message: types.Message):
if message.chat.id != CHANNEL_ID:
return
print("Получено новое сообщение с ID", message.message_id)
# Как-то обработать сообщение с канала, например, напечатать его текст
print("Текст:", message.text)
app.run()
@app.on_message(filters=filters.channel & ~filters.edited)
class ScanBot
{
public function isBot()
{
$down_reg = mb_strtolower($_SERVER['HTTP_USER_AGENT']);
$down_reg = str_replace(array(' '), '', $down_reg);
$find_bot_step1 = str_replace(array('yandex', 'google', 'yahoo', 'bing'), ' this_is_bot! ', $down_reg);
$find_bot_step2 = explode(' ', $find_bot_step1);
if ($find_bot_step2[1] == "this_is_bot!") {
return true;
}
return false;
}
}
/* чтобы вставить код php в статьях/страницах WordPress, поставьте шоркод: [exec]код[/exec] */
function exec_php($matches){
eval('ob_start();'.$matches[1].'$inline_execute_output = ob_get_contents();ob_end_clean();');
return $inline_execute_output;
}
function inline_php($content){
$content = preg_replace_callback('/\[exec\]((.|\n)*?)\[\/exec\]/', 'exec_php', $content);
$content = preg_replace('/\[exec off\]((.|\n)*?)\[\/exec\]/', '$1', $content);
return $content;
}
add_filter('the_content', 'inline_php', 0);
$ids = array_map(function($n) {
return array_values($n)[0];
}, $array2);
$array1 = array_filter($array1, function($n) use($ids) {
return in_array($n['id'], $ids);
});
// Для элемента
array(
"CONDITION" => "#^/podobrat-dver/([a-z0-9\-]+)/([^/\?]*)(.*)$#",
"RULE" => "SECION_CODE=\$1&ELEMENT_CODE=\$2&$3",
"PATH" => "/podobrat-dver/detail.php",
)
// Для раздела
array(
"CONDITION" => "#^/podobrat-dver/([a-z0-9\-]+)/(.*)$#",
"RULE" => "SECION_CODE=$1&$2",
"PATH" => "/podobrat-dver/section.php",
)
<?$APPLICATION->IncludeComponent(
"bitrix:catalog.element",
"detail",
array(
.....
"IBLOCK_ID" => "30",
"ELEMENT_ID" => "",
"ELEMENT_CODE" => $_REQUEST["ELEMENT_CODE"],
"SECTION_ID" => "",
"SECTION_CODE" => $_REQUEST["SECION_CODE"],
"SECTION_URL" => "",
"DETAIL_URL" => "/podobrat-dver/#ELEMENT_CODE#/",
"SECTION_ID_VARIABLE" => "ELEMENT_CODE",
"SECTION_CODE_PATH" => ""
.....
),
false
);?>
<?$APPLICATION->IncludeComponent(
"bitrix:catalog.section",
"catalog_list",
array(
....
"DETAIL_URL" => "/podobrat-dver/#ELEMENT_CODE#/",
"SECTION_CODE" => $_REQUEST["SECTION_CODE"],
"SECTION_ID" => "",
"SECTION_URL" => "",
"SHOW_ALL_WO_SECTION" => "Y",
....
),
false
);?>