This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

WP Eggdrop error

Support & discussion of released scripts, and announcements of new releases.
Post Reply
f
fhazal
Voice
Posts: 3
Joined: Tue Feb 07, 2023 3:17 pm

WP Eggdrop error

Post by fhazal »

hye can anybody help, i can't make the eggdrop post a message to channel when creating a new post from wordpress. i keep receive " Lost connection while resolving hostname [103.*.198.**/5**60]" after trying to create a new post my wordpress website, im using wp eggdrop module for wordpress and wp-eggdrop.tcl for the eggdrop.

this is the tcl :

Code: Select all

set listenport "098765"
# port for your script you want to listen on (you need to set same port in php script)
set password "mypasswd"
# password (you need to set same password in php script)
set chan "#chat"

# channel you want to send output to
listen $listenport script botlisten

proc botlisten {idx} {
	control $idx botlisten2
} 

proc botlisten2 {idx args} {

	set args [join $args] 
	set password1 [lindex [split $args] 0]
	set message [join [lrange [split $args] 1 end]]
	
	if {[string match $::password $password1]} {
		putquick "PRIVMSG $::chan :$message"
	} else {
		putlog "Unauthorized person tried to connect to the bot"
	}
}

putlog "WP Eggdrop script loaded!"
this is the web code :

Code: Select all

<?php
/*
Plugin Name: WP Eggdrop
Plugin URI: http://codeninja.me.uk/plugins/wp-eggdrop/?ref=wp-eggdrop
Version: 0.1
Description: Sends data to a eggdrop bot that annouces into IRC.
Author: Iain Cambridge
Author URI: http://codeninja.me.uk/?ref=wp-eggdrop
*/




function wpegg_scriptInstall(){
    
    // Put in empty options
    add_option("wpegg_server", "",NULL,"no");
    add_option("wpegg_port","",NULL,"no");
    add_option("wpegg_password","",NULL,"no");
    add_option("wpegg_message","",NULL,"no");
        
}

register_activation_hook(__FILE__, 'wpegg_scriptInstall');


function wpegg_handlePost($PostID){
    
    /*
     * %A == Author Display Name
     * %a == Author Full Name 
     * %d == Post Date
     * %D == Post Date GMT
     * %C == All catergories
     * %c == 1st catergory.
     * %T == Post's Title
     * %t == Post's slug (url friendly title)
     * %U == Permalink URL
     */
    
    $Post = get_post($PostID);
    $Bot = wpegg_getOptions();
    $Message = $Bot['Message'];        
    $Permalink = get_permalink($PostID);
    // Get author details.
    if ((strstr($Message,"%A")) || (strstr($Message,"%a")) ){
    
        $User = get_userdata($Post->post_author);
            
        $Message = str_replace("%a","{$User->first_name} {$User->last_name}",$Message);
        $Message = str_replace("%A",$User->display_name,$Message);
            
    }
        
        // Get catergory name.
    if (strstr($Message,"%C")){
            
        foreach((get_the_category($PostID)) as $category) { 
            $Cat .= $category->cat_name . ' '; 
        } 
            
        $Message =  str_replace("%C",$Cat,$Message);
            
    }
        
    if (strstr($Message,"%c")){
            
        $Catergories = get_the_category($PostID);
            
        $Message = str_replace("%c",$Catergories[0]->category_nicename,$Message);
            
    }
        
       
    $Message = str_replace("%d",$Post->post_date,$Message);
    $Message = str_replace("%D",$Post->post_date_gmt,$Message);
    $Message = str_replace("%t",$Post->post_name,$Message);
    $Message = str_replace("%T",$Post->post_title,$Message);
    $Message = str_replace("%U",$Permalink,$Message);
        
        
    wpegg_sendMessage($Bot['Server'],$Bot['Port'],$Bot['Password'],$Message);
    
  
    
}


// Send the message

function wpegg_sendMessage($BotServer,$BotPort,$BotPassword,$BotMessage){
    
    $fp = fsockopen($BotServer, $BotPort, $errno, $errstr, 40);
    
    if($fp)
    {
        if ( !fputs($fp, $BotPassword . " " . $BotMessage . "\r\n") ){
        	trigger_error('Unable to sent message, check php settings');
        }
    }
    
    fclose($fp);
}

add_action('publish_post', 'wpegg_handlePost');

//
// Get the options.
// 

function wpegg_getOptions(){

        $Bot['Server']   = get_option("wpegg_server");
        $Bot['Port']     = get_option("wpegg_port");
        $Bot['Password'] = get_option("wpegg_password");
        $Bot['Message']  = get_option("wpegg_message"); 
        return $Bot;
}

//
// Show Options Page!
//

function wpegg_showOptions(){
    
    ?>
    <div class="wrap">
  	    <div id="icon-options-general" class="icon32"><br /></div>    
        <h2>WP Eggdrop</h2>
        
    <?php 
        
    if (isset($_POST['wpegg_submit'])){
        
        
        // Data been submitted.
        $Errors = wpegg_updateOptions(); // send to be validated and updated.
        
        // Set vars
        $Bot['Server']   = $_POST['wpegg_server']; 
        $Bot['Port']     = $_POST['wpegg_port'];
        $Bot['Password'] = $_POST['wpegg_password'];
        $Bot['Message']  = $_POST['wpegg_message']; 
        
        if (!empty($Errors)){ // Display errors.
        ?>
        <p>
            <ol style="list-style-type: decimal;">
                <?php foreach ($Errors as $Error){?>
                <li style="color: red;font-weight: bold;"><?php echo $Error; ?></li>
                <?php } ?>
            </ol>
        </p>
        <?php 
        }
        else { // Display updated notice!
            ?><div id="message" class="updated fade"><p>Options updated!</p></div>
            <?php 
        }
    }
    else{
        // Get bot options from SQL
        $Bot = wpegg_getOptions();
    }
    ?>
        <form method='post' action='?<?php echo $_SERVER['QUERY_STRING']?>'>
        
        <table class="form-table">
        
            <tr valign="top">
                <th scope="row">Bot Server/IP</th>
                <td><input type="text" name="wpegg_server" value="<?php echo $Bot['Server']; ?>" /></td>
            </tr>
            
            <tr valign="top">
                <th scope="row">Bot Port</th>
                <td><input type="text" name="wpegg_port" value="<?php echo $Bot['Port']; ?>" /></td>
            </tr>
            
            <tr valign="top">
                <th scope="row">Bot Password</th>
                <td><input type="text" name="wpegg_password" value="<?php echo $Bot['Password']; ?>" /></td>
            </tr>
            
            <tr valign="top">
                <th scope="row">Bot Message</th>
                <td><input type="text" name="wpegg_message" value="<?php echo $Bot['Message']; ?>" /></td>
            </tr>
        
        </table>

        <p class='submit'>
                <input type="submit" name="wpegg_submit" value="Update Options »" />
            </p>
            
           </form>
           
           <p>
               <ol>Message Formatting
                   <li>%A - Author's display name</li>
                   <li>%a - Author's full name</li>
                   <li>$d - Post Date</li>
                   <li>%D - Post Date GMT</li>
                   <li>%C - All catergories seperated by a space</li>
                   <li>%c - The first catergory</li>
                   <li>%T - Post Title</li>
                   <li>%t - Post slug (url friendly title)</li>
                   <li>%U - Post permalink (web address)</li>
               </ol>
           </p>
       </div>
    <?php 
}

function wpegg_updateOptions(){
    
    $Errors = array();
    
    // Validate the information.
    if(empty($_POST['wpegg_server'])){
        $Errors[] = "Server/IP cannot be blank.";
    }
    
    if ($_POST['wpegg_port'] == ""){
        $Errors[] = "Port cannot be blank.";
    }
    elseif (!is_numeric($_POST['wpegg_port'])){
        $Errors[] = "Port has to be a number";
    }
    
    if (empty($_POST['wpegg_password'])){
        $Errors[] = "Password cannot be blank";
    }
    
    if (empty($_POST['wpegg_message'])){
        $Errors[] = "Password cannot be blank";
    }
    
    if (empty($Errors)){
        update_option("wpegg_server",$_POST['wpegg_server']);
        update_option("wpegg_port",$_POST['wpegg_port']);
        update_option("wpegg_password",$_POST['wpegg_password']); 
        update_option("wpegg_message",$_POST['wpegg_message']);        
    }
    
    return $Errors;
}

// Add to menu.

function wpegg_addMenu(){
    add_options_page('WP Eggdrop Settings', 'WP Eggdrop Settings', 'manage_options', 'wpegg', 'wpegg_showOptions');
}

add_filter('admin_menu','wpegg_addMenu');

?>
i keep receiving this msg from the party line :

[02/08 03:11:32] <Sentinel> [19:11:15] Lost connection while resolving hostname [103.*.198.**/5**60]
[02/08 03:11:38] <Sentinel> [19:11:21] Lost connection while resolving hostname [103.*.198.**/5**60]

got the script from : https://github.com/rastaval/wp-eggdrop

if anyone can suggest to me a new eggdrop script that can make it post my new website post (wordpress) to my irc channel also good.
User avatar
CrazyCat
Revered One
Posts: 1217
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Use rss-synd to access your wordpress rss feed.
No need to have a plugin in wordpress and rss-synd works well.
f
fhazal
Voice
Posts: 3
Joined: Tue Feb 07, 2023 3:17 pm

Post by fhazal »

CrazyCat wrote:Use rss-synd to access your wordpress rss feed.
No need to have a plugin in wordpress and rss-synd works well.
do u know which tcl is working for rss synd, i try a couple but its not working.

im searching for auto post to irc channel for every new post on wordpress without need to !rss command.
User avatar
CrazyCat
Revered One
Posts: 1217
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Last edited by CrazyCat on Thu Feb 09, 2023 7:24 pm, edited 1 time in total.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

The link you provided leads me to TCL Archive's main page, nothing is selected in particular.
Once the game is over, the king and the pawn go back in the same box.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Remove the dot at the end of the URL, and it'll work a lot better.
NML_375
User avatar
CrazyCat
Revered One
Posts: 1217
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Sorry, I've removed the point. I didn't check my post, so didn't see the point was took as a part of the url
Post Reply