Показать сообщение отдельно

  #3  
Старый 10.09.2008, 14:35
biophreak
Постоянный
Регистрация: 03.08.2007
Сообщений: 367
Провел на форуме:
876216

Репутация: 209
По умолчанию

Выкладывал тут с примитивными ф-иями, бот юзает все тот же Net::OSCAR, простейшего бота на нем написать,который будет отвечать "Привет" на любое сообщение - 10 строчек максимум)
Так же делал ICQ2IRC гейт на базе него-же( http://icq2irc.googlecode.com )
Вот пример бота
Код:
#!/usr/bin/perl -s
use strict;
use warnings;
use diagnostics;
use Net::OSCAR;
my $uin = 123456;
my $passwd = 'qwerty';
my $adminuin = 654321; ## Your UIN
my $icq = Net::OSCAR->new;
$icq->set_callback_im_in(\&in) or die '[ERROR] [Cannot set callback] [$!]';
$icq->signon($uin, $passwd) or die '[ERROR] [Cannot sign on] [$!]';
$icq->do_one_loop while (not $icq->is_on);
$icq->do_one_loop while ($icq->is_on);
sub in {
	my($oscar, $sender, $message, $is_away) = @_;
	print "$sender: $message\n";
	$oscar->signoff() if ($message eq '!quit'  and $sender eq $adminuin);
	$oscar->send_im($sender,`uptime`) if ($message eq '!uptime' and $sender eq $adminuin);

}

Последний раз редактировалось biophreak; 10.09.2008 в 15:19..