User Control Panel
Advertisements

HELP US, HELP YOU!

How : list convosations and members with mirors?

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl
View unanswered posts
Author Message
Dazzy
Agent
Agent


Joined: 09 Jan 2004
Posts: 1731

Reputation: 72.3

PostPosted: Wed Mar 09, 2005 1:19 pm    Post subject: Reply with quote

Here is my current command :

Code:
sub convos{<br />   my ($bot,$self, $user, $name, $msg, $color) = @_;<br /><br /> foreach my $handle (keys %{$bot->{msn}}){<br />        foreach my $convo (values %{$bot->{msn}->{$handle}->getConvoList()})<br />        {<br />            $users = join(", ",keys %{$convo->getMembers()});<br />            $reply .= "$handle -- $convo->getId .       =>    $users\n";<br /><br />        }<br />    }<br />return $reply;<br />}<br />{<br />   Category => 'MOD',<br />   Description => 'SHOWS A LIST OF CONVOS',<br />   Usage => '!convos',<br />};


Am i using the methods correctly? Im looking through the docs and seeing no documentation of some of these so im starting to wonder wether they're old or just not documented.
Im Preety sure it worked witout mirrors but dont hold me to that...Its not just this i want it for, but my kick command stopped working and i think its because of the same reason.

Heres what i get when i run this command ;

QUOTE(dazzeh's msn window)
Daz says:
!convos
Evolution says:
bot@hotmail.co.uk -- 0 .       =>    dazzy2004@hotmail.com

Daz says:
!convos
Evolution says:
bot@hotmail.co.uk -- 0 .       =>    dazzy2004@hotmail.com
bot@hotmail.co.uk -- 0 .       =>    dazzy2004@hotmail.com
bot@hotmail.co.uk -- 0 .       =>    mikajeejee@hotmail.com

Daz says:
!convos
Daz says:
!convos
Evolution says:
bot@hotmail.co.uk -- 0 .       =>    dazzy2004@hotmail.com
bot@hotmail.co.uk -- 0 .       =>    dazzy2004@hotmail.com
bot@hotmail.co.uk -- 0 .       =>    mikajeejee@hotmail.com
bot@hotmail.co.uk -- 0 .       =>    dazzy2004@hotmail.com


As you can see its adding it up - Plus its showing 0 as the ID for all....

This is whats being used get a reference in my kick command...

Code:
foreach my $handle (keys %{$bot->{msn}}) {<br />my $convo = $bot->{msn}->{$handle}->findMember($msg);<br />}<br />
Back to top
ohsmitt
Newbie
Newbie


Joined: 25 Feb 2005
Posts: 44

Reputation: 19Reputation: 19

PostPosted: Wed Mar 09, 2005 3:37 pm    Post subject: Reply with quote

Try using strict.
Code:
<br />$reply .= "$handle -- $convo->getId .       =>    $users\n";<br />

$reply is not defined.

Every time this sub is run you are appending to $reply it never gets undef. Thats a start.

Also (I think) $convo is actually just the key value pair. It is not a refrence to the actuall variable. so the code should look more like:
Code:
<br />$bot->{msn}->{$handle}->$convo->getId<br />


I don't know where getId really is so that might be wrong but it is definately within $bot->{msn}->{$handle}

Hope that helps a little
Back to top
Dazzy
Agent
Agent


Joined: 09 Jan 2004
Posts: 1731

Reputation: 72.3

PostPosted: Wed Mar 09, 2005 4:05 pm    Post subject: Reply with quote

QUOTE(ohsmitt @ Mar 9 2005, 03:37 PM)
Also (I think) $convo is actually just the key value pair. It is not a refrence to the actuall variable. so the code should look more like:
Code:
<br />$bot->{msn}->{$handle}->$convo->getId<br />


I don't know where getId really is so that might be wrong but it is definately within $bot->{msn}->{$handle}

Hope that helps a little
[right][snapback]46676[/snapback][/right]


$convo is the reference to the current convosation in the foreach. it'd be the same as using $self but i cant use self because that would only bring up the one im using, You're code crashes because it has no object.
Back to top
eric256
The Keymaker
The Keymaker


Joined: 03 May 2006
Posts: 2292
Location: Colorado
Reputation: 47Reputation: 47Reputation: 47Reputation: 47Reputation: 47

PostPosted: Wed Mar 09, 2005 4:53 pm    Post subject: Reply with quote

Add
Code:
<br />my $reply;<br />

At the top of the command so that reply isn't global. Then breack out the call to getID, you can't call a method inside a string like this... well i don't think you can. Anyway this is more likelye to work.
Code:
<br />$reply .= "$handle -- " .  $convo->getId ."     =>    $users\n";<br />

_________________
Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
mat007
Almost An Agent
Almost An Agent


Joined: 12 Jan 2004
Posts: 1375

Reputation: 15.8Reputation: 15.8
votes: 2

PostPosted: Wed Mar 09, 2005 6:49 pm    Post subject: Reply with quote

I'm sure its getID not Id
Back to top
Dazzy
Agent
Agent


Joined: 09 Jan 2004
Posts: 1731

Reputation: 72.3

PostPosted: Wed Mar 09, 2005 6:55 pm    Post subject: Reply with quote

I did what eric said and it seems to have stop the build up but all the ids come to 0....

Updated code:
Code:
sub convos{<br />   my ($bot,$self, $user, $name, $msg, $color) = @_;<br /><br /><br />   my $reply = "Here is a list of the curernt convos:\n\n";<br />  foreach my $handle (keys %{$bot->{msn}}){<br />           foreach my $convo (values %{$bot->{msn}->{$handle}->getConvoList()}){<br />              $users = join(", ",keys %{$convo->getMembers()});<br />               $reply .= "$handle -- " .  $convo->getId ."     =>    $users\n";<br /><br />          }<br />     }<br />  return $reply;<br />}<br />{<br />   Category => 'MOD',<br />   Description => 'SHOWS A LIST OF CONVOS',<br />   Usage => '!convos',<br />};
Back to top
Dazzy
Agent
Agent


Joined: 09 Jan 2004
Posts: 1731

Reputation: 72.3

PostPosted: Wed Mar 09, 2005 7:07 pm    Post subject: Reply with quote

Nice one matt...That works....
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl 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