mIRC Home    About    Download    Register    News    Help

Print Thread
#205821 01/11/08 07:26 PM
Joined: Oct 2008
Posts: 167
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
Is there a way to let people login to your bot?

e.g. (in PM)
Quote:
<User> login User Password
<Bot> Thanks! Your have logged in as: User
<Bot> For commands type: !commands



seanturner70 #205829 01/11/08 08:53 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Here's one way of doing it, but by no means the only, or even the best option.
Code:
on *:text:!login*:?:{
  if !$2 || !$3 {    .msg $nick Usage !login User pAsSw0rD  }
  elseif $hget(Login,$+($nick,.User)) === $2 {
    if $hget(Login,$+($nick,.Password)) === $md5($3) {
      .auser user $nick
      .msg $nick For commands type !commands
    }
    else {      .msg $nick Invalid Password    }
  }
  else {    .msg $nick Invalid User Name  }
}
on user:*:text:!commands:*:{
  ;list of available commands
}
on *:start:{
  if !$hget(Login) { .hmake Login 100 }
  if $exists(Login.hsh) { .hload Login Login.hsh }
}
menu nicklist {
  Bot User Entries
  .Add User : add_user $1
  .Remove User : rem_user $1
}
alias add_user {
  .hadd -m Login $iif($1,$1,$$?="Enter User Name") $md5($$?="Enter password to be used")
}
alias rem_user {
  .hdel Login $iif($1,$1,$$?="Enter User Name")
}
on *:exit:{
  .hsave Login Login.hsh
}
on *:disconnect:{
  .hsave Login Login.hsh
}


Automatic save of hash table added when the bot disconnects from the network or if the bot's client closes. Forgot them on the original post.

Last edited by RusselB; 01/11/08 09:53 PM.
RusselB #205835 01/11/08 09:22 PM
Joined: Oct 2008
Posts: 167
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
How do you add a user?

seanturner70 #205839 01/11/08 09:50 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
See the menu or the add_user alias near the end of the code.

The menu option allows you to quickly add someone that is in the channel, as the add_user alias allows you to add people that aren't currently in a channel with you.

Likewise for removing a user.

NOTE: These options are available on the bot's client only.


Link Copied to Clipboard