Dummies Guide To Adding Users ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NOTE: Read this from beginning to end. There will be a test! Contents ~~~~~~~~ Section 1: Initial Setup Section 2: Your Very First Add Section 2: Adding General Users Section 3: Deleting Users Section 4: Adding A Host Section 5: Deleting A Host =========================================================================== Section 1: Initial Setup ~~~~~~~~~~~~~~~~~~~~~~~~ Starting from version 2.8.3 of the Energymech setup is done a little differently. Previous versions have required you to run the bot first and then add yourself as the bots owner. From here on out you will need to run the supplied genuser shell script to add yourself to the bots userfile *before* you run it for the first time. If you start your bot without running the genuser script first you will get output similar to the following: init: Mech(s) added [ emech ] init: Fatal: emech has no userlist, run ./genuser emech.users init: 1 bot(s) have no userlist. EnergyMech NOT running. This is just the last few lines of output but you can see it even tells you what you didn't do (create the userlist) and how to fix the problem (running genuser). You run genuser from your shell prompt: ./genuser emech.users The script is very simple to use and comes with complete instructions onscreen. Just make sure you follow the prompts for Handle and Hostmask. Look at the examples shown in genuser if you are not too sure. When genuser is finished it will output the following if it is successfull: Userfile emech.users created. If it fails then make polite enquiries about it and you might get answered. In the next section you will find out how to add the general users. Read it carefully. =========================================================================== Section 2: Adding General Users ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The command you use for adding general users is the Add command. It allows you to add global and channel users. NOTE: The bot will let you add users to channels that the bot isn't in or channels that don't even exist. There are two ways you could add yourself to your bot. You can message the add command to it or you can type it in the channel. Both methods provide the desired result - the user is added. Method 1: Message the bot /msg botnick -add handle * nick/userhost level aop prot password Method 2: Open channel command NOTE: An open channel command is typed straight in and shows up in the channel. botnick -add handle * nick/userhost level aop prot password or -add handle * nick/userhost level aop prot password Breakdown: /msg - Command from your IRC software to message the bot. botnick - Your bots nick. -add - This is the add command. The '-' should be replaced with what you chose for your bots command character in the mech.set file. handle - A handle is just a name for the users record in the bot. A handle can be 1 -9 characters long. * - This is the channel specification. A '*' means to add a global user. Use #channel to add general users. nick/ userhost - You can put the bot users nick here or you can specify a userhost mask (e.g. *!*user@*.host.com). The bot will let you add using a stupid userhost mask so be carefull and think before you add. level - The user level determines what commands are available to the user being added. Global users should probably be set at level 100 (which gives them total control) and general users be given only the level that they need to do their channel control tasks. aop - The Auto-Op toggle is used to tell the bot that this user should be op'd when they enter a channel. Set to 0 it is turned off and set to 1 it is turned on. NOTE: You either have to VERIFY before entering the channel or have no password for this to work. And adding the first user with not password would be very stupid! prot - The protection level determines what should be done when something happens to this user. Protection levels are explained fully in Appendix i. password - You do not need a password to use a bot BUT a global user should always have a password. No matter which method you choose to add a user to your bot the outcome will be the same. You will get either an error message or a confimation that the user has been added. Here are some examples of error messages and the commands that produce them. Example 1: Command: /msg addbot -add azmodan * joebloggs 100 0 0 changeme Response: -AddBot(azmodan@phrozen.gen.nz)- No information found for joebloggs Error: The nick joebloggs didn't actually exist when the add command was sent to the bot. Command: /msg addbot -add azmodan * *!*dan@*.gen.nz 100 0 5 changeme Response: -AddBot(azmodan@phrozen.gen.nz)- Usage: ADD [aop] [prot] [pass] Error: Protection levels are from 0-4. 5 was outside thise range so the bot thought you needed to see the help on the add command. Command: /msg addbot -add azmodan * azmodan 500 0 0 changeme Response: -AddBot(azmodan@phrozen.gen.nz)- Valid levels are from 0 thru 100 Error: User levels are from 0 to 100. And for the global user you should be using 100 to give total control of the bot. Command: /msg addbot -add azmodandude * azmodan 100 0 0 changeme Response: -AddBot(azmodan@phrozen.gen.nz)- Handle must be between 1 and 9 chars in length Error: The handle you tried to add is more that 9 characters. The limit is 9 characters and you cannot go over it. Command: /msg addbot -add trustme * rogue 100 0 0 changeme Notes: This adds the nick rogue with the handle of trustme as a level 100 user that has global access. Command: /msg addbot -add notrust #UserGuide rogue 10 0 0 changeme Notes: This adds the nick rogue with the handle of notrust as a level 10 user that has access to only channel #UserGuide. We don't trust this person all that much. Command: /msg addbot -add general #UserGuide rogue 40 0 0 changeme Notes: This adds the nick rogue with the handle of general as a level 40 user that has access to only channel #UserGuide. This person can use all commands of level 40 and below. There are probably other ways to produce errors from using the add command. If you stick to using the add command by following the breakdown above then you can't go too far wrong (if you do consider yourself special and beyond help). When you actually add the user correctly you will get something similar to the following example. Example 2: -AddBot(azmodan@phrozen.gen.nz)- azmodan has been added as *!*azmodan@*.gen.nz on * -AddBot(azmodan@phrozen.gen.nz)- Access level: 100 Auto-op: No Protect level: 0 Password: changeme If you got this then congratulations you have now added your first general user and can have a cookie (NOTE: Cookies have been discontinued). At this point you might want to issue a save command e.g. /msg botnick -save. Use your own bot nick and your own command character. The user level is important when adding general users. You should only give them the level required to get their job done. If you don't want user joebloggs to have the ability to issue the die command then don't give him/her level 100 access. Consult the Default Command Levels in Appendix ii when you are making up your mind what level to add a user at. To add a user to more than one channel you need to add them with a different handel for each channel. If you stick to the breakdown above you can't go very wrong when adding users. In the next section you will learn how to remove users. =========================================================================== Section 3: Deleting Users ~~~~~~~~~~~~~~~~~~~~~~~~~~ Ok, so now you know how to add users you might be wondering how you remove them when they are no longer required. This is probably one of the simpler commands you can use with your bot. Before deleting a user you need to know the handle that you added them with. If you don't know it or want to double check and make sure then you can use the userlist command e.g. /msg botnick -userlist. Check in the list that comes up for the user you want to delete and note the handle. You have decided to delete the user with the handle of rogue. You can do this one way by using the del command. Example 3: Command: /msg addbot -del trustme Response: -AddBot(azmodan@phrozen.gen.nz)- User trustme has been purged This is a successfull delete. The user record is now gone. Check with /msg botnick -userlist if you want to double check. If you had specified an unknown handle then the bot will tell you that you have made a mistake. Example 4: Command: /msg addbot -del rogue2 Response: -AddBot(azmodan@phrozen.gen.nz)- Unknown handle Error: The handle rogue2 did not exist so could not be deleted. If this happens to you then check the handle in the userlist again and get it right this time! Repeat the process for each user that you want to remove. =========================================================================== Section 4: Adding A Host ~~~~~~~~~~~~~~~~~~~~~~~~ If a user has more than one host you don't need to add a whole new user on a different handle to give them access to the same channel. You can add what is called a host to the user. The command to do this is /msg botnick -host add handle hostmask. Handle is the same handle you gave the user when you added them to the bot. The hostmask is made up of a combination of the users ident and host. Some examples of users and possible hostmasks are shown below to give you a basic idea of how to make up a hostmask. If you do a /whois nick on your user you will get the information that you need to decide on the hostmask. Example 5: Whois: Rogue (barky@irc.phrozen.gen.nz) Hostmask: *!*barky@*.phrozen.gen.nz Notes: This mask will match on barky@skippy.phrozen.gen.nz or barky@irc.phrozen.gen.nz. The '*' is a wildcard that stands for anything. Whois: Azmodan (azmodan@m002-b002.dialup.akl.clear.net.nz) Hostmask: *!*azmodan@*.dialup.akl.clear.net.nz Notes: With this host we are making sure that the user has to be on dialup.akl.clear.net.nz before they will be recognised by the bot. Now for some examples of adding a host. Example 6: Command: /msg addbot -host add trustme *!*barky@*.phrozen.gen.nz Response: -AddBot(azmodan@phrozen.gen.nz)- Added mask *!*barky@*.phrozen.gen.nz to user trustme Notes: This is a good hostmask that leaves little room for being abused by other users. Command: /msg addbot -host add trustme *!*@*.* Response: -AddBot(azmodan@phrozen.gen.nz)- Added mask *!*@*.* to user trustme Notes: This is a valid host but one you should never add to a user. This host basically allows anyone that knows the password for this user to access the bot using this users handle. Command: /msg addbot -host add trustme *!*@* Response: -AddBot(azmodan@phrozen.gen.nz)- Problem adding *!*@* (global mask) Notes: The bot won't let you be totally rediculous with this global hostmask. You can add as many hostmask to a user as you need. These hostmasks allow users access to the bot from any different shell accounts or ISP accounts that they may have. Of course from time to time you may wish to remove hostmasks from users. This is explained in the final section. =========================================================================== Section 5: Deleting A Host ~~~~~~~~~~~~~~~~~~~~~~~~~~ Deleteing a host is very similar to adding a host. The only thing that changes is the add becomes a del e.g. /msg botnick -host del handle hostmask. You can get a list of a users handle and current hostmasks by using the userlist command e.g. /msg botnick -userlist. Work out the handle and the hostmask that you want removed from it. Here are some hostmask deletes as examples. Example 7: Command: /msg addbot -host del trustme *!*barky@*.phrozen.gen.nz Response: -AddBot(azmodan@phrozen.gen.nz)- Deleted mask *!*barky@*.phrozen.gen.nz from user trustme Notes: All their other hostmasks remain. Only the one in the delete command is actually removed. Command: /msg addbot -host del trustme *!*barky@*.com Response: -AddBot(azmodan@phrozen.gen.nz)- Deleted mask *!*barky@*.com from user trustme Notes: -host del will respond saying that the hostmask was removed if it does not exist. Thats all there is to hostmask deleting and also the end of the Dummies Guide To Adding Users. I hope you have found this document helpfull and that have many hours of fun adding and removing various things from your users. *************************************************************************** Appendicies ~~~~~~~~~~~ Appendix i: Protection Levels Protection level can be 0 through 4 where the specific levels are as follows: 0 No protection. 1 Reop/unban, do nothing to offender. 2 Reop/unban, deop offender. 3 Reop/unban, kick offender. 4 Reop/unban, kickban offender. Protection must be toggled on for a channel for anything to happen. --------------------------------------------------------------------------- Appendix ii: Default Command Levels These are the levels of all the commands a bot will accept. Use this list to determine what you give your bot users access to. Level 10: access, bye, chat, cmdchar, down, echo, help, passwd, usage, verify Level 20: host, ontime, seen, uptime, ver, whom Level 40: ban, banlist, cchan, channels, cmd, cserv, deop, idle, invite, kb, kick, lusers, mode, names, op, rt, screw, siteban, sitekb, time, topic, unban, unvoice, up, voice, wall, who, whois Level 50: insult, pickup, qshit, rshit, shit, shitlist, shitlvl Level 60: add, clvl, ctcp, del, showidle, user, userlist, ustats Level 70: cycle, esay, join, ks, kslist, part, rks, setpass Level 80: addserver, away, delserver, forget, last, load, loadlevels, loadlists, me, msg, nextserver, rehash, report, rstatmsg, save, savelevels, savelists, say, server, serverlist, statmsg, stats, userhost, virtual, wingate Level 90: chaccess, clearshit, do, link, nick, rspy, rspymsg, set, spy, spylist, spymsg, tog Level 100: core, debug, die, reset, shutdown, spawn, uset ---------------------------------------------------------------------------