I come from a c and c++ background and just started learning to script in java and pascal. I'm hoping to eventually make it to contributing member on this site. Seeing as it will take me a while to start contributing code I figured I would start off by contributing something I already know how to do Smiley This is an invite system I wrote for irc bots. It's not one of those invite spammers but a bot ;script for irc that can replace the use of channel keys because keys tend to get leaked. All thats required to use it is a premade irc bot or a clean install of mirc that will function as a bot. The bot needs to have half op or op with flags set to allow it to send channel invites from the channel that is to be restricted.Users who are to be added to the authorized list must have a registered nick or they will need to be readded every time they reconnect to the irc server. It also needs to be in a public channel to listen for the !invite trigger.I created this because the password to a channel i used to frequent got leaked frequently and we got tired of changing the channel key everyday.
Hopefully this code comes in handy for someone. It served me well while i needed it. Script simply needs to be placed in the remotes section of the mirc script editor of the bot client and authorised bot admins added to the user section of the same client. Obviously the restricted channel needs to be set to invite only for this to be effective Smiley Feedback is welcome.Code:On @*:JOIN:#{publicchannel}: { if ($read(members.txt, s, $address($nick,2)) != $null) { /invite $nick #memberschannel /notice $nick You have been invited to #memberschannel- write /join #memberschannel to join the channel! } else { /mode $chan +v $nick } } ;the above section checks the access list named members.txt to ;see if the person entering the public channel has a known hostname ;and should be autoinvited to the members channel ;members.txt is created when the first member is added and resides ;in the main irc client folder ;Does not always work because of possible delay between joining a ;irc server and identifying of the persons nick with nickserv on 500:TEXT:!Member *:#publicchannel: { write -s $+ $address($$2,2) members.txt $address($$2,2) $$2 /msg $chan $$2 has been added to the list of members! } ;This peice of code monitors #publicchannel for the !member trigger ;Proper useage is !member nick of person being added to members ;Persons nick is written to members.txt along with their hostname ;Person can change their nick all they want and as long as hostname ;matches the entry in members.txt they will be allowed access to ;the members channel upon usage of the !invite trigger ;Multiple channels can be specified for the bot to listen on but bot ;must also be in those channels to see the trigger ;500 refers to authorised bot admins that are specified in the "users" ;section of the mirc scripts editor as ;500:*!*@James.users.barafranca.com ;Adjust for hostmask display on the irc server you are using on 500:TEXT:!Removemember *:#publicchannel:{ write -ds $+ $address($$2,2) members.txt /msg $chan $$2 has been removed from the list of members! } ;Does the reverse of the !member command and removes a persons ;entry from the access list. on *:TEXT:!Invite*:#pubchannel,#pubchannel2,#pubchannel3,#pubchannel4: { if ($read(members.txt, s, $address($nick,2)) != $null) { /invite $nick #members } else { msg $chan $nick you're not on the members list! } } ;This code listens for the !invite trigger on the channels you specify ;When the member desires to enter the restricted channel they ;simply type !invite in the specified public channel or channels ;This part of the script compares the users hostmask to that ;contained in members.txt and if user is on the list and invite is ;issued by the bot to the member. ;If the entry is not found then the bot publicly displays a refusal ;message


Reply With Quote
