Repost-vk

Материал из wiki-MyMakerBot

Назад: Авто репост

{key_clear}
{if !isset($black_list)}{$black_list=[]}{/if}
{if !isset($white_list)}{$white_list=[]}{/if}
{if !isset($registered)}{$registered=1}{/if}
{if !isset($src_link)}{$src_link=1}{/if}
{if !isset($sign)}{$sign=''}{/if}
{if !isset($sign_up)}{$sign_up=''}{/if}
{if !isset($media_post)}{$media_post=1}{/if}
{if !isset($ads)}{$ads=0}{/if}
{if !isset($group)}{$group='vk'}{/if}
{if !isset($show_message)}{$show_message=1}{/if}
{if !isset($show_photo)}{$show_photo=1}{/if}
{if !isset($show_links)}{$show_links=1}{/if}
{if !isset($show_videos)}{$show_videos=1}{/if}
{if !isset($show_video_details)}{$show_video_details=1}{/if}
{if !isset($show_docs)}{$show_docs=1}{/if}
{if !isset($show_media)}{$show_media=1}{/if}
{if !isset($show_audio)}{$show_audio=1}{/if}
{if !isset($show_poll)}{$show_poll=1}{/if}

{if $v.message|check_black_list:$black_list && $v.message|check_white_list:$white_list 
    && (!$registered || !$v.guid|group_vk:$group:1) 
    && (!$v.marked_as_ads || ($v.marked_as_ads && $ads))
    }
{* tg_sendMessage text=$v|json  disable_web_page_preview=1 *}
{if !isset($keys)}{$keys=0}{/if}

{$v.message=$v.message|vk_link:true}

{* SIGN *}
{if $sign }
{$v.message = "{$v.message}
{$sign}"}
{/if}
{if $sign_up }
{$v.message = "{$sign}
{$v.message}"}
{/if}

{* LINKS *}
{if count($v.link)>0 && $show_links}
  {foreach from=$v.link key=k item=v2}
    {$url=$v2['url']}
    {$msg="​"}
    {if (isset($v2['title']) && !empty($v2['title']) )}{$msg=$v2['title']}{/if}
    {$v.message = "`$v.message` 
    
🔗 <a href='{$url}'>{$msg}</a>
`$v2.description`"}
    {if $keys}
	 {key l=10+k t=$msg c=$url}
    {/if} 
  {/foreach}
{/if}

{* VIDEOS *}
{if count($v.video)>0 && $show_videos}
{foreach from=$v.video key=k item=v2}
{$url="https://vk.com/video`$v['owner_id']`_`$v2['id']`"}
{$msg="video"}
{if (isset($v2['title']) && !empty($v2['title']) && $show_video_details)}{$msg=$v2['title']}{/if}
    {$v.message = "`$v.message` 
🎥 <a href='{$url}'>{$msg}</a>"}
{if (isset($v2['views']) && !empty($v2['views']) && $show_video_details)}
    {$v.message = "`$v.message` 
  👁 <i>{$v2['views']} раз</i>"}
{/if}
{if (isset($v2['duration']) && !empty($v2['duration']) && $show_video_details)}
    {$v.message = "`$v.message` 
  ⏳ <i>{$v2['duration']} сек.</i>"}
{/if}
{/foreach}
{/if}
{key_clear}


{* DOC *}
{if count($v.doc)>0 && $show_docs}
  {foreach from=$v.doc key=k item=v2}
    {$url=$v2['url']}
    {$msg="​"}
    {if $v2['ext'] == 'gif'}
         {tg_sendVideofile chat_id=$chat_id video="{$v2['url']}&mp4=1" caption=$v.message}
         {$v.message=''}
    {else}     
      {if (isset($v2['title']) && !empty($v2['title']) )}{$msg=$v2['title']}{/if}
      {$v.message = "`$v.message` 
    
📝 <a href='{$url}'>{$msg}</a>"}
    {if $keys}
	{key l=10+k t=$msg c=$url}
    {/if}
        {/if}

  {/foreach}
{/if}

{if isset($like) && $like}
	{import c=$like}
{/if}



{* ССЫЛКА НА ИСТОЧНИК *}
{if $src_link && !empty($v.message) && !empty($src_link)}
{$v.message = "`$v.message`

<a href='{$v.src_link}'>➰ ВК</a>"}
{/if}


  {* ==== SEND MEDIA IF count(photo) == 1 *}
  {if count($v.photo) == 1 && mb_strlen($v.message, 'utf-8') <= 1000 && $show_photo}
      {tg_sendPhoto chat_id=$chat_id photo=$v.photo[0]['media'] caption = $v.message|vk_link:true keys=1}
  {/if}

  {* ==== SEND MEDIA IF count(photo)>=2 *}
  {if count($v.photo) >= 2 && $media_post}
      {if mb_strlen($v.message, 'utf-8') <= 1000}
        {tg_sendMediaGroup chat_id=$chat_id media=$v.photo caption=$v.message}
      {else}
        {tg_sendMediaGroup chat_id=$chat_id media=$v.photo caption=''}
      {/if}
  {/if}


  {if ((count($v.photo) == 0 || (count($v.photo) >= 1 && mb_strlen($v.message, 'utf-8') > 1000) ) && $show_message )}
     {tg_sendMessage text=$v.message chat_id=$chat_id disable_web_page_preview=0 keys=1}
  {/if}  

{* ОТПРАВКА АУДИОФАЙЛОВ ЕСЛИ ЕСТЬ *} 
  {if count($v.audio) > 0 && $show_audio}
  {foreach from=$v.audio item=a}
      {if (isset($a.url) && $a.url !== 'https://vk.com/mp3/audio_api_unavailable.mp3')}
          {tg_sendAudiofile chat_id=$chat_id audio=$a.url artist=$a.artist title=$a.title}
      {/if}
  {/foreach}
  {/if}
  
{* ГОЛОСОВАНИЕ *}  
  {if !empty($v.poll) && $show_poll}
    {$ans=[]}
	{foreach from=$v.poll.answers item=a}
       {$ans[]=$a.text}
    {/foreach}
	{tg_sendPoll question=$v.poll.question options=$ans chat_id=$chat_id keys=1}
  {/if}
{/if}