User Control Panel
Advertisements

HELP US, HELP YOU!

Get Bot's Own Username

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


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Tue Jun 14, 2005 2:57 pm    Post subject: Get Bot's Own Username Reply with quote

If you run more dynamic bots, it may be useful to get the current bot's username to tell it apart from the others. Here's how to do so with the various messengers and their modules.

AIM - Net::OSCAR
$screenname = $aim->screenname();
where $aim is the Net::OSCAR object

AIM - Net::AIM
$screenname = $aim->{_conn}->{_screenname};
where $aim is the Net::AIM object

MSN - MSN.pm
$handle = $msn->{Handle};
$handle = $self->{Msn}->{Handle};
where $msn is your MSN server object, and $self is your switchboard object from conversation events

IRC - Net::IRC
$nick = $irc->nick;
where $irc is your Net::IRC object

Jabber Messenger - Net::Jabber::Client
Quote:
I'm not sure how to do a one-liner way of getting the Jabber username, but on initialization (when you're creating the object and still have access to its unique username), you can assign it to a hashref, i.e.
$jabber->{mynick} = $username;

And then you can get the username by doing:
$username = $jabber->{mynick}
where $jabber is your Net::Jabber::Client object


HTTP Daemon - HTTP::Daemon
$url = $daemon->url;
where $daemon is your HTTP::Daemon object
Back to top
draget
Not Yet a God
Not Yet a God


Joined: 29 Dec 2004
Posts: 367
Location: Australia
Reputation: 32.2Reputation: 32.2Reputation: 32.2

PostPosted: Thu Jun 16, 2005 11:24 am    Post subject: Reply with quote

Not to be offensive or anything, you are a great help Cer, but didn't most of us already know this from the various docs?

And if they don't google is their friend, as is often mentioned here.
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Thu Jun 16, 2005 12:55 pm    Post subject: Reply with quote

First of all, maybe HALF of those are documented. The ones that use hashrefs to get it (Net::AIM, MSN) are NOT documented, and the ones you have to "cheat" for like Jabber are ALSO not documented.

And also, Google searches for things such as "Net::AIM screenname" or "Net::AIM own screenname" etc. don't return ANY results about getting the bot's own screenname, EXCEPT for results on--guess what--Bot-Depot!!!

So there are people who don't know, and now they do, and plus I posted this as a reference so people who work with all different protocols don't need to spend half their time searching around for all these little tips and tricks.

So stop waiting to pounce on any kind of error you see Cer potentially make, without Google searching yourself to back up half your b/s claims.
Back to top
Cheater
Senior Member
Senior Member


Joined: 10 Jun 2005
Posts: 236

Reputation: 15.8Reputation: 15.8

PostPosted: Thu Jun 16, 2005 1:04 pm    Post subject: Reply with quote

Cer is right, it takes maybe an hour to find good results on google, but if it's in a thread here, you can easily go find it. And since the thread is writen for a specific reason, they are often easier to understand.
Back to top
MeltingWax
Member
Member


Joined: 27 Jan 2004
Posts: 132
Location: I dunno, but the padded walls are sweet...
Reputation: 30.4Reputation: 30.4Reputation: 30.4

PostPosted: Fri Jun 17, 2005 10:30 pm    Post subject: Reply with quote

Maybe you should have a reference forum, specifically for topics like these.
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