• 28-03-2021, 17:56:35
    #1
    Çok sevdiğim bir abim Gönüllü Oyun Türkçeleştirme yapıyor Discord Kanallarında da son yayınladıkları yamaların konu bağlantılarını yayınlamak istediklerini söyledi ben PHP kısmını yaptım burada da XenForo 2 Sürümü Forumu için Discord Sunucusu Olan Arkadaşlar işine yarayabileceğini düşündüğüm için paylaşıyorum bunun için ücret talep edenler arkadaşlar var ben size bu konuyu hediye ediyorum Forum ana dizinine php dosyası oluşturun bu dosya ile Discord sunucunuza bot ekleyin
    Demo: http://sinnerclownceviri.com/dcbot.php
    <?php
    /*
    Script Adı:XenForo Discord Bot
    Yazar: Enes BiBER
    Web Site: www.enesbiber.com.tr
    */
    
    $FORUM_id=Array(59);//Konuların Alınıacağı Forum idsi/leri 
    
      function latestPosts($nodeIds=null, $limit=5) {
     $dir = "./src/XF.php"; //Ana dizin deki Xenforo Kütüphanemizin Yolu
    require($dir);
    XF::start($dir);
            $visitor = \XF::visitor();
            $filter = 'latest';
            $router = \XF::app()->router('public');
            $threadRepo = \XF::app()->repository('XF:Thread');
            $postRepo = \XF::app()->repository('XF:Post');
    
            $parser = \XF::app()->bbCode()->parser();
            $rules = \XF::app()->bbCode()->rules('post:rss');
    
            $formatter = \XF::app()->stringFormatter();
            $bbCodeCleaner = \XF::app()->bbCode()->renderer('bbCodeClean');
            $bbCodeRenderer = \XF::app()->bbCode()->renderer('html');
    
            $threadFinder = $threadRepo->findThreadsWithLatestPosts();
    
            $threadFinder
                ->with('Forum.Node.Permissions|' . $visitor->permission_combination_id)
                ->limit(max($limit * 2, 10));
           
            if ($nodeIds && !in_array(0, $nodeIds))
            {
                $threadFinder->where('node_id', $nodeIds);
            }
    
            //$threadFinder->forFullView(true);
    
            $threadFinder
                ->with('LastPoster')
                ->withReadData();
    
            $latestposts = array();
            $maxLength = 120;
           
            foreach ($threads = $threadFinder->fetch() AS $threadId => $thread)
            {
                   
                $post = $postRepo->finder('XF:Post')
                    ->where('Thread.thread_id', $threadId)
                    ->where('message_state', 'visible')
                    ->order('post_id', 'DESC')
                    //->indexHint('FORCE', 'post_date')
                    ->fetchOne();
                $message = $bbCodeCleaner->render($formatter->wholeWordTrim($post->message, $maxLength),$parser, $rules);
                $message = preg_replace('/\[(attach|media|img|spoiler)\]/siU', '', $message);
                $message = preg_replace('/^[\t\s]*(\r?\n){2,}/m', '', $message);
               $konu= $router->buildLink('canonical:threads', $threadId);
                $latestposts[$threadId] = array(
                    'gonderi_id' => $post['post_id'],
                    'konu_sahibi'=>$thread['username'],
                    'konu_id' => $thread['thread_id'],
                    'baslik' => $thread['title'],
                    'KonuLink' => $konu.$threadId,
                    'kategori_id' => $thread['node_id'],
                    'son_yorum' => substr(strip_tags(preg_replace('/\[.*\]/', '', $message)),0,90),
                    'yorum_sahibi' => $post['username'],
                    'ForumBaslik' => $thread['node_title'],
                    'ForumUrl' => $router->buildLink('canonical:forums',array('node_id' => $thread['node_id'], 'title' => $thread['node_title'])),
                    'SonyorumUrl' => $router->buildLink('canonical:posts', $post),
                    'toplamYorum' => $thread['reply_count'],
                    'GonderiTarihi' => $post['post_date']
                );
            }
            //$latestthreads = $latestthreads->slice(0, $limit, true);
    
    return $latestposts;
        
        //  return $thread;
      }
    
    //var_dump(latestPosts($FORUM_id,1));
    $sonkonular=latestPosts($FORUM_id,100);
    header('Content-Type: application/json');
    
    echo $veri=json_encode($sonkonular,JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
    
    ?>
  • 01-12-2021, 23:17:10
    #2
    Kimlik doğrulama veya yönetimden onay bekliyor.
    lazenes adlı üyeden alıntı: mesajı görüntüle
    Çok sevdiğim bir abim Gönüllü Oyun Türkçeleştirme yapıyor Discord Kanallarında da son yayınladıkları yamaların konu bağlantılarını yayınlamak istediklerini söyledi ben PHP kısmını yaptım burada da XenForo 2 Sürümü Forumu için Discord Sunucusu Olan Arkadaşlar işine yarayabileceğini düşündüğüm için paylaşıyorum bunun için ücret talep edenler arkadaşlar var ben size bu konuyu hediye ediyorum Forum ana dizinine php dosyası oluşturun bu dosya ile Discord sunucunuza bot ekleyin
    Demo: http://sinnerclownceviri.com/dcbot.php
    <?php
    /*
    Script Adı:XenForo Discord Bot
    Yazar: Enes BiBER
    Web Site: www.enesbiber.com.tr
    */
    
    $FORUM_id=Array(59);//Konuların Alınıacağı Forum idsi/leri 
    
      function latestPosts($nodeIds=null, $limit=5) {
     $dir = "./src/XF.php"; //Ana dizin deki Xenforo Kütüphanemizin Yolu
    require($dir);
    XF::start($dir);
            $visitor = \XF::visitor();
            $filter = 'latest';
            $router = \XF::app()->router('public');
            $threadRepo = \XF::app()->repository('XF:Thread');
            $postRepo = \XF::app()->repository('XF:Post');
    
            $parser = \XF::app()->bbCode()->parser();
            $rules = \XF::app()->bbCode()->rules('post:rss');
    
            $formatter = \XF::app()->stringFormatter();
            $bbCodeCleaner = \XF::app()->bbCode()->renderer('bbCodeClean');
            $bbCodeRenderer = \XF::app()->bbCode()->renderer('html');
    
            $threadFinder = $threadRepo->findThreadsWithLatestPosts();
    
            $threadFinder
                ->with('Forum.Node.Permissions|' . $visitor->permission_combination_id)
                ->limit(max($limit * 2, 10));
           
            if ($nodeIds && !in_array(0, $nodeIds))
            {
                $threadFinder->where('node_id', $nodeIds);
            }
    
            //$threadFinder->forFullView(true);
    
            $threadFinder
                ->with('LastPoster')
                ->withReadData();
    
            $latestposts = array();
            $maxLength = 120;
           
            foreach ($threads = $threadFinder->fetch() AS $threadId => $thread)
            {
                   
                $post = $postRepo->finder('XF:Post')
                    ->where('Thread.thread_id', $threadId)
                    ->where('message_state', 'visible')
                    ->order('post_id', 'DESC')
                    //->indexHint('FORCE', 'post_date')
                    ->fetchOne();
                $message = $bbCodeCleaner->render($formatter->wholeWordTrim($post->message, $maxLength),$parser, $rules);
                $message = preg_replace('/\[(attach|media|img|spoiler)\]/siU', '', $message);
                $message = preg_replace('/^[\t\s]*(\r?\n){2,}/m', '', $message);
               $konu= $router->buildLink('canonical:threads', $threadId);
                $latestposts[$threadId] = array(
                    'gonderi_id' => $post['post_id'],
                    'konu_sahibi'=>$thread['username'],
                    'konu_id' => $thread['thread_id'],
                    'baslik' => $thread['title'],
                    'KonuLink' => $konu.$threadId,
                    'kategori_id' => $thread['node_id'],
                    'son_yorum' => substr(strip_tags(preg_replace('/\[.*\]/', '', $message)),0,90),
                    'yorum_sahibi' => $post['username'],
                    'ForumBaslik' => $thread['node_title'],
                    'ForumUrl' => $router->buildLink('canonical:forums',array('node_id' => $thread['node_id'], 'title' => $thread['node_title'])),
                    'SonyorumUrl' => $router->buildLink('canonical:posts', $post),
                    'toplamYorum' => $thread['reply_count'],
                    'GonderiTarihi' => $post['post_date']
                );
            }
            //$latestthreads = $latestthreads->slice(0, $limit, true);
    
    return $latestposts;
        
        //  return $thread;
      }
    
    //var_dump(latestPosts($FORUM_id,1));
    $sonkonular=latestPosts($FORUM_id,100);
    header('Content-Type: application/json');
    
    echo $veri=json_encode($sonkonular,JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
    
    ?>
    Teşekkürler Kardeşim