mIRC Home    About    Download    Register    News    Help

Print Thread
#160332 25/09/06 02:06 PM
Joined: Sep 2006
Posts: 35
C
chump Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Sep 2006
Posts: 35
HI, guyz i am trying to add access to my bot from a text file called nicks.txt i want it to search the file from an ontext cmd
and if the nick is in the list then that person has access to bot to perform cmds any hlep on this would be great smile

#160333 25/09/06 02:49 PM
Joined: Dec 2004
Posts: 66
B
Babel fish
Offline
Babel fish
B
Joined: Dec 2004
Posts: 66
In general searching a .txt file in On events isn’t very efficient. For up to a dozen or so nicks I’d use a token, for a large list I’d use a hash table. How many nicks do you expect to have in the list? If you could give a few examples of your bot commands that would help too. “!botsay Hello everyone” etc.

/help Token Identifiers
/help Hash tables

#160334 25/09/06 02:58 PM
Joined: Sep 2006
Posts: 35
C
chump Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Sep 2006
Posts: 35
would be no more then 10 nicks in list..and basic commands like !approve and maybe also like a cmd to add remove from the list would be good...such as !addnick bob !remove nick bob..so i could edit the nick list etc from mirc instaed of opening up the txt file everytime i wanna add access if you see what i mean

#160335 25/09/06 04:28 PM
Joined: Dec 2004
Posts: 66
B
Babel fish
Offline
Babel fish
B
Joined: Dec 2004
Posts: 66
This is minimal/skeletal, but hopefully it will give you ideas that will work for you.
Code:
; /BotNicks.Set to initialize the list
alias BotNicks.Set {
  set -s %BotNicks zud bob Sally
}

alias BotNicks.add {
  if ($1) set -s %BotNicks $addtok(%BotNicks,$1,32)
  else echo -a BotNicks.add requires a nick
}

alias BotNicks.remove {
  if ($1) set -s %BotNicks $remtok(%BotNicks,$1,1,32)
  else echo -a BotNicks.remove requires a nick
}

on *:Text:!approve*:*: {
  if ($istok(%BotNicks,$nick,32)) {
    echo -a $nick wants to approve: $2-
  }
  else echo -a $nick is not in the %BotNicks list and tried to use !approve
}

on *:Text:!addnick*:*: {
  if ($istok(%BotNicks,$nick,32)) {
    ; can add error checking for if a nick to add was given and send a message to $nick if it wasn't
    BotNicks.add $2
  }
  else echo -a $nick is not in the %BotNicks list and tried to use !addnick
}

menu nicklist {
  $iif($snick(#,0) == 1, BotNicks list)
  .Add $1 : BotNicks.add $$1
  .Remove $1 : BotNicks.remove $$1
}  

BotNicks.add and BotNicks.remove can be used as aliases or from the channel’s nick list.

#160336 25/09/06 09:35 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
The best method for handling access to a bot would be to use the User List. Set the users (and all possible IP/DNS combinations that you expect them to have) up in the User List under a number such as 1000. Then, use 1000 in your on texts...

Code:
on 1000:text:*:#: {
  do stuff
}


Most people these days are on high speed internet, so even if they don't have static IP addresses, they usually won't change IP very often. Your only real issue with doing it this way would be if they are dial-up users. In that case, I would just set up a login to the bot and if they log in properly, it will automatically add their new IP info to the user list (/auser).

The danger with doing just nicks for bot access is that as soon as someone realizes that they only need to have a specific nick to use the bot, they will change their nick to one of the required nicks when that person is not in the channel and wreak havok on your bot.


Invision Support
#Invision on irc.irchighway.net
#160337 26/09/06 02:03 AM
Joined: Mar 2004
Posts: 210
F
Fjord artisan
Offline
Fjord artisan
F
Joined: Mar 2004
Posts: 210
Quote:
Your only real issue with doing it this way would be if they are dial-up users.


We never had a problem back when almost everyone was on dialup. Even now I have one op who has (so far) 8 entries in my user list (his isp changes the last 3 octets). mIRC is fast enough to handle it.

#160338 26/09/06 09:04 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I just meant that you usually only had people with IPs that changed often when there was dialup. Depending on the ISP, you could see the IP changing between only a few numbers, or it could be a LOT of different numbers. Yes, mIRC will add them just fine... it's not an issue with speed. The issue is that if you automatically add them based on nick, you can end up adding the wrong people. That's why I mentioned using a login and then automatically adding the user to the user list after they logged in.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard