User Control Panel
Advertisements

HELP US, HELP YOU!

Plus! Live - Audio Emoticons

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Commands
View unanswered posts
Author Message
Teario
Member
Member


Joined: 25 Jun 2004
Posts: 130
Location: Liverpool(home) or Derby(uni), UK
Reputation: 59.8
votes: 3

PostPosted: Mon Jul 03, 2006 10:18 pm    Post subject: Plus! Live - Audio Emoticons Reply with quote

Msg+ Live has a feature called Audio Emoticons. Very similar to the voice clips, but users upload an audio emoticon and then you can download one at random. This command gets the ID of an emoticon from the server and then sends the message that Msg+ picks up as an ID for this feature.

If the recipient has Msg+ Live, the sound clip will be downloaded to their pc and played in the conversation.

The code is for my own bot, but it should be pretty simple to convert to work for any of the available template.

Code:
sub
{
   my( $self, $user, $friendly, $params, %style ) = @_;

   #1 = cartoons/games
   #2 = TV/Movies
   #3 = Music
   #4 = Vocals
   #5 = Sound Effects

   require HTTP::Request;
   my $request = HTTP::Request->new( GET => 'http://sounds.msgpluslive.net/esnd/snd/random?catId=2' );
   my $ua = LWP::UserAgent->new( agent => 'MessengerPlusLive' );
   my $response = $ua->request($request);

   my $data = $response->{'_headers'}->header( 'content-disposition' );

   $data =~ m/"#(.*?)\..*?"/;
   my $id = $1;

   $self->sendMessage( '[Messenger Plus! Sound] - Data{'.$id.'}\302\240-\302\240Random Song\302\240' );
}


The numbers correspond to the category. Place them in the catId field to get audio emoticons for that category. The default is 2, because those ones are the most fun Smile

There is one error which I cannot figure out how to fix, sometimes Msg+ wont realise its a sound clip (I assume that some are sent differently to others) and will display the message that should have been picked up as though it was a normal message sent by the user.

It doesnt happen often so it shouldnt be too much of a problem.

Hope you enjoy it Smile

Edit: Here is an example:
Quote:
[Teario] says (23:19):
!AudioEmote
[Crybot] is sending a sound.
Action: Play "attila"

[Teario] says (23:20):
!AudioEmote
[Crybot] is sending a sound.
Action: Play "Fat"
Back to top
mattaustin
Sentinel
Sentinel


Joined: 19 Jul 2004
Posts: 556
Location: Los Angeles, CA
Reputation: 50.7
votes: 1

PostPosted: Wed Jul 05, 2006 8:51 pm    Post subject: Reply with quote

This is a really cool command. Something you may want to do to make it faster is use LWP::Simple head function.. that way your bot dosnt actually download the contents of the file, just get the headers:

Code:
use LWP::Simple;
my ($id) = head('http://sounds.msgpluslive.net/esnd/snd/random?catId=2')->
      {_headers}->{'content-disposition'} =~ m/#(.*?)\./;

_________________
[ matt ]
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Commands All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group