Attachment 'RegBot.by.NRJv.1.2_api2.lua'

Download

   1 --[[
   2 
   3 	Ïðîñòîé ñêðèïò ðåãèñòðàöèè 
   4 	îò NRJ v. 1.2 (22/09/06)
   5 
   6 	Êîìàíäû:
   7 	!regme <pass> - çàðåãèñòðèðîâàòüñÿ
   8 	!passwd <new_pass> - èçìåíèòü ïàðîëü (âñòðîåííàÿ êîìàíäà)
   9 	!unreg - óäàëèòü ðåãèñòðàöèþ
  10 
  11 	Changelog:
  12 
  13 	Ïåðåâ¸ë íà àïè2 - Trans 
  14 	(è óáðàë ãåíåðèðóåìûé ïàðîëü, ïðè÷èíà - î÷åíü ÷àñòî þçåðû íå çàïîìèíàþò åãî, à òàêæå óäàëèë îòñûëêó â ïðèâàò íàïîìèíàíèÿ î ðåãèñòðàöèè, óæ î÷åíü ðàçäðàæàåò)
  15 	
  16 	**1.2**
  17 	- íåçàðåãèñòðèðîâàííûå ïîëüçîâàòåëè ïðè âõîäå íà õàá ïîëó÷àþò ñîîáùåíèå î íåîõîäèìîñòè ðåãèñòðàöèè
  18 	- äîáàâëåíà êîìàíäà !reghelp
  19 
  20 	**1.1**
  21 	- äîáàâëåíà êîìàíäà !unreg
  22 	- äîáàâëåíî ìåíþ äëÿ çàðåãèñòðèðîâàííîãî ïîëüçîâàòåëÿ
  23 
  24 ]]--
  25 
  26 ----------------------------------------------------- Êîíôèãóðàöèÿ -----------------------------------------------------
  27 ------------------------------------------------------------------------------------------------------------------------
  28 
  29 ShowInfo = 1	-- ïîêàçûâàòü äîïîëíèòåëüíóþ èíôîðìàöèþ î òîì, êàê ìîæíî èçáåæàòü ïîâòîðíûõ ââîäîâ ïàðîëÿ ïðè âõîäå íà õàá
  30 ShowToAll = 0	-- ïîêàçûâàòü âñåì ïîëüçîâàòåëÿì, ÷òî íà õàáå íîâûé çàðåãèñòðèðîâàííûé ó÷àñòíèê
  31 
  32 ------------------------------------------------------------------------------------------------------------------------
  33 ------------------------------------------------------------------------------------------------------------------------
  34 
  35 bot = SetMan.GetString(21)
  36 
  37 function UserConnected(tUser)   							--- þçåð çàÿâèëñÿ
  38 	UserMenu(tUser)   										--- è çàïîëó÷èë ìåíþ (à ñàìà ôóíêöèÿ îòïðàâêè ìåíþ íèæå)
  39 end
  40 OpConnected = UserConnected   								--- ÎÏû òîæå ëþäè
  41 RegConnected = UserConnected   								--- è ÐÅÃè òîæå
  42 
  43 function ChatArrival(tUser, sData)   						--- èçó÷àåì âñ¸, ÷òî îòïðàâëÿåòñÿ â ÷àò
  44     Core.GetUserAllData(tUser)   							--- âûáèâàåì èç þçåðà âñþ èíôîðìàöèþ (íà âñÿêèé ñëó÷àé)
  45 	local sData = sData:sub(1,-2)   						---  çàõâàò âèäèìîé ÷àñòè ñîîáùåíèÿ, âêëþ÷àÿ è íèê îòïðàâèòåëÿ
  46 	local _,_,cmd = sData:find("%b<>%s+(%S+)")   			---  çàõâàò ïåðâîãî ñëîâà ïîñëå íèêà îòïðàâèòåëÿ è ïåðâîãî ïðîáåëà
  47 	if cmd == "!regme" then   								--- åñëè ýòî êîìàíäà ðåãèñòðàöèè
  48 		if not(tUser.bRegistered) and RegMan.GetReg(tUser.sNick) == nil then   --- åñëè þçåð íå çàðåãåí è åñëè äàííîãî íèêà íåò â ñïèñêå çàðåãèñòðèðîâàííûõ
  49 			local s,e,pass = string.find(sData, "%b<>%s+%S+%s+(%S+)")   --- òî ïðîâåðÿåì íàëè÷èå ïàðîëÿ â êîìàíäå 
  50 			if (pass == nil) then   						--- åñëè íåò ïàðîëÿ
  51 				Core.SendToUser(tUser, "<"..bot.."> Âû çàáûëè ââåñòè ïàðîëü!")   --- îò âîðîò ïîâîðîò, ïóñòü ïèøåò ïî íîâîé
  52 				return true   								--- íî êîìàíäó âñ¸ æå ñêðûâàåì îò îñòàëüíûõ
  53 			end   											--- ïðîõîäèì äàëüøå, åñëè ïàðîëü åñòü
  54 			RegMan.AddReg(tUser.sNick, pass, 3)   			--- è ðåãèñòðèðóåì åãî
  55 			Core.SendToUser(tUser, "<"..bot.."> Âû òåïåðü çàðåãèñòðèðîâàíû íà õàáå. Âàø íèê:"..tUser.sNick.." Ïàðîëü: "..pass..". Ñîõðàíèòå ïàðîëü è íå çàáóäüòå ïåðåçàéòè íà õàá!")   								--- è þçåð ïîëó÷àåò òàêîå ñîîáùåíèå ñî ñâîèì ïàðîëåì, ÷òîá ìîã ñêîïèðîâàòü è ñîõðàíèòü
  56 			if (ShowInfo == 1) then   						--- åñëè ÷òîèò ãàëî÷êà "ïîêàçûâàòü äîï. èíôîðìàöèþ ñ ñîâåòîì"
  57 				Core.SendToUser(tUser, "<"..bot.."> Òåïåðü äëÿ âõîäà íà õàá ïîä âàøèì íèêîì íåîáõîäèìî çíàòü ïàðîëü. Âû ìîæåòå ââîäèòü åãî êàæäûé ðàç âðó÷íóþ, ëèáî ïðîïèñàòü ïàðîëü â íàñòðîéêàõ êëèåíòà. Äëÿ ýòîãî íàéäèòå â ñïèñêå èçáðàííûõ õàáîâ ýòîò õàá, çàéäèòå â åãî ñâîéñòâà è ïðîïèøèòå â ñòðîêàõ Nick è Password âàøè íèê è ïàðîëü.")   					--- òî ïîëó÷àåò åãî
  58 			end												--- õýïïè ýíä - 1
  59 			if (ShowToAll == 1) then					   --- åñëè ñòîèò ãàëî÷êà "èçâåñòèòü âñåõ î íîâîì çàðåãåííîì þçåðå"
  60                 Core.SendToAll("<"..bot.."> Ïîïðèâåòñòâóåì íîâîãî çàðåãèñòðèðîâàâøåãîñÿ ó÷àñòíèêà - "..tUser.sNick.." !!!")   --- ðàäîñòíî ïðåäñòàâëÿåì îñòàëüíîìó îáùåñòâó íîâè÷êà
  61 			end   											--- õýïïè ýíä - 2
  62 		else   												--- ýòîò íèê óæå çàðåãåí, îêàçûâàåòñÿ
  63 			Core.SendToUser(tUser, "<"..bot.."> Âû óæå çàðåãèñòðèðîâàíû!")   --- è îí ïîëó÷àåò îòêàç
  64 		end   												--- òðàãè÷åñêèé ôèíàë
  65 		return true   										--- òîæå ñêðûâàåì êîìàíäó îò äðóãèõ
  66 	end   													--- êîíåö èñòîðèè î ðåãèñòðàöèè
  67 	if cmd == "!unreg" then   								--- åñëè æå êîìàíäà - "óäàëèòü ðåãèñòðàöèþ"
  68 		if (tUser.iProfile > -1) then   					--- è åñëè þçåð â ñàìîì äåëå çàðåãåí
  69 			RegMan.DelReg(tUser.sNick)   					--- õîçÿèí-áàðèí, óäîâëåòâîðÿåì æåëàíèå êëèåíòà
  70 			Core.SendToUser(tUser, "<"..bot.."> Âàø àêêàóíò òåïåðü óäàëåí.")   --- è îòïðàâëÿåì åìó îòêðûòêó ñ íàøèìè ñîæàëåíèÿìè.
  71 		else   												--- åñëè æå þçåð íå çàðåãåí
  72 			Core.SendToUser(tUser, "<"..bot.."> Êîìàíäà äîñòóïíà òîëüêî äëÿ çàðåãèñòðèðîâàííûõ ïîëüçîâàòåëåé!")   --- òåïåðü îí òîæå îá ýòîì çíàåò
  73 		end   --- 
  74 		return true   										--- ñêðûâàåì êîìàíäó
  75 	end   													--- ïîêîí÷èëè ñ óäàëåíèåì ðåãèñòðàöèè
  76 	if cmd == "!reghelp" then   							--- åñëè êîìàíäà - î ïîìîùè
  77 		local msg = "\r\n\r\n"..   							--- ñîáèðàåì âñ¸ ÷òî ìîæåò ïîìî÷ü þçåðó
  78 		"\t"..string.rep("=", 50).."\r\n"..
  79 		"\t\tÏîìîùü ïî ðåãèñòðàöèè\r\n"..
  80 		"\t"..string.rep("-", 100).."\r\n\r\n"..
  81 		"\t!reghelp\t\t - Ýòîò ôàéë ïîìîùè\r\n"..
  82 		"\t!regme <ïàññ>\t - Çàðåãèñòðèðîâàòüñÿ (ìîæíî íå óêàçûâàòü ïàññ)\r\n"..
  83 		"\t!passwd <ïàññ>\t - Ñìåíèòü ïàðîëü (âñòðîåííàÿ êîìàíäà õàáà)\r\n"..
  84 		"\t!unreg\t\t - Óäàëèòü àêêàóíò\r\n\r\n"..
  85 		"\tÒàêæå âñå êîìàíäû äîñòóïíû â ìåíþ õàáà:\r\n"..
  86 		"\tÍàæìèòå ïðàâîé êíîïêîé ìûøè íà ëþáîãî ïîëüçîâàòåëÿ\r\n"..
  87 		"\tè âûáåðèòå ïîäìåíþ 'Ðåãèñòðàöèÿ'\r\n"
  88 		Core.SendPmToNick(tUser.sNick, bot, msg)   			--- è îòïðàâëåì åìó â ïðèâàò, íà ïîë÷àñà ÷òèâîì îí îáåñïå÷åí
  89 		return true   										--- òîæå ñêðûâàåì êîìàíäó
  90 	end   													--- êîíåö ýòàïà ïîìîùè
  91 end   														--- è âîîáùå, õâàòèò ÷èòàòü ÷àò
  92 
  93 ToArrival = ChatArrival   									--- åñëè âûøåóêàçàííûå êîìàíäû íàïèøóò â ïðèâàòå, ðåçóëüòàò áóäåò òàêîé æå (íå î÷åíü âåðèòñÿ, íî äîïóñêàþ)
  94 
  95 function UserMenu(tUser)   									--- îáåùàííàÿ ôóíêöèÿ îá îòïðàâêå ìåíþ þçåðó ïðè âõîäå
  96 	if (tUser.iProfile == -1) then   						--- ýòî ìåíþ ïîëó÷èò íåçàðåãåííûé þçåð
  97 			Core.SendToUser(tUser, "$UserCommand 0 3")
  98 			Core.SendToUser(tUser, "$UserCommand 1 3 Ðåãèñòðàöèÿ\\Çàðåãèñòðèðîâàòüñÿ$<%[mynick]> !regme %[line:Ââåäèòå ïàðîëü]&#124;")
  99 			Core.SendToUser(tUser, "$UserCommand 1 3 Ðåãèñòðàöèÿ\\Ïîìîùü ïðè ðåãèñòðàöèþ$<%[mynick]> !reghelp&#124;")
 100 	else   													--- à âñå çàðåãåííûå ïîëó÷àò ýòî ìåíþ
 101 		Core.SendToUser(tUser, "$UserCommand 0 3")
 102 		Core.SendToUser(tUser, "$UserCommand 1 3 Ðåãèñòðàöèÿ\\Ñìåíèòü ïàðîëü$<%[mynick]> !passwd %[line:Ââåäèòå íîâûé ïàðîëü]&#124;")
 103 		Core.SendToUser(tUser, "$UserCommand 1 3 Ðåãèñòðàöèÿ\\Óäàëèòü ðåãèñòðàöèþ$<%[mynick]> !unreg&#124;")
 104 		Core.SendToUser(tUser, "$UserCommand 1 3 Ðåãèñòðàöèÿ\\Ïîìîùü ïðè ðåãèñòðàöèè$<%[mynick]> !reghelp&#124;")
 105 	end   --- 
 106 end   														--- îòïðàâèëè
 107 
 108 ---   ýòà ôóíêöèÿ - äëÿ îòïðàâëåíèÿ â îï÷àò ñîîáùåíèé îá îøèáêå ñêðèïòà, åñëè ñêðèïò ïàäàåò â ïðîöåññå ýêñïëóàòàöèè
 109 function OnError(s)
 110   local h=io.open("errors.log","a+")
 111   if h then
 112     h:write(os.date()..": "..s.."\r\n")
 113     h:close()
 114   end
 115   if Core then
 116     Core.SendToOpChat(s)
 117   else
 118     SendToOpChat(s)
 119   end
 120 end

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2009-12-23 18:07:56, 10.4 KB) [[attachment:CleanReg_API2.lua]]
  • [get | view] (2009-12-23 18:59:52, 7.0 KB) [[attachment:RegBot.by.NRJv.1.2_api2.lua]]
  • [get | view] (2009-12-23 18:38:41, 66.5 KB) [[attachment:RegMe_v1.5.lua]]
  • [get | view] (2009-12-23 18:42:58, 12.0 KB) [[attachment:Registration.v2.0.lua]]
  • [get | view] (2009-12-23 17:59:58, 7.9 KB) [[attachment:Registrator_1.00_beta.rar]]
  • [get | view] (2009-12-23 19:19:13, 8.3 KB) [[attachment:_NewAPI_RegBot.zip]]
  • [get | view] (2009-12-23 19:09:47, 4.2 KB) [[attachment:reguser.zip]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.